[cairo] transparency with alpha channel RGBA

uray meiviar uraymeiviar at yahoo.com
Tue Oct 27 04:27:16 PDT 2009


Hello,

few question, i'am trying to build openGL application which most of the textures are generated by Cairo, I create cairo surface using cairo_image_surface_create_for_data() with CAIRO_FORMAT_ARGB32 format and fetch the data to the GPU texture, but my problem is, on these codes:

cairo_set_source_rgba (this->canvas, 1.0, 1.0, 1.0, 0.5);
cairo_set_operator (this->canvas, CAIRO_OPERATOR_SOURCE);
cairo_paint (this->canvas);

I got grayed texture instead of white texture with half transparency, on the cairo surface data I got 0x808080808080...
instead of 0xFFFFFF80FFFFFF80FF.... it seems that the white color (1.0,1.0,1.0) are premultiplied by its alpha channel value of (0.5) resulting to (0.5,0.5,0.5,0.5 = 0x80808080...).

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

thank you.


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20091027/94666c33/attachment-0001.htm 


More information about the cairo mailing list