LIBRSVG: C library for rendering SVG

LIBRSVG 2.62.3 C library for rendering SVG

Loading...
Searching...
No Matches
Functions
Rendering
librsvg

Draw an SVG onto a Cairo context. More...

## Functions
gboolean | rsvg_handle_render_cairo (RsvgHandle *handle, cairo_t *cr)
| rsvg_handle_render_cairo: @handle: an #RsvgHandle @cr: a Cairo context
gboolean | rsvg_handle_render_cairo_sub (RsvgHandle *handle, cairo_t *cr, const char *id)
| rsvg_handle_render_cairo_sub: @handle: an #RsvgHandle @cr: a Cairo context @id: (nullable): element id starting with `#`, or NULL for the whole SVG
gboolean | rsvg_handle_render_document (RsvgHandle *handle, cairo_t *cr, const RsvgRectangle *viewport, GError **error)
| Draw the whole SVG into @viewport on @cr.
gboolean | rsvg_handle_render_layer (RsvgHandle *handle, cairo_t *cr, const char *id, const RsvgRectangle *viewport, GError **error)
| rsvg_handle_render_layer: @handle: an #RsvgHandle @cr: a Cairo context @id: (nullable): element id starting with `#`, or NULL for the whole SVG @viewport: viewport for the whole document @error: return location for a #GError
gboolean | rsvg_handle_render_element (RsvgHandle *handle, cairo_t *cr, const char *id, const RsvgRectangle *element_viewport, GError **error)
| rsvg_handle_render_element: @handle: an #RsvgHandle @cr: a Cairo context @id: (nullable): element id starting with `#`, or NULL for the whole SVG @element_viewport: size at which to draw that element @error: return location for a #GError

## Detailed Description

Draw an SVG onto a Cairo context.

Prefer rsvg_handle_render_document(). rsvg_handle_render_cairo() is deprecated.

## Function Documentation

## ◆ rsvg_handle_render_cairo()

gboolean rsvg_handle_render_cairo | ( | RsvgHandle * | handle,
|  | cairo_t * | cr
| ) |  |

`#include <rsvg-cairo.h>`

rsvg_handle_render_cairo: @handle: an #RsvgHandle @cr: a Cairo context

Draw the whole SVG to @cr. The size is taken from the document; you cannot pass a viewport.

Deprecated:
  Since 2.52: use rsvg_handle_render_document() instead.

Since
  2.14

## ◆ rsvg_handle_render_cairo_sub()

gboolean rsvg_handle_render_cairo_sub | ( | RsvgHandle * | handle,
|  | cairo_t * | cr,
|  | const char * | id
| ) |  |

`#include <rsvg-cairo.h>`

rsvg_handle_render_cairo_sub: @handle: an #RsvgHandle @cr: a Cairo context @id: (nullable): element id starting with `#`, or NULL for the whole SVG

Draw one element (and its children) to @cr.

Deprecated:
  Since 2.52: use rsvg_handle_render_layer() instead.

Since
  2.14

## ◆ rsvg_handle_render_document()

gboolean rsvg_handle_render_document | ( | RsvgHandle * | handle,
|  | cairo_t * | cr,
|  | const RsvgRectangle * | viewport,
|  | GError ** | error
| ) |  |

`#include <rsvg-cairo.h>`

Draw the whole SVG into @viewport on @cr.

@handle: an #RsvgHandle @cr: a Cairo context @viewport: where to fit the SVG, in the current Cairo user units @error: return location for a #GError

Returns: TRUE on success, FALSE on error.

Since
  2.52

## ◆ rsvg_handle_render_element()

gboolean rsvg_handle_render_element | ( | RsvgHandle * | handle,
|  | cairo_t * | cr,
|  | const char * | id,
|  | const RsvgRectangle * | element_viewport,
|  | GError ** | error
| ) |  |

`#include <rsvg-cairo.h>`

rsvg_handle_render_element: @handle: an #RsvgHandle @cr: a Cairo context @id: (nullable): element id starting with `#`, or NULL for the whole SVG @element_viewport: size at which to draw that element @error: return location for a #GError

Draw one element into @element_viewport (the element’s own size, not the whole document’s).

Returns: TRUE on success, FALSE on error.

Since
  2.52

## ◆ rsvg_handle_render_layer()

gboolean rsvg_handle_render_layer | ( | RsvgHandle * | handle,
|  | cairo_t * | cr,
|  | const char * | id,
|  | const RsvgRectangle * | viewport,
|  | GError ** | error
| ) |  |

`#include <rsvg-cairo.h>`

rsvg_handle_render_layer: @handle: an #RsvgHandle @cr: a Cairo context @id: (nullable): element id starting with `#`, or NULL for the whole SVG @viewport: viewport for the whole document @error: return location for a #GError

Draw one element as if the whole SVG were fitted to @viewport.

Returns: TRUE on success, FALSE on error.

Since
  2.52