[cairo] Saving a surface to a file

Daniel Amelang daniel.amelang at gmail.com
Tue Dec 12 15:11:26 PST 2006

On 12/12/06, yinglcs2 at yahoo.com <yinglcs2 at yahoo.com> wrote:
> Hi,
> I have the following code which save a cairo surface to a png file.
> I have run it under cairo 1.0.2 and it works.
> However, as soon as I upgrade my library to cairo 1.2.6. No image is save. the output png is merely 206 bytes. Can any one tell me what do I need to do to following code in order to make it work under cairo 1.2.6?
>  char filename[20];
>     GetOutputFileName(filename);
>     cairo_surface_write_to_png(new_surface, filename);
>     cairo_destroy (cr2);

I would need to see more code than that to help you. Also, what
platform are you on? Perhaps you missed a cairo_paint or cairo_fill
before you write the surface to the png?


More information about the cairo mailing list