GRect class
A GRect represents a rectangular area in 2D space, with a position (x, y) and a size (width, height).
- Available Extensions
Constructors
Properties
- bottom ↔ double
-
Returns the y-coordinate of the bottom edge of the rectangle.
getter/setter pair
- corners ↔ GRectCornerRadius?
-
Returns the GRectCornerRadius instance that describes the corner radii
of this GRect.
getter/setter pair
- hasCorners → bool
-
Returns true if GRect has custom corners.
Used for Rectangles with rounded corners.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ double
-
The height of the rectangle.
getter/setter pair
- isEmpty → bool
-
Determines whether or not this GRect object is empty.
no setter
- left ↔ double
-
The x coordinate of the top-left corner of the rectangle.
getter/setter pair
- right ↔ double
-
The sum of the x and width properties.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- top ↔ double
-
The y coordinate of the top-left corner of the rectangle.
getter/setter pair
- width ↔ double
-
The width of the rectangle.
getter/setter pair
- x ↔ double
-
The x position of the top-left corner of the rectangle.
getter/setter pair
- y ↔ double
-
The y position of the top-left corner of the rectangle.
getter/setter pair
Methods
-
clone(
) → GRect - Returns a new GRect object with the same values for the x, y, width, and height properties as the original GRect object.
-
contains(
double x, double y) → bool -
Determines whether the specified
x
andy
coordinates are contained within the rectangular region defined by this GRect object. -
containsPoint(
GPoint point) → bool - Determines whether the specified GPoint is contained within the rectangular region defined by this GRect object.
-
containsRect(
GRect rect) → bool -
Determines whether the
rect
object is contained within this object. A Rectangle is said to contain another if the second Rectangle falls entirely within the boundaries of the first. -
copyFrom(
GRect sourceRect) → GRect -
Sets the properties of this GRect to be equal to those of the
sourceRect
. -
equals(
GRect? toCompare) → bool -
Determines whether
toCompare
parameter is equal to this object. This method compares the x, y, width, and height properties of an object against the same properties of this object. -
expandToInclude(
GRect other) → GRect -
Similar to GRect.union, adds
other
to this object to create a new GRect object, by filling in the horizontal and vertical space between the two rectangles. -
getBounds(
GMatrix matrix, [GRect? out]) → GRect -
Returns the bounds of this GRect when transformed by the given
matrix
, optionally storing the result in the givenout
parameter. -
getPositions(
[List< GPoint> ? out]) → List<GPoint> -
Returns a list of four
GPoint
instances representing the positions of the top-left, top-right, bottom-right, and bottom-left corners of this GRect. -
inflate(
double dx, double dy) → GRect -
Increases the size of the GRect object by the specified amounts, in
pixels. The center point of the Rectangle object stays the same, and its
size increases to the left and right by the
dx
value, and to the top and the bottom by thedy
value. -
inflatePoint(
GPoint point) → GRect -
Increases the size of the GRect object. This method is similar to the
GRect.inflate method except it takes a
point
object as a parameter. -
intersection(
GRect toIntersect) → GRect -
If the GRect object specified in the
toIntersect
parameter intersects with this GRect object, returns the area of intersection as a GRect object. -
intersects(
GRect rect) → bool -
Determines whether the object specified in the
rect
parameter intersects with this GRect object. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
offset(
double dx, double dy) → GRect -
Translates the rectangle's position by the specified
dx
anddy
values. Determined by its top-left corner, by the specified amounts. -
offsetPoint(
GPoint point) → GRect -
Offsets the rectangle's x and y values by the corresponding x and y values
of the given
point
. Returns this GRect after the offset is applied. -
setEmpty(
) → GRect - Sets the values of the GRect to (0,0,0,0) to make it an empty rectangle. Returns the modified GRect object.
-
setTo(
double x, double y, double width, double height) → GRect - Sets the x, y, width, and height values of this GRect instance to the specified values.
-
toNative(
) → Rect - Returns a dart Rect instance based on this GRect x,y,width,height
-
toRoundNative(
) → RRect - Converts the GRect to a rounded native RRect using the corners specified in the GRectCornerRadius class, or null for a rectangular RRect, and returns the native RRect instance.
-
toString(
) → String -
Builds and returns a string that lists the horizontal and vertical
positions and the width and height of the Rectangle object.
override
-
union(
GRect toUnion) → GRect -
Adds two rectangles together to create a new GRect object, by
filling in the horizontal and vertical space between the two
rectangles.
Note: The union method ignores rectangles with 0 as the
height or width value, such as:
var rect2:Rectangle = new Rectangle(300,300,50,0);
Operators
-
operator *(
double scale) → GRect -
Scales the GRect object on x, y, width, height by the
scale
factor. -
operator /(
double scale) → GRect -
Divides the GRect object on x, y, width, height by the
scale
factor. -
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromNative(
Rect nativeRect) → GRect - Creates a new GRect object based on the Rect counterpart.
-
fromRoundNative(
RRect nativeRect) → GRect -
Creates a GxRect from a
RRect
assigning theGxRectCornerRadius
properties from the tr, tl, br, bl radiusX axis.