Skip to content

Commit

Permalink
Add new API interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
drfiemost committed Feb 13, 2022
1 parent 586e75f commit b9185b1
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
27 changes: 27 additions & 0 deletions rsvg-cairo.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,36 @@

G_BEGIN_DECLS

RSVG_DEPRECATED_FOR(rsvg_handle_render_document)
gboolean rsvg_handle_render_cairo (RsvgHandle * handle, cairo_t * cr);

RSVG_DEPRECATED_FOR(rsvg_handle_render_layer)
gboolean rsvg_handle_render_cairo_sub (RsvgHandle * handle, cairo_t * cr, const char *id);

gboolean rsvg_handle_render_document (RsvgHandle *handle,
cairo_t *cr,
const RsvgRectangle *viewport,
GError **error);

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

gboolean rsvg_handle_render_layer (RsvgHandle *handle,
cairo_t *cr,
const char *id,
const RsvgRectangle *viewport,
GError **error);

gboolean rsvg_handle_render_element (RsvgHandle *handle,
cairo_t *cr,
const char *id,
const RsvgRectangle *element_viewport,
GError **error);

G_END_DECLS

#endif
41 changes: 41 additions & 0 deletions rsvg.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ typedef struct RsvgHandlePrivate RsvgHandlePrivate;
typedef struct _RsvgHandleClass RsvgHandleClass;
typedef struct _RsvgDimensionData RsvgDimensionData;
typedef struct _RsvgPositionData RsvgPositionData;
typedef struct _RsvgRectangle RsvgRectangle;

/**
* RsvgHandleClass:
Expand Down Expand Up @@ -125,6 +126,13 @@ struct _RsvgPositionData {
int y;
};

struct _RsvgRectangle {
double x;
double y;
double width;
double height;
};

void rsvg_cleanup (void);

void rsvg_set_default_dpi (double dpi);
Expand All @@ -143,13 +151,46 @@ GdkPixbuf *rsvg_handle_get_pixbuf_sub (RsvgHandle * handle, const char *id);
const char *rsvg_handle_get_base_uri (RsvgHandle * handle);
void rsvg_handle_set_base_uri (RsvgHandle * handle, const char *base_uri);

RSVG_DEPRECATED_FOR(rsvg_handle_get_intrinsic_size_in_pixels)
void rsvg_handle_get_dimensions (RsvgHandle * handle, RsvgDimensionData * dimension_data);

RSVG_DEPRECATED_FOR(rsvg_handle_get_geometry_for_layer)
gboolean rsvg_handle_get_dimensions_sub (RsvgHandle * handle, RsvgDimensionData * dimension_data, const char *id);

RSVG_DEPRECATED_FOR(rsvg_handle_get_geometry_for_layer)
gboolean rsvg_handle_get_position_sub (RsvgHandle * handle, RsvgPositionData * position_data, const char *id);

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

typedef enum {
RSVG_UNIT_PERCENT,
RSVG_UNIT_PX,
RSVG_UNIT_EM,
RSVG_UNIT_EX,
RSVG_UNIT_IN,
RSVG_UNIT_CM,
RSVG_UNIT_MM,
RSVG_UNIT_PT,
RSVG_UNIT_PC
} RsvgUnit;

typedef struct {
double length;
RsvgUnit unit;
} RsvgLength;

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

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

/* GIO APIs */

/**
Expand Down

0 comments on commit b9185b1

Please sign in to comment.