Method
RsvgHandleget_geometry_for_element
Declaration [src]
gboolean
rsvg_handle_get_geometry_for_element (
RsvgHandle* handle,
const char* id,
RsvgRectangle* out_ink_rect,
RsvgRectangle* out_logical_rect,
GError** error
)
Description [src]
Computes the ink rectangle and logical rectangle of a single SVG element.
While rsvg_handle_get_geometry_for_layer
computes the geometry of an SVG element subtree with
its transformation matrix, this other function will compute the element’s geometry
as if it were being rendered under an identity transformation by itself. That is,
the resulting geometry is as if the element got extracted by itself from the SVG.
This function is the counterpart to 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.
The “ink rectangle” is the bounding box that would be painted for fully- stroked and filled elements.
The “logical rectangle” just takes into account the unstroked paths and text outlines.
Note that these bounds are not minimum bounds; for example, clipping paths are not taken into account.
You can pass NULL
for the id
if you want to measure all
the elements in the SVG, i.e. to measure everything from the
root element.
This operation is not constant-time, as it involves going through all the child elements.
Available since: | 2.46 |
Parameters
id |
const char* |
An element’s id within the SVG, starting with “#” (a single
hash character), for example, |
|
The argument can be NULL . | |
The data is owned by the caller of the function. | |
The value is a NUL terminated UTF-8 string. | |
out_ink_rect |
RsvgRectangle |
Place to store the ink rectangle of the element. |
|
The argument will be set by the function. | |
The argument can be NULL . | |
The data is owned by the caller of the function. | |
out_logical_rect |
RsvgRectangle |
Place to store the logical rectangle of the element. |
|
The argument will be set by the function. | |
The argument can be NULL . | |
The data is owned by the caller of the function. | |
error |
GError ** |
The return location for a GError* , or NULL . |
Return value
Returns: | gboolean |
API ordering: This function must be called on a fully-loaded Panics: this function will panic if the |