tags:

views:

41

answers:

2

I'm interested in writing a Gtk application that uses an embedded SVG canvas for graphics, and I'm wondering what the current state-of-the-art is for using SVG in Gtk. I know that it's possible to embed Webkit inside of Gtk, and so that seems like one approach, but I would like to add interactivity to DOM elements in the embedded SVG canvas using C instead of JavaScript, and I'm not sure if the embedded Webkit exposes its DOM APIs to the embedding C context. I'm wondering if there might be a better approach. The last article I was able to find on the subject was from 2004: http://www.osnews.com/story/6460

A: 

I don't think that SVG itself is available. But Gtk+ has several Canvas widgets that resemble the idea of SVG (actually, they're not Canvas widgets but Scene Graph widgets). Clutter is one of such widgets.

dmitry_vk
+2  A: 

librsvg is the preferred way to draw SVG into GTK+ widgets. However, to my knowledge, it doesn't support any kind of interactivity (only drawing).

Regarding WebKit, it does expose the DOM through webkit_web_view_get_dom_document. Have a look at the WebKitGtk tests for some examples.

Johannes Sasongko