get_pixbuf_sub


Description:

[ Version ( since = "2.14" ) ]
public Pixbuf? get_pixbuf_sub (string? id)

Creates a `GdkPixbuf` the same size as the entire SVG loaded into this, but only renders the sub-element that has the specified id (and all its sub-sub-elements recursively).

If id is `NULL`, this function renders the whole SVG.

This function depends on the [class@Rsvg.Handle]'s dots-per-inch value (DPI) to compute the "natural size" of the document in pixels, so you should call [method@Rsvg.Handle.set_dpi] beforehand.

If you need to render an image which is only big enough to fit a particular sub-element of the SVG, consider using [ method@Rsvg.Handle.render_element].

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.

API ordering: This function must be called on a fully-loaded this. See the section "[API ordering]( class.Handle.html#api-ordering)" for details.

Parameters:

this

An Handle

id

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 use the whole SVG.

Returns:

a pixbuf, or `NULL` if an error occurs during rendering.