Skip to content

Commit

Permalink
updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
akrinke committed Oct 31, 2010
1 parent 6c0b179 commit 465fa50
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# SVG to Cairo code converter

This project converts SVG files to the equivalent Cairo source code. After this conversion, you don't need any SVG rendering library to display the content of the file. [Cairo](http://cairographics.org) and the generated source code is everything you need.

## Why?

With [librsvg](http://librsvg.sourceforge.net/), there exists an open-source library that can render SVGs using Cairo. However, this library has some bulky dependencies, e.g., GLib. This complicates the distribution of programs using this library.

## How?

### SVG to Cairo XML converter

The first step is to convert the SVG into an XML file describing the Cairo drawing commands. This is implemented in `svg2cairoxml.c` using librsvg and the XML surface that was introduced in Cairo 1.10. Rendering to an XML surface is not enabled by default. Therefore, `--enable-xml=yes` has to be passed to `configure` when compiling Cairo.

After the successful compilation of `svg2cairoxml`, you can convert SVG files to Cairo XML files:

$ ./svg2cairoxml svg-file xml-file

### Cairo XML to Cairo code converter

Now, we can convert the generated XML file to source code. This is done using a Lua script that parses and processes the XML file:

$ lua cairoxml2cairo.lua xml-file source-file

(not yet in repository)

## License

This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).
© 2010 Andreas Krinke <[email protected]>.

0 comments on commit 465fa50

Please sign in to comment.