[cairo] Does cairo respect the alpha component of a color ?

Øyvind Kolås islewind at gmail.com
Tue Sep 14 01:08:23 PDT 2004


On Tue, 14 Sep 2004 12:31:26 +0530, Ravindra <rkumar at novell.com> wrote:
> Thanks for the answer, Carl.
> I think there is something wrong with my code. I have problems in both
> ways, I mean in creating a surface out of image data as well as saving a
> surface to an image file. Probably, I'm not doing it right.
> 
> When I save the image data buffer to a file and open it with an
> image viewer program, I don't see the proper alpha effect in the
> image. So I have a question, how do I save the pixel data of an
> image created by Cairo ? I'm asking from alpha component point
> of view. FYI, for example, I use libpng to save the image in png
> format.

http://cvs.cairographics.org/cairo/cairo-demo/cairo_snippets/png_io.c?rev=1.2&view=auto

contains code to do what you want, including the conversion to from
premultiplied
alpha to component alpha.

/pippin



More information about the cairo mailing list