[cairo] Does cairo respect the alpha component of a color ?
rkumar at novell.com
Tue Sep 14 00:01:26 PDT 2004
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.
On Mon, 2004-09-13 at 23:04, Carl Worth wrote:
> That's definitely not intended behavior. What use of alpha are you
> referring to? Alpha values that are passed directly to a function call
> such as cairo_set_alpha are definitely floating-point values in the
> range [0..1] with 1.0 being totally opaque.
> We have lots of examples showing this working, such as:
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
> If you weren't providing pre-multiplied color values in your image data,
> then that would probably cause a result like what you described.
This points looks like the reason for my problem. But, does that mean
Cairo supports only 24bpp RGB format ? Should it not take care of
alpha when I use image data in 32bpp RGBA format and use the proper
cairo_format_t value too for creating the surface ?
> Let us know if that doesn't cover it.
I think your answer covered it.
More information about the cairo