valalibrsvg

Extending librsvg vapi


The vapi file that is available for librsvg-2.0 contains a lot less than what the actual library contains

vapi: http://valadoc.org/#!wiki=librsvg-2.0/index

library: https://git.gnome.org/browse/librsvg/tree/

I would have expected to have access to components like an RsvgNode to be able to access and alter the SVG contents directly, but neither the vapi nor the header files that are installed with the devel package contain a lot of what's in the library headers. I assume this has something to do with making the library GObject friendly, but I'm interested in more than what's there.

Is there a way to add headers, extend the vapi, and use the structs and functions that I need?

It's possible that this is not even what I should be doing, the contents of the library use the G_GNUC_HIDDEN macro pretty liberally suggesting that they don't want to give you access. But then I'm wondering how you can edit an SVG document/element live while displaying it in a Cairo context? I'm sure I could edit it using libxml, but I don't know how to refresh the context without reloading the SVG data and recreating the surface.

Thanks.


Solution

  • Just asked Christian Persch about this on IRC. His response was:

    that's right, all that stuff is not exported, and it's not in any state to be exported. there is no way with librsvg to change the svg without creating a new context and loading the new svg xml into it

    If the library doesn't export the stuff on the C level there isn't really a lot you can do at the Vala level. Creating bindings wouldn't be very difficult, but the API that it binds really needs to be public.

    Depending on your use case, perhaps you'd be happier using Clutter?