RectI — Natron 2.5.0 documentation

# RectI

## Synopsis

A rectangle defined with integer precision. See detailed description below

### Functions

- def `bottom` ()

- def `clear` ()

- def `contains` (otherRect)

- def `height` ()

- def `intersect` (otherRect)

- def `intersects` (otherRect)

- def `isInfinite` ()

- def `isNull` ()

- def `left` ()

- def `merge` (otherRect)

- def `right` ()

- def `set` (x1,y1,x2,y2)

- def `set_bottom` (y1)

- def `set_left` (x1)

- def `set_right` (x2)

- def `set_top` (y2)

- def `top` ()

- def `translate` (dx,dy)

- def `width` ()

## Detailed Description

A rectangle where x1 < x2 and y1 < y2 such as width() == (x2 - x1) && height() == (y2 - y1) (x1,y1) is are the coordinates of the bottom left corner of the rectangle. The last element valid in the y dimension is y2 - 1 and the last valid in the x dimension is x2 - 1. x1,x2,y1 and y2 are with integer precision.

### Member functions description

NatronEngine.RectI.bottom()
  Return type

    `int`

Returns the bottom edge, that is the

NatronEngine.RectI.clear()

Same as `set` (0,0,0,0)

NatronEngine.RectI.contains(otherRect)
  Parameters

    otherRect – `RectI`

  Return type

    `bool`

Returns True if otherRect is contained in or equals this rectangle, that is if:

    otherRect.x1 >= x1 and
    otherRect.y1 >= y1 and
    otherRect.x2 <= x2 and
    otherRect.y2 <= y2

NatronEngine.RectI.height()
  Return type

    `int`

Returns the height of the rectangle, that is: y2 - y1

NatronEngine.RectI.intersect(otherRect)
  Parameters

    otherRect – `RectI`

  Return type

    `RectI`

Returns the intersection between this rectangle and otherRect. If the intersection is empty, the return value will have the `isNull()` function return True.

NatronEngine.RectI.intersects(otherRect)
  Parameters

    otherRect – `RectI`

  Return type

    `bool`

Returns True if rectangle and otherRect intersect.

NatronEngine.RectI.isInfinite()
  Return type

    `bool`

Returns True if this rectangle is considered to cover an infinite area. Some generator effects use this to indicate that they can potentially generate an image of infinite size.

NatronEngine.RectI.isNull()
  Return type

    `bool`

Returns true if x2 <= x1 or y2 <= y1

NatronEngine.RectI.left()
  Return type

    `int`

Returns x1, that is the position of the left edge of the rectangle.

NatronEngine.RectI.merge(otherRect)
  Parameters

    otherRect – `RectI`

Unions this rectangle with otherRect. In other words, this rectangle becomes the bounding box of this rectangle and otherRect.

NatronEngine.RectI.left()
  Return type

    `int`

Returns x1, that is the position of the left edge of the rectangle.

NatronEngine.RectI.right()
  Return type

    `int`

Returns x2, that is the position of the right edge of the rectangle. x2 is considered to be the first element outside the rectangle.

NatronEngine.RectI.set(x1, y1, x2, y2)
  Parameters

    - x1 – `int`

    - y1 – `int`

    - x2 – `int`

    - y2 – `int`

Set the x1, y1, x2, y2 coordinates of this rectangle.

NatronEngine.RectI.set_bottom(y1)
  Parameters

    y1 – `int`

Set y1

NatronEngine.RectI.set_left(x1)
  Parameters

    y1 – `int`

Set x1

NatronEngine.RectI.set_right(x2)
  Parameters

    x2 – `int`

Set x2

NatronEngine.RectI.set_top(y2)
  Parameters

    y2 – `int`

Set y2

NatronEngine.RectI.top()
  Return type

    `int`

Returns y2, that is the position of the top edge of the rectangle. y2 is considered to be the first element outside the rectangle.

NatronEngine.RectI.translate(dx, dy)
  Parameters

    - dx – `int`

    - dy – `int`

Moves all edges of the rectangle by dx, dy, that is:

    x1 += dx;
    y1 += dy;
    x2 += dx;
    y2 += dy;

NatronEngine.RectI.width()
  Return type

    `int`

Returns the width of the rectangle, that is x2 - x1.