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

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sat Apr 30 14:31:34 EDT 2011

I think the best thing to do is just submit a patch that breaks that
function into two methods, with one adding the un-pre-multiplication.
I looked into doing it, but I'm not very close to a test case, so I'd
be afraid I wouldn't know if it was right.


2011/4/23 Stephan Houben <stephanh at planet.nl>:
> 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
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.