Cairo Utilities

Cairo Utilities — Some utility functions to use with the Cairo graphics library

Functions

Description

Cairo is the graphics library that GTK uses to draw widgets. This section contains functions for commonly used calculations with Cairo objects.

Functions

dzl_cairo_region_create_from_clip_extents ()

cairo_region_t *
dzl_cairo_region_create_from_clip_extents
                               (cairo_t *cr);

Creates a region from the extents of the context's current clip area.

Returns

A CairoRegion.

[transfer full]


dzl_cairo_rounded_rectangle ()

void
dzl_cairo_rounded_rectangle (cairo_t *cr,
                             const GdkRectangle *rect,
                             gint x_radius,
                             gint y_radius);

Adds a rounded rectangle to cr 's current path.

Parameters

cr

a cairo context

 

rect

a GdkRectangle to draw

 

x_radius

the radius of the corners on the X axis

 

y_radius

the radius of the corners on the Y axis

 

dzl_cairo_rectangle_x2 ()

gint
dzl_cairo_rectangle_x2 (const cairo_rectangle_int_t *rect);

Finds the X coordinate of the right side of a rectangle.

Parameters

rect

the cairo rectangle to find the right side of

 

Returns

The X coordinate as an integer


dzl_cairo_rectangle_y2 ()

gint
dzl_cairo_rectangle_y2 (const cairo_rectangle_int_t *rect);

Finds the Y coordinate of the bottom of a rectangle.

Parameters

rect

the cairo rectangle to find the bottom of

 

Returns

The Y coordinate as an integer


dzl_cairo_rectangle_center ()

gint
dzl_cairo_rectangle_center (const cairo_rectangle_int_t *rect);

Finds the X coordinate of the center of a rectangle.

Parameters

rect

the cairo rectangle to find the center of

 

Returns

The X coordinate as an integer


dzl_cairo_rectangle_middle ()

gint
dzl_cairo_rectangle_middle (const cairo_rectangle_int_t *rect);

Finds the Y coordinate of the center of a rectangle.

Parameters

rect

the cairo rectangle to find the center of

 

Returns

The Y coordinate as an integer


dzl_cairo_rectangle_contains_rectangle ()

cairo_bool_t
dzl_cairo_rectangle_contains_rectangle
                               (const cairo_rectangle_int_t *a,
                                const cairo_rectangle_int_t *b);

Determines whether rectangle a completely contains rectangle b . b may share edges with a and still be considered contained.

Parameters

a

the outer rectangle

 

b

the inner rectangle

 

Returns

Whether a contains b

Types and Values