[cairo] Converting SVG images to PNG

Carl Worth cworth at cworth.org
Mon Sep 8 13:57:19 PDT 2008


On Wed, 2008-08-27 at 23:56 +0100, Freddie Witherden wrote:
> > I'd rather not use it.  So, is there still some way to
> > use Cairo to accomplish these goals?

One option is to trim down librsvg to eliminate any dependencies you
don't want, (putting higher-level interfaces that force the dependencies
into separate, higher-level libraries, or by making parts of the code
configurable to not require the dependency).

Note that in spite of the state of the website, librsvg is
well-maintained.

> I am/was in a similar position to yourself (interested in adding SVG  
> support to Cairo for a game, wishing to avoid rsvg if at all  
> possible). After looking around the only 'alternative' so to speak is  
> libsvg + libsvg-cairo, which although scores well in the dependency  
> department does appear to be un-maintained.
> 
> Despite this, it does work reasonably well for simple SVGs, however,  
> it does not fare well for more complex ones. Depending on the  
> complexity of your SVGs it may be sufficient.

The history here is that when I wanted to render some SVG files with
cairo, (for easy test cases), I split up librsvg to avoid some
dependencies, and converted the backend to use cairo. That's where
libsvg and libsvg-cairo came from.

Much later, librsvg picked up its own cairo support, (and didn't happen
to use my code). Also, since libsvg forked off from librsvg, the librsvg
code picked up a *lot* of support for more of the SVG specification.

So another "dependency reducing" pass over librsvg might be useful now.
(And it would be much more useful if it actually made it into upstream
librsvg this time.)

For example, all the stuff rendering to a GdkPixbuf could be a
higher-level interface, (librsvg.so, say), and the cairo-based stuff
could be a lower-leve library, (librsvg-core.so, say), without having to
depend on GdkPixbuf.

Other GNOME dependencies, (like using GNOME-vfs to pull in
externally-linked content, or whatever), might be better handled by way
of configure options to allow compiling without some features.

I hope that helps,

-Carl




More information about the cairo mailing list