[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] SVG and SDL/pygame with pycairo?



On Tuesday 26 July 2005 03:17 pm, Shandy Brown wrote:
> > I know that 'libsvg-cairo' is supposed to have an SDL
> > back-end renderer and 'pycairo' is the python binding for
> > Cairo.  It should certainly be possible in C, but I was
> > hoping you could just do it in Python, and wondered
> > if somebody knows for sure (and how to do it).
> >
> > Am I at least on the right track if I want to render SVG
> > "cels" to SDL surfaces for animation?
>
> If you find out a conclusive answer please let me (and the list) know.
> The ability to do this would be ideal for one of my projects.

Update on my quest ...

It appears that "pycairo" may be a bit of a red herring. Cairo is
a general-purpose vector graphics engine, and rendering SVG
with the libsvg-cairo package is only one small piece of functionality.
Pycairo is more like a drawing library for Python.

There is an example in the Cairo CVS of rendering an SVG file
directly to an SDL surface. 

http://cvs.cairographics.org/cairo-demo/sdl/

I think the easiest way to make this work is to write a  Pyrex module
around that demo.  Then I need to know how to wrap the resulting
*SDL* surface  in a *PyGame* surface (which is presumeably not
hard, but I'll need to look at the PyGame sources to figure it out ---
probably have to call a PyGame extension module from Pyrex?)

I don't presently know how to do that, but I just downloaded the
PyGame sources to look.

Assuming that I do this, is this something desireable enough that
people would like to see it incorporated into PyGame? It's probably
a bit small to distribute on its own (hopefully it's <100 loc), and if
I just incorporate it into my application, it won't be as easy to reuse.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com