[wxMSW-2.8.7] PNG with alpha and Windows2000

Stefan.Neis at t-online.de Stefan.Neis at t-online.de
Fri Feb 15 02:42:01 PST 2008


        Hi,

I'm having trouble with a PNG with alpha channel in wxMSW-2.8.7.
In imagpng.cpp, CopyDataFromPNG correctly determines that it
should use the Transparency_Alpha case, which works nicely on
Windows XP and newer, as well as on wxGTK(2) and wxMac,
however on Windows 2000,  the alpha channel seems to be
completely ignored when creating the wxBitmap that's actually
displayed- which is especially bad  since the transparent 
pixels are coded as foreground colour(black) with an alpha
value that's 0 (or at least almost 0 when next to non-transparent
pixels),  so the result is essentially a picture that's black on black.

Is that an aberration of my particular computer (e.g. bad video
driver) or possibly the particular PNG, or is it a general problem
(i.e. wxBitmap can't handle alpha channel on windows 2000).

In the latter case, wouldn't it be preferable to compute an
image with mask from the image with alpha prior to converting
the image to a wxBitmap?
If  I understand things correctly, that would require to just add
something like 
  if (Windows 2000 or older)
       image->ConvertAlphaToMask(suitable threshold, maybe 0x40?)
to wxBitmap::CreateFromImage, wouldn't it?

Of course you can say that it's easy to take care of this outside
of wx (and if you're unsatisfied by the result of the default
conversion,
you likely will anyway), i.e. in the application, but not having to
worry
about all the subtle platform differences is one of the reasons why
we all use wxWidgets, isn't it?

        Regards,
                   Stefan











More information about the wx-dev mailing list