[Image-SIG] Pasting with pixmaps broken in 1.0 final?
Fredrik Lundh
fredrik@pythonware.com
Fri, 3 Dec 1999 13:30:29 +0100
I wrote:
> Robert Kern <kern@its.caltech.edu> wrote:
> > Under 1.0b1, the image is a square gradient going from red to green on a
> > red background. Under 1.0 final, the image has the left half of the
> > gradient the same as previous, but the right half is a solid light blue,
> > no gradient at all.
> >
> > Something in ImagingFill2 perhaps?
>
> I can repeat the problem it on other platforms, so
> I guess I cannot blame your compiler ;-)
>
> it's probably a signed/unsigned problem. I'll look
> into it as soon as I find some time to spare.
a quick look reveals that the code in Paste.c
is completely braindead: filling with constant
colors and matte masks ("L" and "RGBA") simply
doesn't work.
filling with binary masks (mode "1") works fine,
though.
a rough workaround is to emulate what earlier
versions did: create a new image with the same
size as the pasted area and the fill colour, and
paste it. e.g:
x0, y0, x1, y1 = bbox
im.paste(
Image.new("RGB", (x1-x0, y1-y0), color),
bbox, mask
)
I'll post patches for Paste.c during this weekend
(and update our regression test suite...)
</F>