RSuperellipse class
An immutable rounded superellipse.
A rounded superellipse (not to be confused with a standard superellipse) is a shape formed by replacing the four curved corners of a superellipse with circular arcs. A (standard) superellipse follows the formula x^n + y^n = a^n, and while n > 2 gives it rounded corners, they tend to be too sharp and pronounced. Replacing them with circular arcs makes the shape feel softer and more natural.
Visually, a rounded superellipse looks similar to a typical rounded rectangle
(RRect) but with smoother transitions between the straight edges and
corners. It closely matches the RoundedRectangle shape in SwiftUI with the
.continuous corner style.
Constructors
- RSuperellipse.fromLTRBAndCorners(double left, double top, double right, double bottom, {Radius topLeft = Radius.zero, Radius topRight = Radius.zero, Radius bottomRight = Radius.zero, Radius bottomLeft = Radius.zero})
- Construct a rounded rectangle from its left, top, right, and bottom edges, and topLeft, topRight, bottomRight, and bottomLeft radii.
- RSuperellipse.fromLTRBR(double left, double top, double right, double bottom, Radius radius)
- Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in each corner.
- RSuperellipse.fromLTRBXY(double left, double top, double right, double bottom, double radiusX, double radiusY)
-
Construct a rounded rectangle from its left, top, right, and bottom edges,
and the same radii along its horizontal axis and its vertical axis.
const
- RSuperellipse.fromRectAndCorners(Rect rect, {Radius topLeft = Radius.zero, Radius topRight = Radius.zero, Radius bottomRight = Radius.zero, Radius bottomLeft = Radius.zero})
- Construct a rounded rectangle from its bounding box and topLeft, topRight, bottomRight, and bottomLeft radii.
- RSuperellipse.fromRectAndRadius(Rect rect, Radius radius)
- Construct a rounded rectangle from its bounding box and a radius that is the same in each corner.
- RSuperellipse.fromRectXY(Rect rect, double radiusX, double radiusY)
- Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis and its vertical axis.
Properties
- blRadius → Radius
-
The bottom-left Radius.
no setterinherited
- blRadiusX → double
-
The bottom-left horizontal radius.
finalinherited
- blRadiusY → double
-
The bottom-left vertical radius.
finalinherited
- bottom → double
-
The offset of the bottom edge of this rectangle from the y axis.
finalinherited
- brRadius → Radius
-
The bottom-right Radius.
no setterinherited
- brRadiusX → double
-
The bottom-right horizontal radius.
finalinherited
- brRadiusY → double
-
The bottom-right vertical radius.
finalinherited
- center → Offset
-
The offset to the point halfway between the left and right and the top and
bottom edges of this rectangle.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasNaN → bool
-
Whether any of the dimensions are
NaN.no setterinherited - height → double
-
The distance between the top and bottom edges of this rectangle.
no setterinherited
- isCircle → bool
-
Whether this rounded rectangle would draw as a circle.
no setterinherited
- isEllipse → bool
-
Whether this rounded rectangle has no side with a straight section.
no setterinherited
- isEmpty → bool
-
Whether this rounded rectangle encloses a non-zero area.
Negative areas are considered empty.
no setterinherited
- isFinite → bool
-
Whether all coordinates of this rounded rectangle are finite.
no setterinherited
- isRect → bool
-
Whether this rounded rectangle is a simple rectangle with zero
corner radii.
no setterinherited
- isStadium → bool
-
Whether this rounded rectangle has a side with no straight section.
no setterinherited
- left → double
-
The offset of the left edge of this rectangle from the x axis.
finalinherited
- longestSide → double
-
The greater of the magnitudes of the
widthand theheightof this rounded rectangle.no setterinherited - middleRect → Rect
-
The rectangle that would be formed using the axis-aligned intersection of
the sides of the rectangle, i.e., the rectangle formed from the
inner-most centers of the ellipses that form the corners. This is the
intersection of the
wideMiddleRectand thetallMiddleRect. If any of the intersections are void, the resulting Rect will have negative width or height.no setterinherited - outerRect → Rect
-
The bounding box of this rounded rectangle (the rectangle with no rounded corners).
no setterinherited
- right → double
-
The offset of the right edge of this rectangle from the x axis.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- safeInnerRect → Rect
-
The non-rounded rectangle that is constrained by the smaller of the two
diagonals, with each diagonal traveling through the middle of the curve
corners. The middle of a corner is the intersection of the curve with its
respective quadrant bisector.
no setterinherited
- shortestSide → double
-
The lesser of the magnitudes of the
widthand theheightof this rounded rectangle.no setterinherited - tallMiddleRect → Rect
-
The biggest rectangle that is entirely inside the rounded rectangle and
has the full height of the rounded rectangle. If the rounded rectangle
does not have an axis-aligned intersection of its top and bottom side, the
resulting Rect will have negative width or height.
no setterinherited
- tlRadius → Radius
-
The top-left Radius.
no setterinherited
- tlRadiusX → double
-
The top-left horizontal radius.
finalinherited
- tlRadiusY → double
-
The top-left vertical radius.
finalinherited
- top → double
-
The offset of the top edge of this rectangle from the y axis.
finalinherited
- trRadius → Radius
-
The top-right Radius.
no setterinherited
- trRadiusX → double
-
The top-right horizontal radius.
finalinherited
- trRadiusY → double
-
The top-right vertical radius.
finalinherited
- wideMiddleRect → Rect
-
The biggest rectangle that is entirely inside the rounded rectangle and
has the full width of the rounded rectangle. If the rounded rectangle does
not have an axis-aligned intersection of its left and right side, the
resulting Rect will have negative width or height.
no setterinherited
- width → double
-
The distance between the left and right edges of this rectangle.
no setterinherited
Methods
-
contains(
Offset point) → bool - Whether the point specified by the given offset (which is assumed to be relative to the origin) lies inside the rounded superellipse.
-
deflate(
double delta) → RSuperellipse -
Returns a clone with edges and radii moved inwards by the given delta.
inherited
-
inflate(
double delta) → RSuperellipse -
Returns a clone with edges and radii moved outwards by the given
delta.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
scaleRadii(
) → RSuperellipse -
Scales all radii so that on each side their sum will not exceed the size
of the width/height.
inherited
-
shift(
Offset offset) → RSuperellipse -
Returns a clone translated by the given offset.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
lerp(
RSuperellipse? a, RSuperellipse? b, double t) → RSuperellipse? - Linearly interpolate between two rounded superellipses.
Constants
- zero → const RSuperellipse
- A rounded rectangle with all the values set to zero.