Various problems with using a recording surface
Alexis Lamiable <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <1312193041.2317.13.camel@caribou> |
Hello, I'm having some problems with using recording surfaces. I'm unsure whether they are problems with the documentation, with the code, or with the user :) I used to simply draw on PNG or SVG surfaces, depending on what I needed, but now I'm writing a library, and I'm trying to write clean generic code. I want to draw small charts on recording surfaces, and then redraw those surfaces on actual surfaces according to some layout. First of all, the documentation says that I can pass NULL for the extents parameter of cairo_recording_surface_create, in order to get an unbounded recording surface. However, when I did that, I got no output on my PNG surface. Here are excerpts from my code: recording = cairo_recording_surface_create(CAIRO_CONTENT_COLOR_ALPHA, NULL); ... png = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); cr = cairo_create(png); cairo_set_source_surface(cr, recording, x, y); cairo_paint(cr); cairo_surface_write_to_png(cr, filename); Replacing NULL by a (0, 0, width, height) rectangle makes it work, but the documentation suggests that it's not necessary. Secondy, I'm trying to do the same operations on SVG and PDF surfaces, but this time I don't get anything displayable, with or without boundaries. The only difference in my code is that I create another type of surface, and then don't write_to_png. Am I doing something wrong? If it's not me, I'll try to do a proper bug report with full code. (All the objects are properly destroyed in the end, so it shouldn't be due to a lack of flush/finish/destroy) Thanks in advance for your help, A. L. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo