pub struct RoundedRect { /* private fields */ }
Expand description
A rectangle with equally rounded corners.
By construction the rounded rectangle will have non-negative dimensions and radii clamped to half size of the rect.
The easiest way to create a RoundedRect
is often to create a Rect
,
and then call to_rounded_rect
.
use kurbo::{RoundedRect, RoundedRectRadii};
// Create a rounded rectangle with a single radius for all corners:
RoundedRect::new(0.0, 0.0, 10.0, 10.0, 5.0);
// Or, specify different radii for each corner, clockwise from the top-left:
RoundedRect::new(0.0, 0.0, 10.0, 10.0, (1.0, 2.0, 3.0, 4.0));
Implementations§
source§impl RoundedRect
impl RoundedRect
sourcepub fn new(
x0: f64,
y0: f64,
x1: f64,
y1: f64,
radii: impl Into<RoundedRectRadii>,
) -> RoundedRect
pub fn new( x0: f64, y0: f64, x1: f64, y1: f64, radii: impl Into<RoundedRectRadii>, ) -> RoundedRect
A new rectangle from minimum and maximum coordinates.
The result will have non-negative width, height and radii.
sourcepub fn from_rect(rect: Rect, radii: impl Into<RoundedRectRadii>) -> RoundedRect
pub fn from_rect(rect: Rect, radii: impl Into<RoundedRectRadii>) -> RoundedRect
A new rounded rectangle from a rectangle and corner radii.
The result will have non-negative width, height and radii.
See also Rect::to_rounded_rect
, which offers the same utility.
sourcepub fn from_points(
p0: impl Into<Point>,
p1: impl Into<Point>,
radii: impl Into<RoundedRectRadii>,
) -> RoundedRect
pub fn from_points( p0: impl Into<Point>, p1: impl Into<Point>, radii: impl Into<RoundedRectRadii>, ) -> RoundedRect
A new rectangle from two Point
s.
The result will have non-negative width, height and radius.
sourcepub fn from_origin_size(
origin: impl Into<Point>,
size: impl Into<Size>,
radii: impl Into<RoundedRectRadii>,
) -> RoundedRect
pub fn from_origin_size( origin: impl Into<Point>, size: impl Into<Size>, radii: impl Into<RoundedRectRadii>, ) -> RoundedRect
A new rectangle from origin and size.
The result will have non-negative width, height and radius.
sourcepub fn radii(&self) -> RoundedRectRadii
pub fn radii(&self) -> RoundedRectRadii
Radii of the rounded corners.
Trait Implementations§
source§impl Add<Vec2> for RoundedRect
impl Add<Vec2> for RoundedRect
source§type Output = RoundedRect
type Output = RoundedRect
+
operator.source§impl Clone for RoundedRect
impl Clone for RoundedRect
source§fn clone(&self) -> RoundedRect
fn clone(&self) -> RoundedRect
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for RoundedRect
impl Debug for RoundedRect
source§impl Default for RoundedRect
impl Default for RoundedRect
source§fn default() -> RoundedRect
fn default() -> RoundedRect
source§impl Mul<RoundedRect> for TranslateScale
impl Mul<RoundedRect> for TranslateScale
source§type Output = RoundedRect
type Output = RoundedRect
*
operator.source§fn mul(self, other: RoundedRect) -> RoundedRect
fn mul(self, other: RoundedRect) -> RoundedRect
*
operation. Read moresource§impl PartialEq for RoundedRect
impl PartialEq for RoundedRect
source§impl Shape for RoundedRect
impl Shape for RoundedRect
source§type PathElementsIter<'iter> = RoundedRectPathIter
type PathElementsIter<'iter> = RoundedRectPathIter
path_elements
method.source§fn path_elements(&self, tolerance: f64) -> RoundedRectPathIter
fn path_elements(&self, tolerance: f64) -> RoundedRectPathIter
source§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
source§fn as_rounded_rect(&self) -> Option<RoundedRect>
fn as_rounded_rect(&self) -> Option<RoundedRect>
source§fn into_path(self, tolerance: f64) -> BezPathwhere
Self: Sized,
fn into_path(self, tolerance: f64) -> BezPathwhere
Self: Sized,
source§fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
source§impl Sub<Vec2> for RoundedRect
impl Sub<Vec2> for RoundedRect
source§type Output = RoundedRect
type Output = RoundedRect
-
operator.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 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)