mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-29 11:26:17 +03:00
use mode structs in Paste.c
This commit is contained in:
parent
c587ad10ab
commit
26b8178f08
|
@ -307,31 +307,26 @@ ImagingPaste(
|
|||
ImagingSectionEnter(&cookie);
|
||||
paste(imOut, imIn, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else if (strcmp(imMask->mode, "1") == 0) {
|
||||
} else if (imMask->mode == IMAGING_MODE_1) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
paste_mask_1(imOut, imIn, imMask, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else if (strcmp(imMask->mode, "L") == 0) {
|
||||
} else if (imMask->mode == IMAGING_MODE_L) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
paste_mask_L(imOut, imIn, imMask, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else if (strcmp(imMask->mode, "LA") == 0 || strcmp(imMask->mode, "RGBA") == 0) {
|
||||
} else if (imMask->mode == IMAGING_MODE_LA || imMask->mode == IMAGING_MODE_RGBA) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
paste_mask_RGBA(
|
||||
imOut, imIn, imMask, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize
|
||||
);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else if (strcmp(imMask->mode, "RGBa") == 0) {
|
||||
} else if (imMask->mode == IMAGING_MODE_RGBa) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
paste_mask_RGBa(
|
||||
imOut, imIn, imMask, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize
|
||||
);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else {
|
||||
(void)ImagingError_ValueError("bad transparency mask");
|
||||
return -1;
|
||||
|
@ -455,10 +450,11 @@ fill_mask_L(
|
|||
}
|
||||
|
||||
} else {
|
||||
int alpha_channel =
|
||||
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;
|
||||
int alpha_channel = imOut->mode == IMAGING_MODE_RGBa ||
|
||||
imOut->mode == IMAGING_MODE_RGBA ||
|
||||
imOut->mode == IMAGING_MODE_La ||
|
||||
imOut->mode == IMAGING_MODE_LA ||
|
||||
imOut->mode == IMAGING_MODE_PA;
|
||||
for (y = 0; y < ysize; y++) {
|
||||
UINT8 *out = (UINT8 *)imOut->image[y + dy] + dx * pixelsize;
|
||||
UINT8 *mask = (UINT8 *)imMask->image[y + sy] + sx;
|
||||
|
@ -617,27 +613,22 @@ ImagingFill2(
|
|||
ImagingSectionEnter(&cookie);
|
||||
fill(imOut, ink, dx0, dy0, xsize, ysize, pixelsize);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else if (strcmp(imMask->mode, "1") == 0) {
|
||||
} else if (imMask->mode == IMAGING_MODE_1) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
fill_mask_1(imOut, ink, imMask, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else if (strcmp(imMask->mode, "L") == 0) {
|
||||
} else if (imMask->mode == IMAGING_MODE_L) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
fill_mask_L(imOut, ink, imMask, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else if (strcmp(imMask->mode, "RGBA") == 0) {
|
||||
} else if (imMask->mode == IMAGING_MODE_RGBA) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
fill_mask_RGBA(imOut, ink, imMask, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else if (strcmp(imMask->mode, "RGBa") == 0) {
|
||||
} else if (imMask->mode == IMAGING_MODE_RGBa) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
fill_mask_RGBa(imOut, ink, imMask, dx0, dy0, sx0, sy0, xsize, ysize, pixelsize);
|
||||
ImagingSectionLeave(&cookie);
|
||||
|
||||
} else {
|
||||
(void)ImagingError_ValueError("bad transparency mask");
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user