Yotta Meter schrieb:

>The example I'm looking for in regards to ruby/SVG differs from the
>previous questions. I have an SVG document generated from Adobe
>Illustrator, and I'd like to not only display the SVG document using
>ruby, I'd like to modify it within the ruby program and re-display the
>image.
>
>As an example, say I have two nodes connected with and edge, node0,
>node1, and theEdge. In Illustrator I draw the two nodes and edge with
>the color black. I write out the file to file.svg
>
>I'm able to to open the file in a web browser and view the image
>correctly.
>
>For ruby, I'd like to be able to use Tk to show the image on a canvas.
>Once an event is processed, I'd like to change the color of node0 to red
>from black, with node1 and theEdge staying black. I'm assuming I could
>use REXML to change the property of node0. My hope is then to re-display
>the SVG image, replacing the original.
>
>Ideally I'd like to be able to detect mouse over events on individual
>elements of the SVG document.
>
>I'm going to start attempting to do this - if I am going down a rathole,
>I'd appreciate feedback!
>
>Thanks in advance.
>  
>

Jeszra
http://jeszra.sourceforge.net/

can import and export from and to SVG & Tk.
A DOM-tree is being used for importing SVG in Tk.
The approach is however somewhat different from
your description --I assume you do want to tightly couple
SVG and Tk?

Jeszra always generates code, which in turn generates the
graphics--allowing code-reviews on both sides.

SVG is saturated with features, only a subset of
which can be mapped 1:1 in Tk, and forget the Tk canvas.

Jeszra's code generation targets tkpath 0.2 or 0.3 when importing SVG,
and exports from tk canvas, tkpath, tkzinc, text ...

There is some perl-code, on cpan, available to import SVG
into tkzinc... the project is abondend and incomplete.
There is another SVG export project, from Tk canvas,
written in python (search the tkinter wiki).


Technically not yet feasible:
clippath, textpath, mpath, marker, tref,
filters, pattern, user model for radial gradients.
SVG-fonts, smil.

http://jeszra.sourceforge.net/jeszra/vectordesign.html
http://jeszra.sourceforge.net/jeszra/Jeszra_TechnicalNotes.html#d0e9905

-roger