From sfx
Jump to navigation Jump to search

A Rect is a 2D floating point rectangle.


Name Description
left, x Left edge, x coordinate
top, y Top edge, y coordinate
right Right edge
bottom Bottom edge
width Rectangle width (right - left)
height Rectangle height (bottom - top)
size Tuple of (width,height) read-only


Name Description
Rect(x, y, width, height) Constructs a new Rectangle
adjusted(dx1, dy1, dx2, dy2) Returns a new Rect adjusted by the respective dx,dy values
moveTo(x, y) Moves the top left corner of the rectangle to x, y
set(x, y, width, height) Sets the rectangle position and size
setSize(width, height) Resizes the rectangle to the new width and height
translate(dx, dy) Translates the rectangle by dx and dy
translated(dx, dy) Returns a new Rect translated by dx and dy