Rect

From Silhouette Wiki
Revision as of 20:30, 18 November 2012 by Paul (talk | contribs) (Created page with "== Rect == A Rect is a 2D floating point rectangle. === Attributes === {| class="wikitable" ! scope="col" | Name ! scope="col" class="unsortable" | Description |- |left, x ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Rect

A Rect is a 2D floating point rectangle.

Attributes

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

Methods

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