[cairo] transparency with alpha channel RGBA

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Wed Oct 28 14:00:01 PDT 2009


Hi,

On Tue, 27 Oct 2009, uray meiviar wrote:

> how do I get, non-premultiplied color so my openGL texture will have 
> correct alpha channel values?

I believe you can use premultiplied textures with OpenGL by 
configuring the right blend function.  For the cases where using 
unpremultiplied data is unavoidable you'll need to convert the 
premultiplied data yourself before uploading the textures.  Various 
implementations of unpremultipliers are available here:

http://cgit.freedesktop.org/~joonas/unpremultiply/tree/

Generally the overhead from unpremultiplication is fairly low as long 
as you don't implement it using three divisions per pixel.

Cheers,

Joonas


More information about the cairo mailing list