Gegl.Rectangle

Fields

Name

Type

Access

Description

height

int

r/w

width

int

r/w

x

int

r/w

y

int

r/w

Methods

class

infinite_plane ()

class

new (x, y, width, height)

align (rectangle, tile, alignment)

align_to_buffer (rectangle, buffer, alignment)

bounding_box (source1, source2)

contains (child)

copy (source)

dump ()

dup ()

equal (rectangle2)

equal_coords (x, y, width, height)

intersect (src1, src2)

is_empty ()

is_infinite_plane ()

set (x, y, width, height)

subtract (minuend, subtrahend)

subtract_bounding_box (minuend, subtrahend)

xor (source1, source2)

Details

class Gegl.Rectangle
classmethod infinite_plane()
Return type:

Gegl.Rectangle

Returns a Gegl.Rectangle that represents an infininte plane.

classmethod new(x, y, width, height)
Parameters:
  • x (int) – upper left x coordinate

  • y (int) – upper left y coordinate

  • width (int) – width in pixels.

  • height (int) – height in pixels.

Return type:

Gegl.Rectangle

Creates a new rectangle set with the values from x, y, width and height.

align(rectangle, tile, alignment)
Parameters:
Return type:

bool

Aligns rectangle to a regular tile grid, of which tile is a representative tile, and stores the result in self.

alignment can be one of:

Gegl.RectangleAlignment.SUBSET: Calculate the biggest aligned rectangle contained in rectangle.

Gegl.RectangleAlignment.SUPERSET: Calculate the smallest aligned rectangle containing rectangle.

Gegl.RectangleAlignment.NEAREST: Calculate the nearest aligned rectangle to rectangle.

self may point to the same object as rectangle or tile.

Returns True if the result is not empty.

align_to_buffer(rectangle, buffer, alignment)
Parameters:
Return type:

bool

Aligns rectangle to the tile grid of buffer, and stores the result in self.

alignment has the same meaning as for Gegl.Rectangle.align().

self may point to the same object as rectangle.

Returns True if the result is not empty.

bounding_box(source1, source2)
Parameters:

Computes the bounding box of the rectangles source1 and source2 and stores the resulting bounding box in self.

self may point to the same object as source1 or source2.

contains(child)
Parameters:

child (Gegl.Rectangle) – a Gegl.Rectangle

Return type:

bool

Checks if the Gegl.Rectangle child is fully contained within self.

Returns True if the child is fully contained in self.

copy(source)
Parameters:

source (Gegl.Rectangle) – a Gegl.Rectangle

Copies the rectangle information stored in source over the information in self.

self may point to the same object as source.

dump()

For debugging purposes, not stable API.

dup()
Returns:

a Gegl.Rectangle

Return type:

Gegl.Rectangle

Create a new copy of self.

equal(rectangle2)
Parameters:

rectangle2 (Gegl.Rectangle) – a Gegl.Rectangle

Return type:

bool

Check if two Gegl.Rectangles are equal.

Returns True if rectangle and rectangle2 are equal.

equal_coords(x, y, width, height)
Parameters:
  • x (int) – X coordinate

  • y (int) – Y coordinate

  • width (int) – width of rectangle

  • height (int) – height of rectangle

Return type:

bool

Check if a rectangle is equal to a set of parameters.

Returns True if self and x,`y` width x height are equal.

intersect(src1, src2)
Parameters:
Return type:

bool

Calculates the intersection of two rectangles. If the rectangles do not intersect, dest’s width and height are set to 0 and its x and y values are undefined.

self may point to the same object as src1 or src2.

Returns True if the rectangles intersect.

is_empty()
Return type:

bool

Check if a rectangle has zero area.

Returns True if the width or height of self is 0.

is_infinite_plane()
Return type:

bool

Returns True if the Gegl.Rectangle represents an infininte plane, False otherwise.

set(x, y, width, height)
Parameters:
  • x (int) – upper left x coordinate

  • y (int) – upper left y coordinate

  • width (int) – width in pixels.

  • height (int) – height in pixels.

Sets the x, y, width and height on self.

subtract(minuend, subtrahend)
Parameters:
Return type:

int

Subtracts subtrahend from minuend, and stores the resulting rectangles in self. Between 0 and 4 disjoint rectangles may be produced.

self may contain minuend or subtrahend.

Returns the number of resulting rectangles.

subtract_bounding_box(minuend, subtrahend)
Parameters:
Return type:

bool

Computes the bounding box of the area formed by subtracting subtrahend from minuend, and stores the result in self.

self may point to the same object as minuend or subtrahend.

Returns True if the result is not empty.

xor(source1, source2)
Parameters:
Return type:

int

Computes the symmetric difference of the rectangles source1 and source2, and stores the resulting rectangles in self. Between 0 and 4 disjoint rectangles may be produced.

self may contain rectangle1 or rectangle2.

Returns the number of resulting rectangles.