Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

load svg with Cairo

Tags:

c++

svg

cairo

I want to load a SVG file with the Cairo library, do apply some transformations to it. Then I want to display my svg with a glTexture.

But I just find functions which create svg file and not load svg.

like image 665
Bob Avatar asked Jan 16 '14 01:01

Bob


1 Answers

Cairo itself cannot read SVG files. You need something like librsvg to render SVGs to a Cairo surface.

From a quick look at their API documentation, it looks like you need rsvg_handle_new_from_file() to load a file and something like rsvg_handle_render_cairo() or rsvg_handle_get_pixbuf() to draw the SVG to a Cairo context / to turn the SVG into a GdkPixbuf.

like image 149
Uli Schlachter Avatar answered Sep 22 '22 01:09

Uli Schlachter