RoundedRect
struct · ferroui-base · v0.5.0
struct RoundedRect
Represents a rectangle with per-corner radii.
Members
rectradii_top_leftradii_top_rightradii_bottom_leftradii_bottom_rightnewfrom_radiifrom_uniform_radiifrom_radius_xyfrom_radiusfrom_rectfrom_corner_radiusequalsis_roundedis_uniforminflatedeflateis_emptycontains_exclusive
rect
rect: crate::Rect
radii_top_left
radii_top_left: crate::Vector
radii_top_right
radii_top_right: crate::Vector
radii_bottom_left
radii_bottom_left: crate::Vector
radii_bottom_right
radii_bottom_right: crate::Vector
new
const fn new(rect: Rect, radii_top_left: Vector, radii_top_right: Vector, radii_bottom_right: Vector, radii_bottom_left: Vector) -> Self
Initializes a RoundedRect from elliptical corner radii, clockwise from the top left.
from_radii
const fn from_radii(rect: Rect, radius_top_left: f64, radius_top_right: f64, radius_bottom_right: f64, radius_bottom_left: f64) -> Self
Initializes a RoundedRect from circular corner radii, clockwise from the top left.
from_uniform_radii
const fn from_uniform_radii(rect: Rect, radii: Vector) -> Self
Initializes a RoundedRect with the same elliptical radii on every corner.
from_radius_xy
const fn from_radius_xy(rect: Rect, radius_x: f64, radius_y: f64) -> Self
Initializes a RoundedRect with the same X and Y radius on every corner.
from_radius
const fn from_radius(rect: Rect, radius: f64) -> Self
Initializes a RoundedRect with the same circular radius on every corner.
from_rect
const fn from_rect(rect: Rect) -> Self
Initializes a RoundedRect without rounded corners.
from_corner_radius
const fn from_corner_radius(bounds: Rect, radius: CornerRadius) -> Self
Initializes a RoundedRect from bounds and a CornerRadius.
equals
fn equals(self: &Self, other: RoundedRect) -> bool
is_rounded
fn is_rounded(self: &Self) -> bool
Gets a value indicating whether any corner has a non-zero radius.
is_uniform
fn is_uniform(self: &Self) -> bool
Gets a value indicating whether all corners have the same radii.
inflate
fn inflate(self: &Self, dx: f64, dy: f64) -> RoundedRect
deflate
fn deflate(self: &Self, dx: f64, dy: f64) -> RoundedRect
is_empty
fn is_empty(self: &Self) -> bool
This method should be used internally to check for the rect emptiness. Once a dedicated "empty" value exists this is the single place to update.
contains_exclusive
fn contains_exclusive(self: &Self, p: Point) -> bool
Determines whether a point is inside the rounded rectangle, exclusive of the bottom/right edge. Elliptical corners are approximated by circles using the smaller of the two radii.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherBatchValueMarkupTypedValueTypeRegistrationCloneCopyDebugStructuralPartialEqPartialEqDefaultFrom<Rect>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.