From 9390e5636a21ef6dbd68f787eb975bf40b255fa9 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 20 Apr 2020 18:53:37 +1000 Subject: [PATCH] Also consider other alpha modes --- src/libImaging/Paste.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libImaging/Paste.c b/src/libImaging/Paste.c index 69353ce46..d0610cfc5 100644 --- a/src/libImaging/Paste.c +++ b/src/libImaging/Paste.c @@ -380,7 +380,13 @@ fill_mask_L(Imaging imOut, const UINT8* ink, Imaging imMask, for (x = 0; x < xsize; x++) { for (i = 0; i < pixelsize; i++) { UINT8 channel_mask = *mask; - if (strcmp(imOut->mode, "RGBA") == 0 && i != 3) { + if (( + strcmp(imOut->mode, "RGBa") == 0 || + strcmp(imOut->mode, "RGBA") == 0 || + strcmp(imOut->mode, "La") == 0 || + strcmp(imOut->mode, "LA") == 0 || + strcmp(imOut->mode, "PA") == 0 + ) && i != 3) { channel_mask = 255 - (255 - channel_mask) * (1 - (255 - out[3]) / 255); } out[i] = BLEND(channel_mask, out[i], ink[i], tmp1);