[−]Struct druid::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
.
Implementations
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
pub fn clone(&self) -> RoundedRect
pub 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
pub fn default() -> RoundedRect
impl Mul<RoundedRect> for TranslateScale
type Output = RoundedRect
The resulting type after applying the *
operator.
pub fn mul(self, other: RoundedRect) -> RoundedRect
impl PartialEq<RoundedRect> for RoundedRect
pub fn eq(&self, other: &RoundedRect) -> bool
pub fn ne(&self, other: &RoundedRect) -> bool
impl Shape for RoundedRect
type PathElementsIter = RoundedRectPathIter
The iterator returned by the path_elements
method. Read more
pub fn path_elements(&self, tolerance: f64) -> RoundedRectPathIter
pub fn area(&self) -> f64
pub fn perimeter(&self, _accuracy: f64) -> f64
pub fn winding(&self, pt: Point) -> i32
pub fn bounding_box(&self) -> Rect
pub fn as_rounded_rect(&self) -> Option<RoundedRect>
pub fn to_path(&self, tolerance: f64) -> BezPath
pub fn into_path(self, tolerance: f64) -> BezPath
pub fn path_segments(&self, tolerance: f64) -> Segments<Self::PathElementsIter>ⓘ
pub fn contains(&self, pt: Point) -> bool
pub fn as_line(&self) -> Option<Line>
pub fn as_rect(&self) -> Option<Rect>
pub fn as_circle(&self) -> Option<Circle>
pub fn as_path_slice(&self) -> Option<&[PathEl]>
impl StructuralPartialEq for RoundedRect
Auto Trait Implementations
impl RefUnwindSafe for RoundedRect
[src]
impl Send for RoundedRect
[src]
impl Sync for RoundedRect
[src]
impl Unpin for RoundedRect
[src]
impl UnwindSafe for RoundedRect
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AnyEq for T where
T: PartialEq<T> + Any,
[src]
T: PartialEq<T> + Any,
pub fn equals(&self, other: &(dyn Any + 'static)) -> bool
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub 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
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,