[cairo] CAIRO_FORMAT_A1 image source color

sthustfo sthustfo at gmail.com
Thu Mar 27 23:01:36 PDT 2014


Hi all,

I am using cairopango library to render text on monochrome image on Ubuntu
13.10. Now before rendering text, I create a surface of type
CAIRO_FORMAT_A1, create a cairo context and set the source to solid white.
However, the color of the image remains black even though I have set the
color source to solid white. I want to render black color text on white
background.

surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 320, 280);
cr = cairo_create (surface);
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0);
cairo_paint (cr);

cairo_surface_write_to_png (surface, filename);

The saved PNG image always is black color. How do I achieve an image of
solid white color for a monochrome image (CAIRO_FORMAT_A1)? If suppose, the
surface is created using CAIRO_FORMAT_ARGB32, then everyrhing is fine.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140328/1ad1bb44/attachment.html>


More information about the cairo mailing list