[−]Struct piet_common::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.
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.
pub fn from_points(p0: Point, p1: Point, radius: f64) -> RoundedRect
A new rectangle from two points.
The result will have non-negative width, height and radius.
pub fn from_origin_size(origin: Point, size: Vec2, 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. #[inline]
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 Copy for RoundedRect
impl Mul<RoundedRect> for TranslateScale
type Output = RoundedRect
The resulting type after applying the * operator.
fn mul(self, other: RoundedRect) -> RoundedRect
impl Default for RoundedRect
fn default() -> RoundedRect
impl Debug for 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
Convert into a Bézier path. Read more
fn as_line(&self) -> Option<Line>
If the shape is a line, make it available.
fn as_rect(&self) -> Option<Rect>
If the shape is a rectangle, make it available.
fn as_circle(&self) -> Option<Circle>
If the shape is a circle, make it available.
fn as_path_slice(&self) -> Option<&[PathEl]>
If the shape is stored as a slice of path elements, make that available. Read more
impl Clone for RoundedRect
fn clone(&self) -> RoundedRect
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl Sync for RoundedRect
impl Send for RoundedRect
impl Unpin for RoundedRect
impl RefUnwindSafe for RoundedRect
impl UnwindSafe for RoundedRect
Blanket Implementations
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> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> RoundFrom<T> for T[src]
fn round_from(x: T) -> T[src]
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>, [src]
U: RoundFrom<T>,