This can be achieved using either image.setFromPixelbufSub()
or image.renderCairoSub()
. The pixelbuf approach seems to be the simpler.
I have this:
import rsvg.Handle : RHandle = Handle;
...
auto svg = new RHandle(file);
auto pixbuf = svg.getPixbufSub("#layer");
image.setFromPixbuf(pixbuf);
image
is a GtkImage
The code above is segfaulting in the setFromPixbuf()
method. I don't know how to fix it.
I also tried the cairo approach, which seems to be a bit overkill, and I also didn't got it to work.
Does anyone have any suggestions on how to accomplish this or why the code is failing?
Thanks in advance,
Filipe