Method
RsvgHandleget_pixbuf_sub
since: 2.14
Declaration [src]
GdkPixbuf*
rsvg_handle_get_pixbuf_sub (
RsvgHandle* handle,
const char* id
)
Description [src]
Creates a GdkPixbuf
the same size as the entire SVG loaded into handle
, 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 RsvgHandle
‘s dots-per-inch value (DPI) to compute the
“natural size” of the document in pixels, so you should call 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 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 handle
. See
the section “API ordering” for details.
Available since: 2.14
Parameters
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 use the whole SVG.The argument can be NULL
.The data is owned by the caller of the method. The value is a NUL terminated UTF-8 string.
Return value
Type: GdkPixbuf
A pixbuf, or NULL
if an error occurs
during rendering.
The caller of the method takes ownership of the data, and is responsible for freeing it. |
The return value can be NULL . |