since: 2.46

Declaration [src]

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

Description [src]

Renders a single SVG element in the same place as for a whole SVG document.

The viewport gives the position and size at which the whole SVG document would be rendered. The document is scaled proportionally to fit into this viewport; hence the individual layer may be smaller than this.

This is equivalent to rsvg_handle_render_document(), but it renders only a single element and its children, as if they composed an individual layer in the SVG. The element is rendered with the same transformation matrix as it has within the whole SVG document. Applications can use this to re-render a single element and repaint it on top of a previously-rendered document, for example.

Element IDs should look like an URL fragment identifier; for example, pass #foo (hash foo) to get the geometry of the element that has an id="foo" attribute.

You can pass NULL for the id if you want to render all the elements in the SVG, i.e. to render everything from the root element.

Available since: 2.46



Type: cairo_t

A Cairo context.

The data is owned by the caller of the method.

Type: const char*

An element’s id within the SVG, starting with “#” (a single hash character), for example, #layer1. This notation corresponds to a URL’s fragment ID. Alternatively, pass NULL to render the whole SVG document tree.

The argument can be NULL.
The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.

Type: RsvgRectangle

Viewport size at which the whole SVG would be fitted.

The data is owned by the caller of the method.

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE on success, FALSE on error. Errors are returned in the error argument.

API ordering: This function must be called on a fully-loaded handle. See the section “API ordering” for details.

Panics: this function will panic if the handle is not fully-loaded.