get_geometry_for_layer


Description:

[ Version ( since = "2.46" ) ]
public bool get_geometry_for_layer (string? id, Rectangle viewport, out Rectangle out_ink_rect, out Rectangle out_logical_rect) throws Error

Computes the ink rectangle and logical rectangle of an SVG element, or the whole SVG, as if the whole SVG were rendered to a specific viewport.

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.

Parameters:

this

An [class@Rsvg.Handle]

id

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 compute the geometry for the whole SVG.

viewport

Viewport size at which the whole SVG would be fitted.

out_ink_rect

Place to store the ink rectangle of the element.

out_logical_rect

Place to store the logical rectangle of the element.

Returns:

`TRUE` if the geometry could be obtained, or `FALSE` on error. Errors are returned in the throws argument.

API ordering: This function must be called on a fully-loaded this. See the section "[API ordering]( class.Handle.html#api-ordering)" for details.

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