Re: Editing SVG content with Cairo
"Bryce W. Harrington" <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jan 03, 2014 at 07:26:03PM +0000, Simon Sapin wrote: > 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. For modest SVG programmatic editing, this works pretty well. > Or look into making an Inkscape extension: > http://wiki.inkscape.org/wiki/index.php/ScriptingHOWTO Inkscape extensions are okay for interactive editing of SVG using Inkscape's internal scene graph of the parsed SVG. Inkscape also has a rudimentary scripting interface, for non-interactive editing of SVG. See `man inkscape`, in particular the --verb, --select, and --shell options are worth looking at. Unfortunately Inkscape's internal scene graph is integrated, not a standalone reusable library. Would be nifty if it were, for cases like these... Bryce -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo