[SDL] SDL + SVG Vectors

Bill Kendrick nbs at sonic.net
Tue Feb 26 17:13:32 PST 2008

On Tue, Feb 26, 2008 at 10:43:51PM +0000, neil at cloudsprinter.com wrote:
> > Tux Paint uses libRSVG (or can also use libSVG and Cairo).
> > http://www.tuxpaint.org/download/source/
> >
> you use this to create a pixel dump you put in to a surface?

Correct.  If you've never used Tux Paint, it has a 'Stamps' tool.
Most of the stamps are PNGs, but recently we've been adding SVG ones.

> sorry i should read the source and stuff
> whatever it is i use it needs to be easily cross compatible ( might be able to
> nudge people to make it work for me ), and preferably pretty much easy linked
> to SDL ( lazy me )

The SVG support is available in Tux Paint on modern Windows systems
(XP, 2000, Vista).  I think the older (non-libRSVG stuff) works on older
Windows (95, 98, ME).

The SVG support is available on Mac OS X.  And, of course, Linux.

The bits of code in Tux Paint that you want are within tuxpaint.c,
in "load_svg()" and "myIMG_load()".  (If SVG support is completely off,
I simply "#define myIMG_load IMG_Load" (SDL_Image's function).  If SVG support
is on, it wraps around IMG_load for PNGs, and my own SVG loading stuff,
for SVGs.)

Note: There are two "load_svg()"s in Tux Paint.  One is used when
"OLD_SVG" is #defined (that's the libSVG and libCairo stuff).
The other is used with the better, more modern, heftier libraries (libRSVG
and friends).

The modern load_svg() is about 180 lines of C code, including blank lines,
some debug printouts, and comments.  :)

bill at newbreedsoftware.com

More information about the SDL mailing list