[cairo] SVG Spacewar

Nigel Tao nigel.tao at myrealbox.com
Fri Apr 1 00:02:13 PST 2005

On Thu, 2005-03-31 at 16:40 +0200, Øyvind Kolås wrote:
> On Thu, 31 Mar 2005 23:05:35 +1000, Nigel Tao <nigel.tao at myrealbox.com> wrote:
> > Hello all.  I've been playing around with Cairo lately, and have made a
> > little re-make of the classic Spacewar game, but with SVG-like graphics.
> It would be nice to replace it with actual SVG themes for the
> spaceships, to make the name match better ;)

There is a cairo snippet that loads a static SVG file, but I was
thinking... the red ship and the blue ship are pretty much identical,
but for different colors.  Do you know if the SVG spec (or something
else?) allows for "parameterized" SVG, so that I can say something like
"load the ship.svg file with parameters (primary_color = #FF66CC,
active_layers = [ship, shields, exhaust], frame = 2)"?

I suppose that one possibility is to have a "master template" .svg file
and then use something like m4 or python to generate instances
(also .svg files) of the template.  But that doesn't seem to allow
"dynamic" instantiation, say if I wanted to "skin" my ship through the
game UI, not through running a python script.

Thoughts, anyone?

> will change which backend GtkCairo tries to initiate first.
> (from http://cvs.cairographics.org/gtkcairo/README?view=auto)

[smacks forehead] Of course, RTFM!  :)


More information about the cairo mailing list