[cairo] svg and cairo for GUI experiment

Daniel Amelang daniel.amelang at gmail.com
Tue Apr 17 14:02:32 PDT 2007


On 4/17/07, Daniel Brandt <dbr at mindglow.se> wrote:
> Hi!
>
> I am experimenting with scalable in-game GUIs for video games. Right
> now I'm trying out cairo and currently I'm looking into loading
> svg-files and manipulating them to create UI widgets like buttons and
> menues. A simple example use case I'd like to realize is loading an
> svg that would work as a basic button, then, using cairo, I'd like to
> add a caption to the button, maybe even transform it,  and finally
> draw it to a cairo surface.
>
> To do this I need to convert svg-data to cairo drawing calls which I'd
> need to be able to store and call in batch repeatedly.
>
> It suppose that is a bit like what is happening in libsvg-cairo, so I
> figured I'd ask here if this idea makes sense at all and if you have
> any comment on how I'd go about starting to code this part of my
> experiment, maybe using libsvg-cairo.
>
> Also, if this doesn't make sense or I've misunderstood something
> fundamentally, please feel free to correct me.

This should be pretty easy to do using rsvg. You'll find several
examples of how to use rsvg to render an SVG onto a cairo surface. You
can then render whatever you want on top of that same surface, and
then composite that surface onto other surfaces etc.

Now if you want to dynamically alter the content of the SVG itself,
that's another story, and it doesn't have a happy ending.

Dan


More information about the cairo mailing list