W dniu 22 listopada 2010 11:28 użytkownik Jasper van de Gronde <th.v.d.gronde@...528...> napisał:

As for the computation in the Cairo branch (in struct MaskLuminanceToAlpha), it basically multiplies the coefficients by 255 and does the computation in integers. In principle not a bad way to do it, except that the rounded coefficients don't add up to 1. I would recommend adding one to the green component (so use 183 instead of 182), as its fractional part is closest to one (0.427, vs. 0.1875 and 0.3855). Also, since it's using 32 bit ints anyway a bit more precision could easily be used.

I didn't notice the coefficients didn't add up to 255, thanks for spotting this. I changed them to add up to 512, so the divide can be done with two bitwise operations. I'll commit this change once I finally succeed doing the trunk merge :)

Regards, Krzysztof