get_intrinsic_dimensions
Description:
public void get_intrinsic_dimensions (out bool out_has_width, out Length out_width, out bool out_has_height, out Length out_height, out bool out_has_viewbox, out Rectangle out_viewbox)
In simple terms, 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 [method@Rsvg.Handle.render_document] instead; it will do the scaling computations automatically.
Before librsvg 2.54.0, the `out_has_width` and `out_has_height` arguments would be set to true or false depending on whether the SVG document actually had `width` and `height` attributes, respectively.
However, since librsvg 2.54.0, `width` and `height` are now [geometry properties](https://www.w3.org/TR/SVG2/geometry.html) per the SVG2 specification; they are not plain attributes. SVG2 made it so that the initial value of those properties is `auto`, which is equivalent to specifing a value of `100%`. In this sense, even SVG documents which lack `width` or `height` attributes semantically have to make them default to `100%`. This is why since librsvg 2.54.0, `out_has_width` and `out_has_heigth` are always returned as `TRUE`, since with SVG2 all documents *have* a default width and height of `100%`.
As an example, the following SVG element has a `width` of 100 pixels and a `height` of 400 pixels, but no `viewBox`. This function will return those sizes in `out_width` and `out_height`, and set `out_has_viewbox` to `FALSE`.
``` <svg xmlns="http://www.w3.org/2000/svg" width="100" height="400"> ```
Conversely, the following element has a `viewBox`, but no `width` or `height`. This function will set `out_has_viewbox` to `TRUE`, and it will also set `out_has_width` and `out_has_height` to `TRUE` but return both length values as `100%`.
``` <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 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.
Parameters:
this |
An [class@Rsvg.Handle] |
out_has_width |
Will be set to `TRUE`; see below. |
out_width |
Will be set to the computed value of the `width` property in the toplevel SVG. |
out_has_height |
Will be set to `TRUE`; see below. |
out_height |
Will be set to the computed value of the `height` property in the toplevel SVG. |
out_has_viewbox |
Will be set to `TRUE` if the toplevel SVG has a `viewBox` attribute |
out_viewbox |
Will be set to the value of the `viewBox` attribute in the toplevel SVG |