Method

RsvgHandleget_intrinsic_dimensions

since: 2.46

Declaration [src]

void
rsvg_handle_get_intrinsic_dimensions (
  RsvgHandle* handle,
  gboolean* out_has_width,
  RsvgLength* out_width,
  gboolean* out_has_height,
  RsvgLength* out_height,
  gboolean* out_has_viewbox,
  RsvgRectangle* out_viewbox
)

Description [src]

Queries the width, height, and viewBox attributes in an SVG document.

If you are calling this function to compute a scaling factor to render the SVG, consider simply using rsvg_handle_render_document() instead; it will do the scaling computations automatically.

As an example, the following SVG element has a width of 100 pixels and a height of 400 pixels, but no viewBox:

<svg xmlns="http://www.w3.org/2000/svg" width="100" height="400">

Conversely, the following element has a viewBox, but no width or height:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 400">

Note that the RsvgLength return values have RsvgUnits in them; you should not assume that they are always in pixels. For example, the following SVG element will return width and height values whose units fields are RSVG_UNIT_MM.

<svg xmlns="http://www.w3.org/2000/svg" width="210mm" height="297mm">

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.

Available since: 2.46

Parameters

out_has_width

Type: gboolean*

Will be set to TRUE if the toplevel SVG has a width attribute.

The argument will be set by the function.
The argument can be NULL.
out_width

Type: RsvgLength

Will be set to the value of the width attribute in the toplevel SVG.

The argument will be set by the function.
The argument can be NULL.
The data is owned by the instance.
out_has_height

Type: gboolean*

Will be set to TRUE if the toplevel SVG has a height attribute.

The argument will be set by the function.
The argument can be NULL.
out_height

Type: RsvgLength

Will be set to the value of the height attribute in the toplevel SVG.

The argument will be set by the function.
The argument can be NULL.
The data is owned by the instance.
out_has_viewbox

Type: gboolean*

Will be set to TRUE if the toplevel SVG has a viewBox attribute.

The argument will be set by the function.
The argument can be NULL.
out_viewbox

Type: RsvgRectangle

Will be set to the value of the viewBox attribute in the toplevel SVG.

The argument will be set by the function.
The argument can be NULL.
The data is owned by the instance.