Ragnar Ouchterlony wrote:
Robin Dunn wrote:
In 2.4 the alpha channel was converted to a mask for all pixels with an
opacity level greater than some tolerance value. In 2.5 the alpha is
preserved as an alpha instead of being converted to a mask. (And on MSW
and Mac DrawBitmap and Blit are able to to the right thing with the
alpha transparency.)When I tested this on windows (I used wxPython 2.5.1.5 on windows 2000) it
did not work as expected. The PNG images got ugly black (or sometimes
white) background everywhere where it should be completely or partly
transparent.
Does the ImageAlpha sample in the demo work for you?
I seem to recall that there was some talk about possibly some sub-types of PNG not working correctly, but I don't remember the outcome...
The PNG image handler will now only generate a
mask if all the alpha values in the image are either fully opaque or
fully transparent. So if you need the mask you can do one of the following:* Edit the image and make all the partially transparent pixels be fully
transparent.* Use a different image type.
* Set a mask based on colour after you load the image.
The first two options is no alternative for me. How do I use the third
option to emulate the behaviour of 2.4?
mask = wx.MaskColour(bmp, colour)
bmp.SetMask(mask)
ยทยทยท
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!