[IMAGE-SIG] bug fix for 0.3a1 on SGI with -n32
gregc@cgl.ucsf.EDU
gregc@cgl.ucsf.EDU
Fri, 5 Sep 1997 18:05:48 -0700
There seems to be a bug in the SGI 7.1 -n32 compiler that breaks pasting
of images with alpha. Enclosed are the context diffs to libImaging/Paste.c.
Greg Couch
gregc@cgl.ucsf.edu
----
===================================================================
RCS file: RCS/Paste.c,v
retrieving revision 1.1
diff -c -r1.1 Paste.c
*** 1.1 1997/09/06 00:18:29
--- Paste.c 1997/09/06 00:55:04
***************
*** 20,27 ****
#define MULDIV255(a, b, tmp)\
(tmp = (a) * (b) + 128, (((tmp >> 8) + tmp) >> 8))
! #define BLEND(mask, in1, in2, tmp)\
! MULDIV255(in1, 255 - mask, tmp) + MULDIV255(in2, mask, tmp)
#define COMPOSE(mask, in1, in2, tmp)\
MULDIV255(in1, 255 - mask, tmp) + in2
--- 20,27 ----
#define MULDIV255(a, b, tmp)\
(tmp = (a) * (b) + 128, (((tmp >> 8) + tmp) >> 8))
! #define BLEND(mask, in1, in2, tmp, tmp2)\
! MULDIV255(in1, 255 - mask, tmp) + MULDIV255(in2, mask, tmp2)
#define COMPOSE(mask, in1, in2, tmp)\
MULDIV255(in1, 255 - mask, tmp) + in2
***************
*** 48,54 ****
ImagingPaste(Imaging imOut, Imaging imIn, Imaging imMask,
int x0, int y0, int x1, int y1)
{
! int x, y, i, tmp;
int xm;
int xx;
int xsize, ysize;
--- 48,54 ----
ImagingPaste(Imaging imOut, Imaging imIn, Imaging imMask,
int x0, int y0, int x1, int y1)
{
! int x, y, i, tmp, tmp2;
int xm;
int xx;
int xsize, ysize;
***************
*** 104,115 ****
} else if (strcmp(imMask->mode, "L") == 0) {
/* "L" (8-bit) alpha layer. */
! PASTEMASK(BLEND(mask[xm], out[xx+i], in[xx+i], tmp), 1);
} else if (strcmp(imMask->mode, "RGBA") == 0) {
/* "A" alpha layer from "RGBA" image. */
! PASTEMASK(BLEND(mask[xm], out[xx+i], in[xx+i], tmp), 4);
} else if (strcmp(imMask->mode, "RGBa") == 0) {
--- 104,115 ----
} else if (strcmp(imMask->mode, "L") == 0) {
/* "L" (8-bit) alpha layer. */
! PASTEMASK(BLEND(mask[xm], out[xx+i], in[xx+i], tmp, tmp2), 1);
} else if (strcmp(imMask->mode, "RGBA") == 0) {
/* "A" alpha layer from "RGBA" image. */
! PASTEMASK(BLEND(mask[xm], out[xx+i], in[xx+i], tmp, tmp2), 4);
} else if (strcmp(imMask->mode, "RGBa") == 0) {
_______________
IMAGE-SIG - SIG on Image Processing with Python
send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
_______________