From afb6ebd21e8296f7f49a49161e38cf2414ffbf3e Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Tue, 4 May 2021 17:48:43 +0200 Subject: [PATCH] Fix gray+alpha alpha extract. --- core/image/common.odin | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/image/common.odin b/core/image/common.odin index e92060ed2..9024ec769 100644 --- a/core/image/common.odin +++ b/core/image/common.odin @@ -150,15 +150,15 @@ return_single_channel :: proc(img: ^Image, channel: Channel) -> (res: ^Image, ok idx := int(channel); - if idx > img.channels { - return {}, false; - } - if img.channels == 2 && idx == 4 { // Alpha requested, which in a two channel image is index 2: G. idx = 2; } + if idx > img.channels { + return {}, false; + } + switch(img.depth) { case 8: buffer_size := compute_buffer_size(img.width, img.height, 1, 8);