[wxpython-users] Re: Converting a wx.Bitmap to a wx.Image and back; alpha channels; inconsistent behavior between platforms

Jukka Aho jukka.aho at iki.fi
Wed Apr 16 15:48:25 PDT 2008


Robin Dunn wrote:

> Jukka Aho wrote:
>
>> Converting a wx.Bitmap to a wx.Image, and back again - and repeating
>> this process - yields different results on different platforms when
>> alpha channels are involved. Here's a small sample program that
>> demonstrates the problem (screenshots below):
>>
>> <http://www.saunalahti.fi/znark/alpha_bitmaps/alpha_bitmaps.py>

> I can't get to your site because it is getting blocked by my web
> filter. Apparently somebody on your server was up to no good at some
> point and it's been added to a black list.

The site is run by one of the largest ISPs around these parts and 
contains the personal web pages of their customers, so anything's 
possible, I guess. (I've never heard anyone complaining about it being 
blacklisted, though, and it's strange that such filter would block the 
entire site instead of just the offending page or user.)

I have copied the files to another site in case you'd want to have a 
look:

 <http://ronsu.homeip.net/alpha_bitmaps/>

>> For some reason, this does not work on GTK. Something weird seems to
>> be going on with the colors and the transparency values (alpha
>> channel data):

> There is a known difference on GTK however in how the raw bitmap data
> is dealt with when an alpha channel is present.  (IIRC, it's not
> expecting the RGB data to be premultiplied by the alpha.)

That could certainly be related, although I'm having trouble getting my 
head around why it would manifest itself the exact way it does in the 
sample code. (As the loop advances, I'm basically writing new values for 
both the alpha channel and the RGB data in each iteration - but for some 
reason, that does not seem "reset" the bitmap the same way on GTK as it 
does on MSW.)

-- 
znark




More information about the wxpython-users mailing list