Struct druid::piet::kurbo::RoundedRect
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§
§impl RoundedRect
impl RoundedRect
pub 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.
pub 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.
pub 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.
pub 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.
pub fn radii(&self) -> RoundedRectRadii
pub fn radii(&self) -> RoundedRectRadii
Radii of the rounded corners.
Trait Implementations§
§impl Add<Vec2> for RoundedRect
impl Add<Vec2> for RoundedRect
§type Output = RoundedRect
type Output = RoundedRect
+
operator.§fn add(self, v: Vec2) -> RoundedRect
fn add(self, v: Vec2) -> RoundedRect
+
operation. Read more§impl Clone for RoundedRect
impl Clone for RoundedRect
§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 Data for RoundedRect
impl Data for RoundedRect
§impl Debug for RoundedRect
impl Debug for RoundedRect
§impl Default for RoundedRect
impl Default for RoundedRect
§fn default() -> RoundedRect
fn default() -> RoundedRect
§impl Mul<RoundedRect> for TranslateScale
impl Mul<RoundedRect> for TranslateScale
§type Output = RoundedRect
type Output = RoundedRect
*
operator.§fn mul(self, other: RoundedRect) -> RoundedRect
fn mul(self, other: RoundedRect) -> RoundedRect
*
operation. Read more§impl PartialEq<RoundedRect> for RoundedRect
impl PartialEq<RoundedRect> for RoundedRect
§fn eq(&self, other: &RoundedRect) -> bool
fn eq(&self, other: &RoundedRect) -> bool
self
and other
values to be equal, and is used
by ==
.§impl Shape for RoundedRect
impl Shape for RoundedRect
§type PathElementsIter = RoundedRectPathIter
type PathElementsIter = RoundedRectPathIter
path_elements
method.§fn path_elements(&self, tolerance: f64) -> RoundedRectPathIter
fn path_elements(&self, tolerance: f64) -> RoundedRectPathIter
§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
§fn as_rounded_rect(&self) -> Option<RoundedRect>
fn as_rounded_rect(&self) -> Option<RoundedRect>
§fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter<'_>> ⓘ
§fn as_path_slice(&self) -> Option<&[PathEl]>
fn as_path_slice(&self) -> Option<&[PathEl]>
§impl Sub<Vec2> for RoundedRect
impl Sub<Vec2> for RoundedRect
§type Output = RoundedRect
type Output = RoundedRect
-
operator.§fn sub(self, v: Vec2) -> RoundedRect
fn sub(self, v: Vec2) -> RoundedRect
-
operation. Read more