[cairo] Convert SVG to cairo C code

Maarten Bosmans mkbosmans at gmail.com
Mon Sep 13 13:41:08 PDT 2010

2010/9/11 Andreas Krinke <andreas.krinke at gmx.de>:
> Hello list,
> Congratulations on the new release!
> I would like to convert a SVG file to the aquivalent cairo C code to
> recreate the image later on.

That would indeed be a handy utility to have.

> I plan to use librsvg to do the SVG decoding. But I'm not sure what to
> do next:
> 1. Use the brand new script, xml or recording backend and convert the
>   result manually, or
> 2. Hack librsvg to output the cairo commands it's using, e.g., by
>   providing a library proxying cairo, or
> 3. Use some system level trace tool (ltrace?) to collect the calls
> Any ideas on other methods? Which of the mentioned methods would
> probably be the easiest one?

What about using the cairo tracing library to get a trace and then
convert the trace to compilable c code with a script, for example in

> For reference: There once was a discussion about a c source backend:
> http://lists.freedesktop.org/archives/cairo/2006-September/007891.html
> Regards,
> Andreas


More information about the cairo mailing list