cairo::region
Regions - Representing a pixel-aligned area.
Regions are a simple graphical data type representing an area of integer-aligned rectangles. They are often used on raster surfaces to track areas of interest, such as change or clip areas.
Index
Functions
fn contains_point(region: const *cairo::region_t, x: int, y: int) bool;
fn contains_rectangle(region: const *cairo::region_t, rectangle: *const cairo::rectangle_int_t) cairo::region_overlap_t;
fn copy(original: const *cairo::region_t) (*cairo::region_t | cairo::error);
fn create() (*cairo::region_t | cairo::error);
fn create_rectangle(rectangle: *const cairo::rectangle_int_t) (*cairo::region_t | cairo::error);
fn create_rectangles(rects: *const cairo::rectangle_int_t, count: int) (*cairo::region_t | cairo::error);
fn destroy(region: *cairo::region_t) void;
fn equal(a: const *cairo::region_t, b: const *cairo::region_t) bool;
fn get_extents(region: const *cairo::region_t) cairo::rectangle_int_t;
fn get_rectangle(region: const *cairo::region_t, nth: int, rectangle: *cairo::rectangle_int_t) void;
fn intersect(dst: *cairo::region_t, other: const *cairo::region_t) (void | cairo::error);
fn intersect_rectangle(dst: *cairo::region_t, rectangle: *const cairo::rectangle_int_t) (void | cairo::error);
fn is_empty(region: const *cairo::region_t) bool;
fn num_rectangles(region: const *cairo::region_t) int;
fn reference(region: *cairo::region_t) *cairo::region_t;
fn status(region: const *cairo::region_t) cairo::status_t;
fn subtract(dst: *cairo::region_t, other: const *cairo::region_t) (void | cairo::error);
fn subtract_rectangle(dst: *cairo::region_t, rectangle: *const cairo::rectangle_int_t) (void | cairo::error);
fn translate(region: *cairo::region_t, dx: int, dy: int) void;
fn union_(dst: *cairo::region_t, other: const *cairo::region_t) (void | cairo::error);
fn union_rectangle(dst: *cairo::region_t, rectangle: *const cairo::rectangle_int_t) (void | cairo::error);
fn xor(dst: *cairo::region_t, other: const *cairo::region_t) (void | cairo::error);
fn xor_rectangle(dst: *cairo::region_t, rectangle: *const cairo::rectangle_int_t) (void | cairo::error);
Functions
fn contains_point
fn contains_point(region: const *cairo::region_t, x: int, y: int) bool;
Checks whether (x, y) is contained in region.
Parameters
- region: a cairo::region_t
- x: the x coordinate of a point
- y: the y coordinate of a point
Returns true if (x, y) is contained in region, false if it is not.
fn contains_rectangle
fn contains_rectangle(region: const *cairo::region_t, rectangle: *const cairo::rectangle_int_t) cairo::region_overlap_t;
Checks whether rectangle is inside, outside or partially contained in region.
Returns cairo::region_overlap_t::IN if rectangle is entirely inside region, cairo::region_overlap_t::OUT if rectangle is entirely outside region, or cairo::region_overlap_t::PART if rectangle is partially inside and partially outside region.
fn copy
fn copy(original: const *cairo::region_t) (*cairo::region_t | cairo::error);
Allocates a new region object copying the area from original.
Returns a newly allocated cairo::region_t. Free with destroy. If an error occurs, cairo::error is returned instead.
fn create
fn create() (*cairo::region_t | cairo::error);
Allocates a new empty region object. Returns a newly allocated cairo::region_t. Free with destroy. If an error occurs, cairo::error is returned instead.
fn create_rectangle
fn create_rectangle(rectangle: *const cairo::rectangle_int_t) (*cairo::region_t | cairo::error);
XXX: Allocates a new region object containing rectangle. Returns a newly allocated cairo::region_t. Free with destroy. If an error occurs, cairo::error is returned instead.
fn create_rectangles
fn create_rectangles(rects: *const cairo::rectangle_int_t, count: int) (*cairo::region_t | cairo::error);
XXX: Allocates a new region object containing the union of all given rects.
Parameters
- rects: an array of count rectangles
- count: number of rectangles
Returns a newly allocated cairo::region_t. Free with destroy. If an error occurs, cairo::error is returned instead.
fn destroy
fn destroy(region: *cairo::region_t) void;
Destroys a cairo::region_t object created with create, copy, or create_rectangle.
fn equal
fn equal(a: const *cairo::region_t, b: const *cairo::region_t) bool;
Compares whether region_a is equivalent to region_b.
Returns true if both regions contained the same coverage, false if it is not or any region is in an error status.
fn get_extents
fn get_extents(region: const *cairo::region_t) cairo::rectangle_int_t;
Gets the bounding rectangle of region as a cairo::rectangle_int_t.
fn get_rectangle
fn get_rectangle(region: const *cairo::region_t, nth: int, rectangle: *cairo::rectangle_int_t) void;
XXX:. Stores the nth rectangle from the region in rectangle.
Parameters
- region: a cairo::region_t
- nth: a number indicating which rectangle should be returned
- rectangle: return location for a cairo::rectangle_int_t
fn intersect
fn intersect(dst: *cairo::region_t, other: const *cairo::region_t) (void | cairo::error);
Computes the intersection of dst with other and places the result in dst.
fn intersect_rectangle
fn intersect_rectangle(dst: *cairo::region_t, rectangle: *const cairo::rectangle_int_t) (void | cairo::error);
Computes the intersection of dst with rectangle and places the result in dst.
fn is_empty
fn is_empty(region: const *cairo::region_t) bool;
Checks whether region is empty. Returns true if region is empty, false if it isn't.
fn num_rectangles
fn num_rectangles(region: const *cairo::region_t) int;
Returns the number of rectangles contained in region.
fn reference
fn reference(region: *cairo::region_t) *cairo::region_t;
Increases the reference count on region by one. This prevents region from being destroyed until a matching call to destroy is made.
Returns the referenced cairo::region_t.
fn status
fn status(region: const *cairo::region_t) cairo::status_t;
Checks whether an error has previous occurred for this region object.
fn subtract
fn subtract(dst: *cairo::region_t, other: const *cairo::region_t) (void | cairo::error);
Subtracts other from dst and places the result in dst.
fn subtract_rectangle
fn subtract_rectangle(dst: *cairo::region_t, rectangle: *const cairo::rectangle_int_t) (void | cairo::error);
Subtracts rectangle from dst and places the result in dst.
fn translate
fn translate(region: *cairo::region_t, dx: int, dy: int) void;
Translates region by (dx, dy).
Parameters
- region: a cairo::region_t
- dx: Amount to translate in the x direction
- dy: Amount to translate in the y direction
fn union_
fn union_(dst: *cairo::region_t, other: const *cairo::region_t) (void | cairo::error);
Computes the union of dst with other and places the result in dst.
fn union_rectangle
fn union_rectangle(dst: *cairo::region_t, rectangle: *const cairo::rectangle_int_t) (void | cairo::error);
Computes the union of dst with rectangle and places the result in dst.
fn xor
fn xor(dst: *cairo::region_t, other: const *cairo::region_t) (void | cairo::error);
Computes the exclusive difference of dst with other and places the result in dst. That is, dst will be set to contain all areas that are either in dst or in other, but not in both.
fn xor_rectangle
fn xor_rectangle(dst: *cairo::region_t, rectangle: *const cairo::rectangle_int_t) (void | cairo::error);
Computes the exclusive difference of dst with rectangle and places the result in dst. That is, dst will be set to contain all areas that are either in dst or in rectangle, but not in both.