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

From: Stephan Houben (stephanh at planet.nl)
Date: Sat Apr 23 16:54:47 EDT 2011

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.