Vips.Rect

Fields

Name

Type

Access

Description

height

int

r/w

height of rectangle

left

int

r/w

left edge of rectangle

top

int

r/w

top edge of rectangle

width

int

r/w

width of rectangle

Methods

equalsrect (r2)

includespoint (x, y)

includesrect (r2)

intersectrect (r2)

isempty ()

marginadjust (n)

normalise ()

overlapsrect (r2)

unionrect (r2)

Details

class Vips.Rect

A Vips.Rect is a rectangular area of pixels. This is a struct for performing simple rectangle algebra.

equalsrect(r2)
Parameters:

r2 (Vips.Rect) – second rectangle

Returns:

True if self is equal to r2.

Return type:

bool

Is self equal to r2?

includespoint(x, y)
Parameters:
  • x (int) – position to test for

  • y (int) – position to test for

Returns:

True if self contains (x, y).

Return type:

bool

Does self contain point (x, y)?

includesrect(r2)
Parameters:

r2 (Vips.Rect) – inner rectangle

Returns:

True if r2 is a subset of self.

Return type:

bool

Is r2 a subset of self?

intersectrect(r2)
Parameters:

r2 (Vips.Rect) – input rectangle 2

Returns:

output rectangle

Return type:

out: Vips.Rect

Fill out with the intersection of self and r2. out can equal self or r2.

isempty()
Returns:

True if self contains no pixels.

Return type:

bool

Is self empty? ie. zero width or height.

marginadjust(n)
Parameters:

n (int) – enlarge by

Enlarge self by n. +1 means out one pixel.

normalise()

Make sure width and height are >0 by moving the origin and flipping the rect.

overlapsrect(r2)
Parameters:

r2 (Vips.Rect) – second rectangle

Returns:

True if r2 and self overlap.

Return type:

bool

Do self and r2 have a non-empty intersection?

unionrect(r2)
Parameters:

r2 (Vips.Rect) – input rectangle 2

Returns:

output rectangle

Return type:

out: Vips.Rect

Fill out with the bounding box of self and r2. out can equal self or r2.