[cairo] Confused by render to image buffer

Chris fltk at functionalfuture.com
Fri Dec 24 11:30:09 PST 2004

I'm rendering to an image buffer by way of the svg-cairo stuff:
cairo_set_target_image(rend, buffer, CAIRO_FORMAT_ARGB32, width, height,
svg_cairo_render(ctx, rend);

This seems to mostly work if I set the target to a PNG image but when
the target is just a memory buffer then the results don't appear to be
anything like the image.

For example, I tried rendering a plain black square with alpha 254 that
fills the entire image area.  Image size comes out at 90x90 pixels.  The
result in the image buffer is something like:

00 00 00 FE 00 00 00 FE 00 00 00 FE 00 00 00 FE 00 00 00 FE

Which appears to be correct but it stops after about 16 RGBA values.
Then I get some 00 00 00 FF values for about 2000 more pixels. Finally,
then from there to the end (some 6000 pixels) are all null values.

What happened to the rest of the image?

// Chris

More information about the cairo mailing list