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 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.

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

class Handle
bool
renderElement

Parameters

cr cairo.context.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 rsvg.types.Rectangle

Viewport size in which to fit the element

Return Value

Type: bool

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.