pub struct RSuperellipse {
pub left: f64,
pub top: f64,
pub right: f64,
pub bottom: f64,
pub tl_radius_x: f64,
pub tl_radius_y: f64,
pub tr_radius_x: f64,
pub tr_radius_y: f64,
pub br_radius_x: f64,
pub br_radius_y: f64,
pub bl_radius_x: f64,
pub bl_radius_y: f64,
}Expand description
Drawing a widget asks for: the filters an Image or BackdropFilter takes, a rounded or
superelliptical rectangle a clipper answers, and the alignment a WidgetSpan places its
placeholder by.
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.
Fields§
§left: f64The offset of the left edge of this rectangle from the x axis.
top: f64The offset of the top edge of this rectangle from the y axis.
right: f64The offset of the right edge of this rectangle from the x axis.
bottom: f64The offset of the bottom edge of this rectangle from the y axis.
tl_radius_x: f64The top-left horizontal radius.
tl_radius_y: f64The top-left vertical radius.
tr_radius_x: f64The top-right horizontal radius.
tr_radius_y: f64The top-right vertical radius.
br_radius_x: f64The bottom-right horizontal radius.
br_radius_y: f64The bottom-right vertical radius.
bl_radius_x: f64The bottom-left horizontal radius.
bl_radius_y: f64The bottom-left vertical radius.
Implementations§
Source§impl RSuperellipse
impl RSuperellipse
Sourcepub const ZERO: RSuperellipse
pub const ZERO: RSuperellipse
All values set to zero.
Sourcepub fn from_ltrbxy(
left: f64,
top: f64,
right: f64,
bottom: f64,
radius_x: f64,
radius_y: f64,
) -> RSuperellipse
pub fn from_ltrbxy( left: f64, top: f64, right: f64, bottom: f64, radius_x: f64, radius_y: f64, ) -> RSuperellipse
Construct from left, top, right, bottom, and the same radii along the horizontal axis and the vertical axis.
Sourcepub fn from_ltrbr(
left: f64,
top: f64,
right: f64,
bottom: f64,
radius: Radius,
) -> RSuperellipse
pub fn from_ltrbr( left: f64, top: f64, right: f64, bottom: f64, radius: Radius, ) -> RSuperellipse
Construct from left, top, right, bottom, and the same radius in each corner.
Sourcepub fn from_rect_xy(rect: Rect, radius_x: f64, radius_y: f64) -> RSuperellipse
pub fn from_rect_xy(rect: Rect, radius_x: f64, radius_y: f64) -> RSuperellipse
Construct from a bounding box and the same radii along each axis.
Sourcepub fn from_rect_and_radius(rect: Rect, radius: Radius) -> RSuperellipse
pub fn from_rect_and_radius(rect: Rect, radius: Radius) -> RSuperellipse
Construct from a bounding box and a radius that is the same in each corner.
Sourcepub fn from_ltrb_and_corners(
left: f64,
top: f64,
right: f64,
bottom: f64,
top_left: Radius,
top_right: Radius,
bottom_right: Radius,
bottom_left: Radius,
) -> RSuperellipse
pub fn from_ltrb_and_corners( left: f64, top: f64, right: f64, bottom: f64, top_left: Radius, top_right: Radius, bottom_right: Radius, bottom_left: Radius, ) -> RSuperellipse
Construct from left, top, right, bottom, and per-corner radii.
Sourcepub fn from_rect_and_corners(
rect: Rect,
top_left: Radius,
top_right: Radius,
bottom_right: Radius,
bottom_left: Radius,
) -> RSuperellipse
pub fn from_rect_and_corners( rect: Rect, top_left: Radius, top_right: Radius, bottom_right: Radius, bottom_left: Radius, ) -> RSuperellipse
Construct from a bounding box and per-corner radii.
Sourcepub fn shift(self, offset: Offset) -> RSuperellipse
pub fn shift(self, offset: Offset) -> RSuperellipse
Returns a clone translated by the given offset.
Sourcepub fn inflate(self, delta: f64) -> RSuperellipse
pub fn inflate(self, delta: f64) -> RSuperellipse
Returns a clone with edges and radii moved outwards by delta.
Sourcepub fn deflate(self, delta: f64) -> RSuperellipse
pub fn deflate(self, delta: f64) -> RSuperellipse
Returns a clone with edges and radii moved inwards by delta.
Sourcepub fn outer_rect(self) -> Rect
pub fn outer_rect(self) -> Rect
The bounding box of this rounded rectangle.
Sourcepub fn safe_inner_rect(self) -> Rect
pub fn safe_inner_rect(self) -> Rect
The non-rounded rectangle constrained by the smaller of the two diagonals through the middle of the curve corners.
Sourcepub fn middle_rect(self) -> Rect
pub fn middle_rect(self) -> Rect
The rectangle formed from the inner-most centers of the corner ellipses.
Sourcepub fn wide_middle_rect(self) -> Rect
pub fn wide_middle_rect(self) -> Rect
The biggest rectangle entirely inside with the full width.
Sourcepub fn tall_middle_rect(self) -> Rect
pub fn tall_middle_rect(self) -> Rect
The biggest rectangle entirely inside with the full height.
Sourcepub fn is_stadium(self) -> bool
pub fn is_stadium(self) -> bool
Whether this rounded rectangle has a side with no straight section.
Sourcepub fn is_ellipse(self) -> bool
pub fn is_ellipse(self) -> bool
Whether this rounded rectangle has no side with a straight section.
Sourcepub fn shortest_side(self) -> f64
pub fn shortest_side(self) -> f64
The lesser of the magnitudes of the width and the height.
Sourcepub fn longest_side(self) -> f64
pub fn longest_side(self) -> f64
The greater of the magnitudes of the width and the height.
Sourcepub fn center(self) -> Offset
pub fn center(self) -> Offset
The offset halfway between the left and right and the top and bottom edges.
Sourcepub fn scale_radii(self) -> RSuperellipse
pub fn scale_radii(self) -> RSuperellipse
Scales all radii so that on each side their sum will not exceed the width or height.
Sourcepub fn lerp(
a: Option<RSuperellipse>,
b: Option<RSuperellipse>,
t: f64,
) -> Option<RSuperellipse>
pub fn lerp( a: Option<RSuperellipse>, b: Option<RSuperellipse>, t: f64, ) -> Option<RSuperellipse>
Linearly interpolate between two rounded rectangles.
If either is null, this function substitutes ZERO.
Source§impl RSuperellipse
impl RSuperellipse
Sourcepub fn contains(self, point: Offset) -> bool
pub fn contains(self, point: Offset) -> bool
Whether the point specified by the given offset (which is assumed to be relative to the origin) lies inside the rounded superellipse.
Dart’s method is engine FFI (Impeller). Ours uses valo’s Impeller-port
valo_geometry::RoundSuperellipse::contains.
Trait Implementations§
Source§impl Clone for RSuperellipse
impl Clone for RSuperellipse
Source§fn clone(&self) -> RSuperellipse
fn clone(&self) -> RSuperellipse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for RSuperellipse
Source§impl Debug for RSuperellipse
impl Debug for RSuperellipse
Source§impl PartialEq for RSuperellipse
impl PartialEq for RSuperellipse
impl StructuralPartialEq for RSuperellipse
Auto Trait Implementations§
impl Forget for RSuperellipse
impl Freeze for RSuperellipse
impl Move for RSuperellipse
impl RefUnwindSafe for RSuperellipse
impl Send for RSuperellipse
impl Sync for RSuperellipse
impl Unpin for RSuperellipse
impl UnsafeUnpin for RSuperellipse
impl UnwindSafe for RSuperellipse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.