[racket] bitmap get-argb-pixels returns un-premultiplied alpha?

From: Stephan Houben (stephanh at planet.nl)
Date: Thu May 19 15:27:26 EDT 2011

Wow! Thanks!
That is really fast!



On 05/19/2011 01:04 AM, Matthew Flatt wrote:
> I've added an argument to `get-argb-pixels' and `set-argb-pixels' to
> make them work in premultiplied mode.
> At Sat, 23 Apr 2011 22:54:47 +0200, Stephan Houben wrote:
>> Hi list,
>> Today I noticed that the bitmap's get-argb-pixels method returns
>> un-premultiplied alpha, even though it internally uses Cairo
>> which uses pre-multiplied alpha.
>> Looking at the code, it goes out of its way to convert
>> pre-multipled alpha to un-premultiplied alpha.
>> I then need to go out of my way again to convert it back to
>> premultiplied alpha. Which is inefficient and silly.
>> Could we have a method to get at the premultiplied alpha directly?
>> The Cairo folks chose it for a reason; if you want to interpolate between
>> two pixel values then only premultiplied alpha will give the correct result.
>> (See http://www.gimp.org/docs/plug-in/appendix-alpha.html for some discussion
>> on this).
>> I would therefore assume that it might be of wider interest than just me.
>> Thanks,
>> Stephan

Posted on the users mailing list.