Rect class

A rectangle defined by two corner points, equivalent to PyMuPDF's fitz.Rect.

Coordinates are (x0, y0) for top-left and (x1, y1) for bottom-right.

Constructors

Rect(double x0, double y0, double x1, double y1)
const
Rect.fromList(List<num> list)
Create from a list x0, y0, x1, y1.
factory
Rect.fromPoints(Point topLeft, Point bottomRight)
Create from two Points.
factory

Properties

area double
Area of the rectangle.
no setter
bottomLeft Point
Bottom-left corner.
no setter
bottomRight Point
Bottom-right corner.
no setter
center Point
Center point.
no setter
hashCode int
The hash code for this object.
no setteroverride
height double
Height of the rectangle.
no setter
irect IRect
Convert to integer rect.
no setter
isEmpty bool
Whether this rectangle is empty.
no setter
isInfinite bool
Whether this rectangle is infinite.
no setter
normalized Rect
Normalize: ensure x0 <= x1 and y0 <= y1.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
topLeft Point
Top-left corner.
no setter
topRight Point
Top-right corner.
no setter
width double
Width of the rectangle.
no setter
x0 double
final
x1 double
final
y0 double
final
y1 double
final

Methods

contains(Point p) bool
Alias for containsPoint.
containsPoint(Point p) bool
Check if a point is inside this rectangle.
containsRect(Rect other) bool
Check if another rectangle is fully inside this rectangle.
includePoint(Point p) Rect
Include a point in the rectangle (expand to contain it).
intersect(Rect other) Rect
Intersection of two rectangles.
morph(Point fixpoint, List<double> matrix) Rect
Morph: apply a matrix about a given fixpoint.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overlaps(Rect other) bool
Check if this rectangle overlaps with another.
toList() List<double>
toString() String
A string representation of this object.
override
transform(List<double> matrix) Rect
Transform this rectangle using a matrix a, b, c, d, e, f.
union(Rect other) Rect
Union of two rectangles (smallest rect containing both).

Operators

operator &(Rect other) Rect
operator *(double factor) Rect
operator +(Rect other) Rect
operator ==(Object other) bool
The equality operator.
override

Constants

empty → const Rect
An empty rectangle.
infinite → const Rect
An infinite rectangle.