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 ( RectangleInt
or [RectangleInt
]) – a rectangle or a list of rectangleAllocates a new empty region object or a region object with the containing rectangle(s).
New in version 1.11.0.
-
copy
()¶ Returns: A newly allocated Region
.Raises: Error – if memory cannot be allocated. Allocates a new Region object copying the area from original.
-
get_extents
()¶ Returns: The bounding rectangle of region Return type: RectangleInt
-
get_rectangle
(nth)¶ Parameters: nth (int) – a number indicating which rectangle should be returned Returns: The nth rectangle from the region Return type: RectangleInt
-
contains_point
(x, y)¶ Parameters: Returns: Whether (x , y) is contained in the region
Return type:
-
contains_rectangle
(rectangle)¶ Parameters: rectangle (RectangleInt) – Returns: region overlap Return type: cairo.RegionOverlap Checks whether rectangle is inside, outside or partially contained in region
-
equal
(region)¶ Parameters: region (Region) – Returns: Whether both regions contained the same coverage Return type: bool
-
translate
(dx, dy)¶ Parameters: Translates region by (dx , dy ).
-
intersect
(other)¶ Parameters: other ( Region
orRectangleInt
) –Returns: The intersection of the region and the passed region or rectangle Return type: Region
-
subtract
(other)¶ Parameters: other ( Region
orRectangleInt
) –Returns: The result of the subtraction of the region and the passed region or rectangle Return type: Region
-
union
(other)¶ Parameters: other ( Region
orRectangleInt
) –Returns: The union of the region and the passed region or rectangle Return type: Region
-
xor
(other)¶ Parameters: other ( Region
orRectangleInt
) –Returns: The exclusive difference of the region and the passed region or rectangle Return type: Region
-