pub struct RoundedRect {
pub rect: Rect,
pub radii: Corners<Size>,
}Expand description
A rectangle with independently rounded corners.
Used throughout the platform for border-radius rendering, clipping
regions, and hit testing. Each corner has its own elliptical radius
defined as a Size (horizontal × vertical), supporting non-circular
corners like border-radius: 20px / 10px.
When all four radii are zero this degenerates to a plain Rect.
Fields§
§rect: Rect§radii: Corners<Size>Implementations§
Source§impl RoundedRect
impl RoundedRect
pub fn new(rect: Rect, radii: Corners<Size>) -> Self
Sourcepub fn from_rect(rect: Rect) -> Self
pub fn from_rect(rect: Rect) -> Self
A rounded rect with no rounding — equivalent to a plain rect.
Sourcepub fn uniform(rect: Rect, radius: f32) -> Self
pub fn uniform(rect: Rect, radius: f32) -> Self
All four corners share the same circular radius.
Sourcepub fn is_ellipse(&self) -> bool
pub fn is_ellipse(&self) -> bool
True when the rounded rect forms a full ellipse/circle (each corner’s radius is exactly half the rect’s dimension).
Sourcepub fn normalized(self) -> Self
pub fn normalized(self) -> Self
Scale radii down proportionally when the sum of adjacent radii exceeds the rect’s dimension. This implements the CSS spec’s corner-overlap rule.
Trait Implementations§
Source§impl Clone for RoundedRect
impl Clone for RoundedRect
Source§fn clone(&self) -> RoundedRect
fn clone(&self) -> RoundedRect
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RoundedRect
impl Debug for RoundedRect
Source§impl PartialEq for RoundedRect
impl PartialEq for RoundedRect
impl Copy for RoundedRect
impl StructuralPartialEq for RoundedRect
Auto Trait Implementations§
impl Freeze for RoundedRect
impl RefUnwindSafe for RoundedRect
impl Send for RoundedRect
impl Sync for RoundedRect
impl Unpin for RoundedRect
impl UnsafeUnpin for RoundedRect
impl UnwindSafe for RoundedRect
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
Mutably borrows from an owned value. Read more