diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-05-04 17:49:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-04 17:49:09 +0200 |
| commit | f3c4d972507bd186ffc2acfc45df498be591ea9d (patch) | |
| tree | b1e95f452960b451db164374d65e9aa0965c22fd | |
| parent | 6fa5eb9e1f195d538212adc24eb5cbdaf98edb01 (diff) | |
| parent | afb6ebd21e8296f7f49a49161e38cf2414ffbf3e (diff) | |
Merge pull request #942 from Kelimion/grayscale-alpha-extract
Fix gray+alpha alpha extract.
| -rw-r--r-- | core/image/common.odin | 8 |
1 files 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); |