pub struct RoundedRect {
pub rect: Rect,
pub radii_top_left: Vector,
pub radii_top_right: Vector,
pub radii_bottom_left: Vector,
pub radii_bottom_right: Vector,
}Expand description
Represents a rectangle with per-corner radii.
Fields§
§rect: Rect§radii_top_left: Vector§radii_top_right: Vector§radii_bottom_left: Vector§radii_bottom_right: VectorImplementations§
Source§impl RoundedRect
impl RoundedRect
Sourcepub const fn new(
rect: Rect,
radii_top_left: Vector,
radii_top_right: Vector,
radii_bottom_right: Vector,
radii_bottom_left: Vector,
) -> Self
pub 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.
Sourcepub const fn from_radii(
rect: Rect,
radius_top_left: f64,
radius_top_right: f64,
radius_bottom_right: f64,
radius_bottom_left: f64,
) -> Self
pub 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.
Sourcepub const fn from_uniform_radii(rect: Rect, radii: Vector) -> Self
pub const fn from_uniform_radii(rect: Rect, radii: Vector) -> Self
Initializes a RoundedRect with the same elliptical radii on every corner.
Sourcepub const fn from_radius_xy(rect: Rect, radius_x: f64, radius_y: f64) -> Self
pub 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.
Sourcepub const fn from_radius(rect: Rect, radius: f64) -> Self
pub const fn from_radius(rect: Rect, radius: f64) -> Self
Initializes a RoundedRect with the same circular radius on every corner.
Sourcepub const fn from_rect(rect: Rect) -> Self
pub const fn from_rect(rect: Rect) -> Self
Initializes a RoundedRect without rounded corners.
Sourcepub const fn from_corner_radius(bounds: Rect, radius: CornerRadius) -> Self
pub const fn from_corner_radius(bounds: Rect, radius: CornerRadius) -> Self
Initializes a RoundedRect from bounds and a CornerRadius.
pub fn equals(&self, other: RoundedRect) -> bool
Sourcepub fn is_rounded(&self) -> bool
pub fn is_rounded(&self) -> bool
Gets a value indicating whether any corner has a non-zero radius.
Sourcepub fn is_uniform(&self) -> bool
pub fn is_uniform(&self) -> bool
Gets a value indicating whether all corners have the same radii.
pub fn inflate(&self, dx: f64, dy: f64) -> RoundedRect
pub fn deflate(&self, dx: f64, dy: f64) -> RoundedRect
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&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.
Sourcepub fn contains_exclusive(&self, p: Point) -> bool
pub fn contains_exclusive(&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§
Source§impl BatchValue for RoundedRect
impl BatchValue for RoundedRect
Source§impl Clone for RoundedRect
impl Clone for RoundedRect
impl Copy for RoundedRect
Source§impl Debug for RoundedRect
impl Debug for RoundedRect
Source§impl Default for RoundedRect
impl Default for RoundedRect
Source§impl From<Rect> for RoundedRect
impl From<Rect> for RoundedRect
Source§fn from(r: Rect) -> RoundedRect
fn from(r: Rect) -> RoundedRect
Source§impl MarkupTyped for RoundedRect
impl MarkupTyped for RoundedRect
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Source§impl PartialEq for RoundedRect
impl PartialEq 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> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more