[−]Struct druid::piet::kurbo::RoundedRect
A rectangle with equally rounded corners.
By construction the rounded rectangle will have non-negative dimensions and radius 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
.
Methods
impl RoundedRect
pub fn new(x0: f64, y0: f64, x1: f64, y1: f64, radius: f64) -> RoundedRect
A new rectangle from minimum and maximum coordinates.
The result will have non-negative width, height and radius.
pub fn from_rect(rect: Rect, radius: f64) -> RoundedRect
A new rounded rectangle from a rectangle and corner radius.
The result will have non-negative width, height and radius.
See also Rect::to_rounded_rect
, which offers the same utility.
pub fn from_points(
p0: impl Into<Point>,
p1: impl Into<Point>,
radius: f64
) -> RoundedRect
p0: impl Into<Point>,
p1: impl Into<Point>,
radius: f64
) -> 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>,
radius: f64
) -> RoundedRect
origin: impl Into<Point>,
size: impl Into<Size>,
radius: f64
) -> RoundedRect
A new rectangle from origin and size.
The result will have non-negative width, height and radius.
pub fn width(&self) -> f64
The width of the rectangle.
pub fn height(&self) -> f64
The height of the rectangle.
pub fn radius(&self) -> f64
Radius of the rounded corners.
pub fn rect(&self) -> Rect
The (non-rounded) rectangle.
pub fn origin(&self) -> Point
The origin of the rectangle.
This is the top left corner in a y-down space.
pub fn center(&self) -> Point
The center point of the rectangle.
Trait Implementations
impl Clone for RoundedRect
fn clone(&self) -> RoundedRect
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for RoundedRect
impl Data for RoundedRect
[src]
impl Debug for RoundedRect
impl Default for RoundedRect
fn default() -> RoundedRect
impl Mul<RoundedRect> for TranslateScale
type Output = RoundedRect
The resulting type after applying the *
operator.
fn mul(self, other: RoundedRect) -> RoundedRect
impl Shape for RoundedRect
type BezPathIter = RoundedRectPathIter
The iterator resulting from to_bez_path
.
fn to_bez_path(&self, tolerance: f64) -> RoundedRectPathIter
fn area(&self) -> f64
fn perimeter(&self, _accuracy: f64) -> f64
fn winding(&self, pt: Point) -> i32
fn bounding_box(&self) -> Rect
fn as_rounded_rect(&self) -> Option<RoundedRect>
fn into_bez_path(self, tolerance: f64) -> BezPath
fn as_line(&self) -> Option<Line>
fn as_rect(&self) -> Option<Rect>
fn as_circle(&self) -> Option<Circle>
fn as_path_slice(&self) -> Option<&[PathEl]>
Auto Trait Implementations
impl RefUnwindSafe for RoundedRect
impl Send for RoundedRect
impl Sync for RoundedRect
impl Unpin for RoundedRect
impl UnwindSafe for RoundedRect
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
fn round_into(self) -> U
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,