[cairo] editing a loaded SVG file

Carl Worth cworth at cworth.org
Thu Jan 11 14:17:32 PST 2007


On Thu, 11 Jan 2007 13:45:41 -0800 (PST), Simon Flannery wrote:
> Sorry, a web application is not an option (it was considered a while
> ago). We need windows infrastructure like menus and multi-doc models
> etc with network support. Is there really no *easy* way to access
> the vertices's of an SVG using cario?

It's not really a question that has anything to do with cairo.

Cairo never sees any SVG per se, (it does seem some path coordinate,
but it can't tell if it came from SVG or from anything else). Cairo
definitely doesn't ever seen any XML data.

So the feature you're missing is that there isn't a standalone
SVG-parsing library that provides for exploring or modifying the tree
of data.

As others have mentioned in this thread, it would be nice if librsvg
had an interface like that, (and it should probably just style itself
after the DOM interfaces that already exist in the SVG specification,
to allow librsvg to easily grow animation support, etc.).

And as others have mentioned, there are projects, (inkscape and
mozilla/gecko), that have all the functionality you need, but sadly do
not provide it as re-usable library.

I agree that such a thing would be quite useful. And it really
shouldn't be that hard to do. I don't recall what the librsvg data
structures look like, but I think they're a fairly straightforward
representation of the SVG structure. So it shouldn't be that hard to
add some interfaces to do what you want with them.

> I did think of loading our SVG
> twice; Once for rendering via RSVG into cario and a second time
> loaded with xmllib2 to get access to all the nodes etc...

You could certainly do that. But it wouldn't allow you to do a lot of
the things you probably want to do, (such as selectively rendering
subsets of the SVG, or alter some properties and then re-render,
etc.).

> But I am looking for the simplest option.

It looks like some code is needed to fill the gap here. Want to help
out?

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070111/df7cbe40/attachment.pgp


More information about the cairo mailing list