jbeard4
jbeard4

Reputation: 12811

State-of-the-art for embedding scriptable, interactive SVG in Gtk+ applications?

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

Upvotes: 6

Views: 1298

Answers (2)

Johannes Sasongko
Johannes Sasongko

Reputation: 4238

Librsvg (Reference Manual / GitLab) 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.

Upvotes: 3

dmitry_vk
dmitry_vk

Reputation: 4469

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.

Upvotes: 1

Related Questions