On Thu, Mar 5, 2009 at 10:31 AM, maht wrote: > I decided to try some draw(2) exploration and I'm not getting what I > expected from alpha blending. > > If I apply alpha to RGB24 images they change as expected but if I use RGBA32 > images and try to apply alpha it's going weird on me (or I am weird on it). > > If I apply setalpha(DRed, 0x7F) and then draw() it to screen instead of > being less red it goes blue! > > I've posted some sample code and the outputs at > http://maht0x0r.blogspot.com/2009/03/o-that-way-madness-lies.html I can't tell from your post which images you think are wrong. You have three images after the words "But when you apply alpha to RGBA32 images something unexpected happens:". The first one looks fine. The second one does not specify what your initial background is. It matters, because you are drawing a 1/2-translucent image and then a second one, so the result is 1/2-translucent in some places and 1/4-translucent in others. Whatever is underneath will shine through. Note the difference in the bottom right image in the white half vs the black half in the attached alpha.png. (View the PNG using something other than Plan 9, if necessary.) Andrey's bug feels like a variation on that theme, but I cannot pin it down just now. Russ