[Image-SIG] patch to Tk/tkImaging.c (transparency problem) [PIL 1.1.1]

Fredrik Lundh fredrik@pythonware.com
Sun, 18 Mar 2001 21:41:23 +0100


Eric Pettersen wrote:

> Tk/tkImaging.c does not fully initialize the structure used to control the  
> copying of an alpha-containing image, which leads to possibly spurious  
> behavior (compiler/linker-dependent).

Ouch.  Looks like the Tk folks changed the API between 8.2.3 and 8.3.0,
without adding the usual "*** POTENTIAL INCOMPATIBILITY ***" warning
to the CHANGES file...

> +         run.offset[3] = 3;

The fix works, but it's not optimal: to get 8.2-compatible behaviour, you
should set it to zero (same goes for block.offset[3] in the RGB mode case).
But 8.3's PutBlock handles RGBA images all by itself, so the right thing
would be to ifdef on TK_VERSION (etc), and skip the image scanning
code under 8.3 and later.

I'll look into this for 1.1.2.

Cheers /F