pub struct RoundedRect {
    rect: Rect,
    radii: RoundedRectRadii,
}Expand description
A rectangle with rounded corners.
By construction the rounded rectangle will have non-negative dimensions and radii clamped to half size of the rect. The rounded rectangle can have different radii for each corner.
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));Fields§
§rect: RectCoordinates of the rectangle.
radii: RoundedRectRadiiRadius of all four corners.
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 Points.
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<'de> Deserialize<'de> for RoundedRect
 
impl<'de> Deserialize<'de> for RoundedRect
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
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 Serialize for RoundedRect
 
impl Serialize 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.