Rendering SVG files with Cairo

Rendering SVG files with Cairo —

How to render SVGs to Cairo surfaces

Synopsis




void        rsvg_cairo_render               (cairo_t *cr,
                                             RsvgHandle *handle);
void        rsvg_cairo_render_sub           (cairo_t *cr,
                                             RsvgHandle *handle,
                                             const char *id);

Description

Cairo is a 2D graphics library with support for multiple output devices. Currently supported output targets include the X Window System, win32, and image buffers. Experimental backends include OpenGL (through glitz), Quartz, XCB, PostScript and PDF file output.

Cairo is designed to produce consistent output on all output media while taking advantage of display hardware acceleration when available (eg. through the X Render Extension).

The cairo API provides operations similar to the drawing operators of PostScript and PDF. Operations in cairo including stroking and filling cubic Bézier splines, transforming and compositing translucent images, and antialiased text rendering. All drawing operations can be transformed by any affine transformation (scale, rotation, shear, etc.)

Details

rsvg_cairo_render ()

void        rsvg_cairo_render               (cairo_t *cr,
                                             RsvgHandle *handle);

Draws a SVG to a Cairo surface

cr : A Cairo renderer
handle : A RsvgHandle

Since 2.14


rsvg_cairo_render_sub ()

void        rsvg_cairo_render_sub           (cairo_t *cr,
                                             RsvgHandle *handle,
                                             const char *id);

Draws a subset of a SVG to a Cairo surface

cr : A Cairo renderer
handle : A RsvgHandle
id : An element's id within the SVG, or NULL to render the whole SVG

Since 2.14