pub struct RoundRect { /* private fields */ }Expand description
A rectangle with rounded corners. Unlike kurbo::RoundedRect this has one set of radii
shared between all corners, but it does support elliptical corners.
Implementations§
Source§impl RoundRect
impl RoundRect
Sourcepub fn new(x0: f64, y0: f64, x1: f64, y1: f64, rx: f64, ry: f64) -> Self
pub fn new(x0: f64, y0: f64, x1: f64, y1: f64, rx: f64, ry: f64) -> Self
Create a new rounded rectangle from minimum and maximum coordinates.
Sourcepub fn from_rect(rect: Rect, radii: impl Into<Vec2>) -> Self
pub fn from_rect(rect: Rect, radii: impl Into<Vec2>) -> Self
Create a new rounded rectangle from a kurbo::Rect and its radii.
Sourcepub fn from_points(
p0: impl Into<Point>,
p1: impl Into<Point>,
radii: impl Into<Vec2>,
) -> Self
pub fn from_points( p0: impl Into<Point>, p1: impl Into<Point>, radii: impl Into<Vec2>, ) -> Self
Create a new rounded rectangle from two points and its radii.
Sourcepub fn from_origin_size(
origin: impl Into<Point>,
size: impl Into<Size>,
radii: impl Into<Vec2>,
) -> Self
pub fn from_origin_size( origin: impl Into<Point>, size: impl Into<Size>, radii: impl Into<Vec2>, ) -> Self
Create a new rounded rectangle from its origin point, size, and radii.
Sourcepub fn from_center_size(
origin: impl Into<Point>,
size: impl Into<Size>,
radii: impl Into<Vec2>,
) -> Self
pub fn from_center_size( origin: impl Into<Point>, size: impl Into<Size>, radii: impl Into<Vec2>, ) -> Self
Create a new rounded rectangle from its center point, size, and radii.
Sourcepub const fn rect(&self) -> Rect
pub const fn rect(&self) -> Rect
Returns a rectangle with the same position and size as the rounded rectangle
Sourcepub fn with_origin(self, origin: impl Into<Point>) -> Self
pub fn with_origin(self, origin: impl Into<Point>) -> Self
Returns a copy of the rounded rectangle with a new origin point
Sourcepub fn with_size(self, size: impl Into<Size>) -> Self
pub fn with_size(self, size: impl Into<Size>) -> Self
Returns a copy of the rounded rectangle with a new size
Sourcepub fn with_radii(self, radii: impl Into<Vec2>) -> Self
pub fn with_radii(self, radii: impl Into<Vec2>) -> Self
Returns a copy of the rounded rectangle with new radii
Trait Implementations§
Source§impl Shape for RoundRect
impl Shape for RoundRect
Source§type PathElementsIter<'iter> = RoundRectPathIter
type PathElementsIter<'iter> = RoundRectPathIter
The iterator returned by the
path_elements method.Source§fn path_elements(&self, tolerance: f64) -> RoundRectPathIter
fn path_elements(&self, tolerance: f64) -> RoundRectPathIter
Source§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
The smallest rectangle that encloses the shape.
Source§fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>>
fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>>
Source§fn as_rounded_rect(&self) -> Option<RoundedRect>
fn as_rounded_rect(&self) -> Option<RoundedRect>
If the shape is a rounded rectangle, make it available.
impl Copy for RoundRect
Auto Trait Implementations§
impl Freeze for RoundRect
impl RefUnwindSafe for RoundRect
impl Send for RoundRect
impl Sync for RoundRect
impl Unpin for RoundRect
impl UnwindSafe for RoundRect
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