Rendering an SVG to an SDL surface?

I’m planning on a new project which would benefit from the ability to
load SVG (Scaled Vector Graphics) images.

I’ve dug around Google a little, and the only information I can find
with regards to rendering an SVG within an SDL application was some
frustrated searching by a poor chap named Terry Hancock, about 2 years ago!

I came across “rsvg”, as did he, which is an SVG renderer for Gnome.
Unfortunately, that means it requires GTK+ and GDK libraries, which will
kill the cross-platform aspect of my project, I think… It will also add
bloat.

And from what I’ve seen of RSVG (at least the Debian packages for
librsvg-1 and librsvg-2), it’s a SERIOUS pain in the ass to use.
(There even seem to be some major dependency issues in the Debian Stable
packages! Like the fact that it doesn’t bother mentioning that librsgv-dev
requires libgdk-pixbuf. The “librsvg-config” tool seems to ignore the
fact that I’d be needing some CFLAGS, too. sigh)

Anyway, does anyone have any suggestions?

Thanks!–
bill at newbreedsoftware.com Hire me!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/bill/resume/

Bill Kendrick wrote:

I’m planning on a new project which would benefit from the ability to
load SVG (Scaled Vector Graphics) images.

I’m really interested in you project!
One month ago I posted about the same question to this list.
If you want (and if I can :), I will try to help you in development.

Enzo.

Unfortunately, that means it requires GTK+ and GDK libraries, which will
kill the cross-platform aspect of my project, I think…

How so? I’ve built a Windoze executable using Gtk+ on my Linux machine that
runs just fine on Windoze. Don’t know about Mac OS or others.

It will also add bloat.

That may be so :wink:

Simple makefile:On Friday 21 March 2003 02:55 am, Bill wrote:

CFLAGS=-Wall -O2 -fomit-frame-pointer gtk-config --cflags

LIBS=-lm gtk-config --libs
OBJS=test.o
CC=gcc

WINCFLAGS=-Wall -O2 -fomit-frame-pointer -I/usr/local/cross-tools/include
gtk-config --cflags
WINLIBS=win32/lib/libgtk-0.dll win32/lib/libglib-2.0-0.dll
WINOBJS=test.obj
WINCC=/usr/local/cross-tools/bin/i386-mingw32msvc-gcc -Wl,-s

.PHONY: test

test: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o test $(LIBS)
strip test

test.o: test.c
$(CC) $(CFLAGS) -c $< -o $@

clean:
rm *.o
rm test

win: test.exe

test.exe: $(WINOBJS)
$(WINCC) $(WINCFLAGS) $(WINOBJS) $(WINLIBS) -o test.exe

test.obj: test.c
$(WINCC) $(WINCFLAGS) -c $< -o $@

winclean:
rm *.obj
rm test.exe

Bill Kendrick wrote:

I’m planning on a new project which would benefit from the ability to
load SVG (Scaled Vector Graphics) images.

I’m really interested in you project!

Hehe - I didn’t even mention what the project was. :^)

I’m considering doing another kids program (like Tux Paint), except
this one would be for creating posters, birthday cards and banners.
(Think “Print Shop” on the old Apple II.)

Like Tux Paint (and Print Shop), it would need to have a set of clipart.
However, since in some cases you’d be printing a graphic as large as a sheet
of paper, I think it makes sense to use something like SVG, rather than PNG.

Unfortunately, I’m coming up pretty dry. :^(

One month ago I posted about the same question to this list.
If you want (and if I can :), I will try to help you in development.

I’m looking at libsvg and libxsvg, which are part of the xsvg project:
http://www.xsvg.org/

-bill!On Fri, Mar 21, 2003 at 02:02:58PM +0100, Enzo wrote:


bill at newbreedsoftware.com Hire me!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/bill/resume/

Unfortunately, that means it requires GTK+ and GDK libraries, which will
kill the cross-platform aspect of my project, I think…

How so? I’ve built a Windoze executable using Gtk+ on my Linux machine that
runs just fine on Windoze. Don’t know about Mac OS or others.

There’s the problem. :^) I want to make sure it’ll run on Linux, BSD,
Windows, MacOS, Mac OS X, and even BeOS.

It will also add bloat.

That may be so :wink:

Definitely so! All I’d need to do is render an SVG into a surface.
I have no need for anything else in GTK+ (widgets, etc.) :^(

Why on earth hasn’t someone created a plain SVG lib that isn’t tied
to Xlib, GTK+ or KDE?

Then Xlib, GTK+/GNOME and KDE could all benefit from one single library
(like, I assume, people do with stuff like libPNG and libJPEG).

I’ve only skimmed, but I think this guy has similar thoughts:

http://www.inrialpes.fr/sharp/people/bellot/others_pages/my_SVG_viewpoint/

-bill!On Fri, Mar 21, 2003 at 06:52:28AM -0800, j_post wrote:

On Friday 21 March 2003 02:55 am, Bill wrote:


bill at newbreedsoftware.com Hire me!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/bill/resume/

Bill Kendrick wrote:

Hehe - I didn’t even mention what the project was. :^)

No, I meant I’m interested in developing a library for
SVG support in SDL, not any’ else.

I’m considering doing another kids program (like Tux Paint), except
this one would be for creating posters, birthday cards and banners.
(Think “Print Shop” on the old Apple II.)

I like it, but I can’t help you in this (for lack of time :frowning: ).
I can mix work and SVG project, 'cause I can need it for work
(I’m a edu-game developer).

Enzo.

> > I'm considering doing another kids program (like Tux Paint), except > > this one would be for creating posters, birthday cards and banners. > > (Think "Print Shop" on the old Apple II.) > > I like it, but I can't help you in this (for lack of time :-( ). > I can mix work and SVG project, 'cause I can need it for work > (I'm a edu-game developer).

Cool! :^) I’m a wanna-be-edu-game-developer. (I just decided to tell my
TiVo to record Sesame Street and some other kids’ shows. ;^) )

I’ve begun work on Tux Print, but I should be able to get fairly far
without SVG support, since it’s not absolutely necessary for the
program. It’s just something I think would be VERY useful.

I’m going to look into ‘xsvg’ to see if it can be made portable and target
SDL surfaces, rather than X-Window. In the meantime, though, I’m looking
for a new job, and working on the rest of Tux Print. :^)On Mon, Mar 24, 2003 at 10:20:37AM +0100, Enzo wrote:


bill at newbreedsoftware.com Hire me!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/bill/resume/