[cairo] Trouble with pixmaps

Richard Billington billingt at AI.SRI.COM
Mon Jan 25 19:33:02 PST 2016

I'm trying to upgrade a GUI constructor backend targeting X-windows. It 
didn't make use of antialiasing, and I'm
trying to rectify that. I've gotten it to render text and graphics using 
antialiasing, in particular
the graphics calls are all done through cairo calls.

When the target of my rendering is an x-window window, everything works 
fine. However, when the target
is an x-pixmap, the pixmap is apparently not effected. I say 
"apparently" because if I try to output the pixmap
to a file (using cairo_surface_write_to_png) the pixmap is apparently 
garbage. If I do the same thing, but make
the source a window, I get a png that matches the window output.

For both the window and the pixmap, I create a surface using 
cairo_xlib_surface_create_with_xrender_format, whose
documentation for the arguments includes "drawable   an X Drawable, (a 
Pixmap or a Window)".

When I first allocate the pixmap, I've tried clearing the pixmap (which 
I don't seem to need to do for a window),
by making the new pixmap the target of a new cairo_t, and calling 
cairo_set_operator with it and cairo_operator_clear
followed by a call to cairo_fill.

I've also tried setting the cairo operator to cairo_operator_source 
instead of the default.

None of this seems to have any effect on my being able to detectably 
render to a pixmap.

Suggestions? Many thanks ...

More information about the cairo mailing list