Rect Class Reference

Class defining a 2D rectangle with top-left corner coordinates and width/height in pixels. More...

Functions

int width (self)
 Width of the rectangle in pixels.
 
int height (self)
 Height of the rectangle in pixels.
 
int x (self)
 x coordinates of top-left corner.
 
int y (self)
 y coordinates of top-left corner.
 
int area (self)
 Returns the area of the rectangle.
 
bool is_empty (self)
 Tests if the given sl.Rect is empty (width or/and height is null).
 
bool contains (self, Rect target, proper=False)
 Tests if this sl.Rect contains the target sl.Rect. More...
 
bool is_contained (self, Rect target, proper=False)
 Tests if this sl.Rect is contained inside the given target sl.Rect. More...
 

Detailed Description

Class defining a 2D rectangle with top-left corner coordinates and width/height in pixels.

Functions

◆ contains()

bool contains (   self,
Rect  target,
  proper = False 
)

Tests if this sl.Rect contains the target sl.Rect.

Returns
True if this rectangle contains the <target> rectangle, otherwise False.
Note
This method only returns true if the target rectangle is entirely inside this rectangle (not on the edge).

◆ is_contained()

bool is_contained (   self,
Rect  target,
  proper = False 
)

Tests if this sl.Rect is contained inside the given target sl.Rect.

Returns
True if this rectangle is inside the current target sl.Rect, otherwise False.
Note
This method only returns True if this rectangle is entirely inside the <target> rectangle (not on the edge).