[cairo] Editing SVG content with Cairo

影月 零 kagetsuki at gmail.com
Fri Jan 3 20:01:34 PST 2014


I've already got rendering handled so that's not an issue. As an experiment
I actually did run through the XML and successfully manipulated the colors
of each object... but that's hardly a robust programatically "good"
approach if I want to do anything less trivial than change some colors. I'd
also like to do this just using some base SVG handling libraries as
installing Inkscape will not be an option with some of my deploy targets.

It seems you are saying Cairo can open an SVG as a surface, then draw on
top of it, but has absolutely no functionality to re-instantiate the
objects in the SVG DOM and make them available. If this is true then how
does it handle rendering of the vector objects of the SVG at all? I'm quite
confused here!


2014/1/4 Simon Sapin <simon.sapin at exyr.org>

> On 03/01/2014 19:02, 影月 零 wrote:
>> Is it possible to edit the content of an SVG image and then save the
>> result back? I don't mean just drawing on top of the image, I mean
>> manipulating objects/vectors within the image. I've been searching but
>> haven't found a good sample or explanation of how this would be done, if
>> it is possible.
> Hi,
> cairo itself does not read or otherwise render SVG files. (There are SVG
> renderers based on cairo, though.)
> You could use an XML parser and manipulate XML elements.
> Or look into making an Inkscape extension:
> http://wiki.inkscape.org/wiki/index.php/ScriptingHOWTO
> --
> Simon Sapin
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140104/1847113f/attachment.html>

More information about the cairo mailing list