API Reference / @gtkx/cairo / Region
Class: Region
Defined in: region.d.ts:8
A cairo region (cairo_region_t): a set of integer rectangles, as GTK uses for clip and damage areas. Set operations modify the region in place.
Constructors
Constructor
new Region(
rect):Region
Defined in: region.d.ts:20
Creates a region covering rect.
Parameters
rect
Returns
Region
Properties
__type__
__type__:
bigint
Defined in: region.d.ts:18
GType of CairoRegion, the boxed type this class is registered under.
Methods
containsPoint()
containsPoint(
x,y):boolean
Defined in: region.d.ts:34
Returns whether the point (x, y) lies inside the region.
Parameters
x
number
y
number
Returns
boolean
containsRectangle()
containsRectangle(
rect):RegionOverlap
Defined in: region.d.ts:36
Returns whether rect lies inside, outside or partly inside the region.
Parameters
rect
Returns
copy()
copy():
Region
Defined in: region.d.ts:22
Returns a region with the same rectangles as this one.
Returns
Region
equal()
equal(
other):boolean
Defined in: region.d.ts:38
Returns whether the region covers the same area as other.
Parameters
other
Region
Returns
boolean
getExtents()
getExtents():
RectangleInt
Defined in: region.d.ts:26
Returns the bounding rectangle of the region.
Returns
getRectangle()
getRectangle(
nth):RectangleInt
Defined in: region.d.ts:30
Returns the nth rectangle of the region, counting from zero.
Parameters
nth
number
Returns
intersect()
intersect(
other):void
Defined in: region.d.ts:42
Keeps only the area the region shares with other.
Parameters
other
Region
Returns
void
intersectRectangle()
intersectRectangle(
rect):void
Defined in: region.d.ts:44
Keeps only the area the region shares with rect.
Parameters
rect
Returns
void
isEmpty()
isEmpty():
boolean
Defined in: region.d.ts:32
Returns whether the region covers no area.
Returns
boolean
numRectangles()
numRectangles():
number
Defined in: region.d.ts:28
Returns how many rectangles make up the region.
Returns
number
status()
status():
Status
Defined in: region.d.ts:24
Returns the error status of the region, Status.SUCCESS when it is usable.
Returns
subtract()
subtract(
other):void
Defined in: region.d.ts:46
Removes the area of other from the region.
Parameters
other
Region
Returns
void
subtractRectangle()
subtractRectangle(
rect):void
Defined in: region.d.ts:48
Removes the area of rect from the region.
Parameters
rect
Returns
void
translate()
translate(
dx,dy):void
Defined in: region.d.ts:40
Moves the region by dx and dy.
Parameters
dx
number
dy
number
Returns
void
union()
union(
other):void
Defined in: region.d.ts:50
Adds the area of other to the region.
Parameters
other
Region
Returns
void
unionRectangle()
unionRectangle(
rect):void
Defined in: region.d.ts:52
Adds the area of rect to the region.
Parameters
rect
Returns
void
xor()
xor(
other):void
Defined in: region.d.ts:54
Keeps the area covered by exactly one of the region and other.
Parameters
other
Region
Returns
void
xorRectangle()
xorRectangle(
rect):void
Defined in: region.d.ts:56
Keeps the area covered by exactly one of the region and rect.
Parameters
rect
Returns
void
copy()
staticcopy(original):Region
Defined in: region.d.ts:12
Creates a region with the same rectangles as original.
Parameters
original
Region
Returns
Region
createRectangles()
staticcreateRectangles(rects):Region
Defined in: region.d.ts:16
Creates a region covering the union of rects; an empty list yields an empty region.
Parameters
rects
Returns
Region
empty()
staticempty():Region
Defined in: region.d.ts:10
Creates an empty region.
Returns
Region
forRectangle()
staticforRectangle(rect):Region
Defined in: region.d.ts:14
Creates a region covering rect.
Parameters
rect
Returns
Region