Handle.renderElement

Renders a single SVG element to a given viewport

This function can be used to extract individual element subtrees and render them, scaled to a given @element_viewport. This is useful for applications which have reusable objects in an SVG and want to render them individually; for example, an SVG full of icons that are meant to be be rendered independently of each other.

Element IDs should look like an URL fragment identifier; for example, pass "##foo" (hash <literal>foo</literal>) to get the geometry of the element that has an <literal>id="foo"</literal> 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.

The element_viewport gives the position and size at which the named element will be rendered. FIXME: mention proportional scaling.

API ordering: This function must be called on a fully-loaded @handle. See the section <ulink url="#API-ordering">API ordering</ulink> for details.

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

class Handle
bool
renderElement

Parameters

cr Context

A Cairo context

id string

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.

elementViewport RsvgRectangle*

Viewport size in which to fit the element

Throws

GException on failure.

Meta

Since

2.46