Region¶
Region — Representing a pixel-aligned area
class Region()¶
Region is 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.
-
class
cairo.Region([rectangle_int|rectangle_ints])¶ - Parameters
rectangle_int (
RectangleIntor [RectangleInt]) – a rectangle or a list of rectangle
Allocates a new empty region object or a region object with the containing rectangle(s).
New in version 1.11.0.
-
copy()¶ -
Allocates a new Region object copying the area from original.
-
get_extents()¶ - Returns
The bounding rectangle of region
- Return type
-
get_rectangle(nth)¶ - Parameters
nth (int) – a number indicating which rectangle should be returned
- Returns
The nth rectangle from the region
- Return type
-
contains_point(x, y)¶
-
contains_rectangle(rectangle)¶ - Parameters
rectangle (RectangleInt) –
- Returns
region overlap
- Return type
Checks whether rectangle is inside, outside or partially contained in region
-
equal(region)¶
-
translate(dx, dy)¶ - Parameters
Translates region by (dx , dy ).
-
intersect(other)¶ - Parameters
other (
RegionorRectangleInt) –- Returns
The intersection of the region and the passed region or rectangle
- Return type
-
subtract(other)¶ - Parameters
other (
RegionorRectangleInt) –- Returns
The result of the subtraction of the region and the passed region or rectangle
- Return type
-
union(other)¶ - Parameters
other (
RegionorRectangleInt) –- Returns
The union of the region and the passed region or rectangle
- Return type
-
xor(other)¶ - Parameters
other (
RegionorRectangleInt) –- Returns
The exclusive difference of the region and the passed region or rectangle
- Return type