[cairo] Cairo usage - multiple formats + SVG

Matt Rice ratmice at gmail.com
Tue May 20 03:21:37 PDT 2008

On Tue, May 20, 2008 at 12:00 AM, Stephan Siemen
<Stephan.Siemen at ecmwf.int> wrote:
> Hallo,

Hi, I can't answer all the questions but i'll try and answer this one

> - Currently we run our "CairoDriver" for each format requested
>  separately. Would it be possible to use one surface description
>  to generate multiple outputs? We have users who would like to
>  generate PDF and PNG at the same time. This would mean a big
>  improvement for us.

this is definitely possible for xyz surface format and PNG,

in my patch i posted a bit ago i have a test program which does this
with svg + png, see the large-surface.c attachment of the following


you'll want to look at the 'PNG Support' section of the reference
manual as opposed to the 'Image Surface' section in there you can
generate a png from any surface.

cairo_surface_write_to_png should be easier to use than the function i
used in my example..

I believe that covers the current state.

i am not sure if it is possible for y surface format and z surface format.
e.g. Postscript and PDF, in theory it may be possible to convert
between different surface types (at least for some types of surfaces),
but I don't believe there is any API in place either public or
internal which would do this,

there was some discussion of making public the internal
cairo_meta_surface (at some point in time, i didn't see it on the
roadmap or todo), i'm wondering if it wouldn't also be possible at
that time to add a function to create a postscript/pdf/svg etc surface
from a meta surface.
(png would already be possible using the existing png support)

or maybe the goal of opening that up for public consumption is so that
e.g. in my example I wouldn't have to generate svg just because i want
it stored internally in a vector format.

More information about the cairo mailing list