Struct kurbo::RoundedRectRadii[][src]

pub struct RoundedRectRadii {
    pub top_left: f64,
    pub top_right: f64,
    pub bottom_right: f64,
    pub bottom_left: f64,
}

Radii for each corner of a rounded rectangle.

The use of top as in top_left assumes a y-down coordinate space. Piet (and Druid by extension) uses a y-down coordinate space, but Kurbo also supports a y-up coordinate space, in which case top_left would actually refer to the bottom-left corner, and vice versa. Top may not always actually be the top, but top corners will always have a smaller y-value than bottom corners.

Fields

top_left: f64

The radius of the top-left corner.

top_right: f64

The radius of the top-right corner.

bottom_right: f64

The radius of the bottom-right corner.

bottom_left: f64

The radius of the bottom-left corner.

Implementations

impl RoundedRectRadii[src]

pub const fn new(
    top_left: f64,
    top_right: f64,
    bottom_right: f64,
    bottom_left: f64
) -> Self
[src]

Create a new RoundedRectRadii. This function takes radius values for the four corners. The argument order is "top_left, top_right, bottom_right, bottom_left", or clockwise starting from top_left.

pub const fn from_single_radius(radius: f64) -> Self[src]

Create a new RoundedRectRadii from a single radius. The radius argument will be set as the radius for all four corners.

pub fn abs(&self) -> Self[src]

Takes the absolute value of all corner radii.

pub fn clamp(&self, max: f64) -> Self[src]

For each corner, takes the min of that corner's radius and max.

pub fn is_finite(&self) -> bool[src]

Returns true if all radius values are finite.

pub fn is_nan(&self) -> bool[src]

Returns true if any corner radius value is NaN.

pub fn as_single_radius(&self) -> Option<f64>[src]

If all radii are equal, returns the value of the radii. Otherwise, returns None.

Trait Implementations

impl Clone for RoundedRectRadii[src]

impl Copy for RoundedRectRadii[src]

impl Debug for RoundedRectRadii[src]

impl Default for RoundedRectRadii[src]

impl<'de> Deserialize<'de> for RoundedRectRadii[src]

impl From<(f64, f64, f64, f64)> for RoundedRectRadii[src]

impl From<f64> for RoundedRectRadii[src]

impl Mul<RoundedRectRadii> for TranslateScale[src]

type Output = RoundedRectRadii

The resulting type after applying the * operator.

impl PartialEq<RoundedRectRadii> for RoundedRectRadii[src]

impl Serialize for RoundedRectRadii[src]

impl StructuralPartialEq for RoundedRectRadii[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.