[cairo] ANN: svg2cairo v0.1 -- Convert SVG graphics to cairo source code

Andreas Krinke andreas.krinke at gmx.de
Wed Dec 29 05:39:58 PST 2010

Svg2cairo converts SVG files to the equivalent cairo source code.


Currently, librsvg is necessary to render SVGs with cairo. With
svg2cairo, SVGs can be converted to source code, that renders the given
SVG file without using librsvg. This only works for SVGs that are known
at compile time.

The first step is to convert the SVG to an XML file describing the cairo
drawing commands. This is implemented using librsvg and cairo's XML
surface that was introduced in cairo 1.10.

Then, the generated XML file can be converted to source code. This is
done using a Lua script that parses and processes the XML file.

Currently, svg2cairo can generate C source code, Lua code for use with
the oocairo binding, and Lua code for Scrupp [1]. The addition of new
formats is straightforward.

Windows binaries are available for download at GitHub:

Linux users need to custom compile cairo with XML surface support, that
is not enabled by default.

[1] http://scrupp.sourceforge.net

More information about the cairo mailing list