Method
RsvgHandlerender_element
since: 2.46
Declaration [src]
gboolean
rsvg_handle_render_element (
RsvgHandle* handle,
cairo_t* cr,
const char* id,
const RsvgRectangle* element_viewport,
GError** error
)
Description [src]
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.
Available since: 2.46
Parameters
cr
-
Type:
cairo_t
A Cairo context.
The data is owned by the caller of the method. id
-
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, passNULL
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. element_viewport
-
Type:
RsvgRectangle
Viewport size in which to fit the element.
The data is owned by the caller of the method. error
-
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 aNULL
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.