Skip to content

API Reference / @gtkx/cairo / Region

Class: Region ​

Defined in: packages/cairo/src/region.ts:80

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: packages/cairo/src/region.ts:115

Creates a region covering rect.

Parameters ​

rect ​

RectangleInt

Returns ​

Region

Properties ​

__type__ ​

__type__: bigint

Defined in: packages/cairo/src/region.ts:112

GType of CairoRegion, the boxed type this class is registered under.

Methods ​

containsPoint() ​

containsPoint(x, y): boolean

Defined in: packages/cairo/src/region.ts:156

Returns whether the point (x, y) lies inside the region.

Parameters ​

x ​

number

y ​

number

Returns ​

boolean


containsRectangle() ​

containsRectangle(rect): RegionOverlap

Defined in: packages/cairo/src/region.ts:161

Returns whether rect lies inside, outside or partly inside the region.

Parameters ​

rect ​

RectangleInt

Returns ​

RegionOverlap


copy() ​

copy(): Region

Defined in: packages/cairo/src/region.ts:120

Returns a region with the same rectangles as this one.

Returns ​

Region


equal() ​

equal(other): boolean

Defined in: packages/cairo/src/region.ts:166

Returns whether the region covers the same area as other.

Parameters ​

other ​

Region

Returns ​

boolean


getExtents() ​

getExtents(): RectangleInt

Defined in: packages/cairo/src/region.ts:130

Returns the bounding rectangle of the region.

Returns ​

RectangleInt


getRectangle() ​

getRectangle(nth): RectangleInt

Defined in: packages/cairo/src/region.ts:143

Returns the nth rectangle of the region, counting from zero.

Parameters ​

nth ​

number

Returns ​

RectangleInt


intersect() ​

intersect(other): void

Defined in: packages/cairo/src/region.ts:176

Keeps only the area the region shares with other.

Parameters ​

other ​

Region

Returns ​

void


intersectRectangle() ​

intersectRectangle(rect): void

Defined in: packages/cairo/src/region.ts:181

Keeps only the area the region shares with rect.

Parameters ​

rect ​

RectangleInt

Returns ​

void


isEmpty() ​

isEmpty(): boolean

Defined in: packages/cairo/src/region.ts:151

Returns whether the region covers no area.

Returns ​

boolean


numRectangles() ​

numRectangles(): number

Defined in: packages/cairo/src/region.ts:138

Returns how many rectangles make up the region.

Returns ​

number


status() ​

status(): Status

Defined in: packages/cairo/src/region.ts:125

Returns the error status of the region, Status.SUCCESS when it is usable.

Returns ​

Status


subtract() ​

subtract(other): void

Defined in: packages/cairo/src/region.ts:186

Removes the area of other from the region.

Parameters ​

other ​

Region

Returns ​

void


subtractRectangle() ​

subtractRectangle(rect): void

Defined in: packages/cairo/src/region.ts:191

Removes the area of rect from the region.

Parameters ​

rect ​

RectangleInt

Returns ​

void


translate() ​

translate(dx, dy): void

Defined in: packages/cairo/src/region.ts:171

Moves the region by dx and dy.

Parameters ​

dx ​

number

dy ​

number

Returns ​

void


union() ​

union(other): void

Defined in: packages/cairo/src/region.ts:196

Adds the area of other to the region.

Parameters ​

other ​

Region

Returns ​

void


unionRectangle() ​

unionRectangle(rect): void

Defined in: packages/cairo/src/region.ts:201

Adds the area of rect to the region.

Parameters ​

rect ​

RectangleInt

Returns ​

void


xor() ​

xor(other): void

Defined in: packages/cairo/src/region.ts:206

Keeps the area covered by exactly one of the region and other.

Parameters ​

other ​

Region

Returns ​

void


xorRectangle() ​

xorRectangle(rect): void

Defined in: packages/cairo/src/region.ts:211

Keeps the area covered by exactly one of the region and rect.

Parameters ​

rect ​

RectangleInt

Returns ​

void


copy() ​

static copy(original): Region

Defined in: packages/cairo/src/region.ts:91

Creates a region with the same rectangles as original.

Parameters ​

original ​

Region

Returns ​

Region


createRectangles() ​

static createRectangles(rects): Region

Defined in: packages/cairo/src/region.ts:101

Creates a region covering the union of rects; an empty list yields an empty region.

Parameters ​

rects ​

RectangleData[]

Returns ​

Region


empty() ​

static empty(): Region

Defined in: packages/cairo/src/region.ts:86

Creates an empty region.

Returns ​

Region


forRectangle() ​

static forRectangle(rect): Region

Defined in: packages/cairo/src/region.ts:96

Creates a region covering rect.

Parameters ​

rect ​

RectangleInt

Returns ​

Region