[cairo] Saving a surface to a file

yinglcs2 at yahoo.com yinglcs2 at yahoo.com
Tue Dec 12 17:37:06 PST 2006

Thanks for your help.

The code works fine when I was using cairo 1.0.2. So i don't think I am missing any cairo_paint or cairo_fill method.  But as soon as i upgrade to cairo 1.2.6,  my output image only has 276 bytes (instead of 41k bytes).

Does anyone know if i need to do things different when i upgrade to cairo 1.2.6?

Thank you.

----- Original Message ----
From: Daniel Amelang <daniel.amelang at gmail.com>
To: "yinglcs2 at yahoo.com" <yinglcs2 at yahoo.com>
Cc: cairo at cairographics.org
Sent: Tuesday, December 12, 2006 5:11:26 PM
Subject: Re: [cairo] Saving a surface to a file

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?


Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.

More information about the cairo mailing list