GRect extends GObject
A graphical representation of a rectangle.
Note
Don't confuse GRect with GRectangle. The former is a GObject that you can add to a GWindow; the latter is a utility type that stores a GObject's bounding box, and cannot be added to a GWindow.
Factory Functions
- function GRect(width, height)
- function GRect(x, y, width, height)
- Creates a new GRect of a given width and height. The object's x and y coordinates can also be specified — if left unspecified, defaults to 0, 0.
Methods
Warning
These functions will all throw an error if this object has been transformed by GObject::rotate, GObject::scale, GObject::shear, or GObject::translate.
- function GRect::setSize(object)
- Sets this GRect's width/height to match that of the passed-in object of type GRectangle or GObject.
- function GRect::setSize(width, height)
- Sets this GRect's width and height as specified.
- function GRect::setBounds(object)
- Sets this GRect's x/y/width/height to match that of the passed-in object of type GRectangle or GObject.
- function GRect::setBounds(positionObject, sizeObject)
- Sets this GOval's x/y to match that of the passed-in positionObject, and its width/height to match that of the passed-in sizeObject.
- These objects should be of type GRectangle or GObject. Additionally, positionObject can be a GPoint, and positionObject can be a GDimension.
- function GRect::setBounds(x, y, width, height)
- Sets this GOval's x, y, width, and height as specified.