Re: How do I use cairomm and librsvg?



What's wrong with using the cobj() method in Cairo::Context? I thought Cairo::Context did provide access to the underlying C type, just for this situation.

https://www.cairographics.org/documentation/cairomm/reference/classCairo_1_1Context.html#a614bcb4e9570c5b5c54b3bfc304c194a

This method returns a pointer to Cairo::Context::cobject which is just a typedef of cairo_t. Then you shouldn't need to do any of that subclassing work. I haven't tested your code in any way, but that's what my understanding from the documentation is.


On Sat, Jul 21, 2018 at 10:02 PM, <ghosty airmail cc> wrote:
I have a C++ program that uses cairomm, and I'd like to use librsvg with it to render SVG files to Cairo surfaces. However, librsvg is in C, and rsvg_handle_render_cairo expects a cairo_t value, while cairomm's Cairo::Context doesn't give access to the underlying C type (it's protected). I tried subclassing Cairo::Context and implementing a function that returned a pointer to the underlying cairo_t type, but it doesn't seem to be working.

Code is as follows:

main.cpp: https://paste.gnome.org/p9fzmosnu
Makefile: https://paste.gnome.org/p6qswmxgr
mor.glade: https://paste.gnome.org/phlvgqqt5

It just prints
(mor:7839): librsvg-CRITICAL **: rsvg_handle_render_cairo_sub: assertion 'handle != NULL' failed
repeatedly, and doesn't render anything.

Any help would be appreciated.
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]