LIBRSVG: C library for rendering SVG

LIBRSVG 2.62.3 C library for rendering SVG

Loading...
Searching...
No Matches
Functions
Geometry
librsvg

Intrinsic size and element geometry. More...

## Functions
void | rsvg_handle_get_dimensions (RsvgHandle *handle, RsvgDimensionData *dimension_data)
| rsvg_handle_get_dimensions:
gboolean | rsvg_handle_get_dimensions_sub (RsvgHandle *handle, RsvgDimensionData *dimension_data, const char *id)
| rsvg_handle_get_dimensions_sub:
gboolean | rsvg_handle_get_position_sub (RsvgHandle *handle, RsvgPositionData *position_data, const char *id)
| rsvg_handle_get_position_sub:
gboolean | rsvg_handle_has_sub (RsvgHandle *handle, const char *id)
| rsvg_handle_has_sub: @handle: an #RsvgHandle @id: element id starting with `#`
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)
| rsvg_handle_get_intrinsic_dimensions: @handle: an #RsvgHandle @out_has_width: (out)(optional): whether the SVG has a width @out_width: (out)(optional): width as an RsvgLength @out_has_height: (out)(optional): whether the SVG has a height @out_height: (out)(optional): height as an RsvgLength @out_has_viewbox: (out)(optional): whether the SVG has a viewBox @out_viewbox: (out)(optional): viewBox as an #RsvgRectangle
gboolean | rsvg_handle_get_intrinsic_size_in_pixels (RsvgHandle *handle, gdouble *out_width, gdouble *out_height)
| rsvg_handle_get_intrinsic_size_in_pixels: @handle: an #RsvgHandle @out_width: (out)(optional): width in pixels @out_height: (out)(optional): height in pixels
gboolean | rsvg_handle_get_geometry_for_layer (RsvgHandle *handle, const char *id, const RsvgRectangle *viewport, RsvgRectangle *out_ink_rect, RsvgRectangle *out_logical_rect, GError **error)
| Geometry of an element (or the whole SVG) as if rendered to @viewport.
gboolean | rsvg_handle_get_geometry_for_element (RsvgHandle *handle, const char *id, RsvgRectangle *out_ink_rect, RsvgRectangle *out_logical_rect, GError **error)
| rsvg_handle_get_geometry_for_element: @handle: an #RsvgHandle @id: (nullable): element id starting with `#`, or NULL for the whole SVG @out_ink_rect: (out)(optional): ink rectangle @out_logical_rect: (out)(optional): logical rectangle @error: return location for a #GError

## Detailed Description

Intrinsic size and element geometry.

Prefer rsvg_handle_get_intrinsic_dimensions(), rsvg_handle_get_intrinsic_size_in_pixels(), and rsvg_handle_get_geometry_for_layer().

## Function Documentation

## ◆ rsvg_handle_get_dimensions()

void rsvg_handle_get_dimensions | ( | RsvgHandle * | handle,
|  | RsvgDimensionData * | dimension_data
| ) |  |

`#include <rsvg.h>`

rsvg_handle_get_dimensions:

Deprecated:
  Since 2.46: use rsvg_handle_get_intrinsic_size_in_pixels().

Since
  2.14

## ◆ rsvg_handle_get_dimensions_sub()

gboolean rsvg_handle_get_dimensions_sub | ( | RsvgHandle * | handle,
|  | RsvgDimensionData * | dimension_data,
|  | const char * | id
| ) |  |

`#include <rsvg.h>`

rsvg_handle_get_dimensions_sub:

Deprecated:
  Since 2.46: use rsvg_handle_get_geometry_for_layer().

Since
  2.22

## ◆ rsvg_handle_get_geometry_for_element()

gboolean rsvg_handle_get_geometry_for_element | ( | RsvgHandle * | handle,
|  | const char * | id,
|  | RsvgRectangle * | out_ink_rect,
|  | RsvgRectangle * | out_logical_rect,
|  | GError ** | error
| ) |  |

`#include <rsvg-cairo.h>`

rsvg_handle_get_geometry_for_element: @handle: an #RsvgHandle @id: (nullable): element id starting with `#`, or NULL for the whole SVG @out_ink_rect: (out)(optional): ink rectangle @out_logical_rect: (out)(optional): logical rectangle @error: return location for a #GError

Geometry of an element in SVG user units (no viewport fit).

Returns: TRUE on success, FALSE on error.

Since
  2.46

## ◆ rsvg_handle_get_geometry_for_layer()

gboolean rsvg_handle_get_geometry_for_layer | ( | RsvgHandle * | handle,
|  | const char * | id,
|  | const RsvgRectangle * | viewport,
|  | RsvgRectangle * | out_ink_rect,
|  | RsvgRectangle * | out_logical_rect,
|  | GError ** | error
| ) |  |

`#include <rsvg-cairo.h>`

Geometry of an element (or the whole SVG) as if rendered to @viewport.

@handle: an #RsvgHandle @id: (nullable): element id starting with `#`, or NULL for the whole SVG @viewport: viewport the whole SVG would be fitted to @out_ink_rect: (out)(optional): ink rectangle @out_logical_rect: (out)(optional): logical rectangle @error: return location for a #GError

Returns: TRUE on success, FALSE on error.

Since
  2.46

## ◆ rsvg_handle_get_intrinsic_dimensions()

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
| ) |  |

`#include <rsvg.h>`

rsvg_handle_get_intrinsic_dimensions: @handle: an #RsvgHandle @out_has_width: (out)(optional): whether the SVG has a width @out_width: (out)(optional): width as an RsvgLength @out_has_height: (out)(optional): whether the SVG has a height @out_height: (out)(optional): height as an RsvgLength @out_has_viewbox: (out)(optional): whether the SVG has a viewBox @out_viewbox: (out)(optional): viewBox as an #RsvgRectangle

Unconverted width/height/viewBox from the SVG root.

Since
  2.46

## ◆ rsvg_handle_get_intrinsic_size_in_pixels()

gboolean rsvg_handle_get_intrinsic_size_in_pixels | ( | RsvgHandle * | handle,
|  | gdouble * | out_width,
|  | gdouble * | out_height
| ) |  |

`#include <rsvg.h>`

rsvg_handle_get_intrinsic_size_in_pixels: @handle: an #RsvgHandle @out_width: (out)(optional): width in pixels @out_height: (out)(optional): height in pixels

Convert intrinsic width and height to pixels using the handle DPI.

Returns: TRUE if both dimensions could be resolved to pixels.

Since
  2.46

## ◆ rsvg_handle_get_position_sub()

gboolean rsvg_handle_get_position_sub | ( | RsvgHandle * | handle,
|  | RsvgPositionData * | position_data,
|  | const char * | id
| ) |  |

`#include <rsvg.h>`

rsvg_handle_get_position_sub:

Deprecated:
  Since 2.46: use rsvg_handle_get_geometry_for_layer().

Since
  2.22

## ◆ rsvg_handle_has_sub()

gboolean rsvg_handle_has_sub | ( | RsvgHandle * | handle,
|  | const char * | id
| ) |  |

`#include <rsvg.h>`

rsvg_handle_has_sub: @handle: an #RsvgHandle @id: element id starting with `#`

Returns: TRUE if @id exists in the document.

Since
  2.22