-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]>. | ||
|