Struct piet_common::kurbo::RoundedRectRadii [−]
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
pub const fn new(
top_left: f64,
top_right: f64,
bottom_right: f64,
bottom_left: f64
) -> RoundedRectRadii
top_left: f64,
top_right: f64,
bottom_right: f64,
bottom_left: f64
) -> RoundedRectRadii
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) -> RoundedRectRadii
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) -> RoundedRectRadii
Takes the absolute value of all corner radii.
pub fn clamp(&self, max: f64) -> RoundedRectRadii
For each corner, takes the min of that corner’s radius and max
.
pub fn is_finite(&self) -> bool
Returns true if all radius values are finite.
pub fn is_nan(&self) -> bool
Returns true if any corner radius value is NaN.
pub fn as_single_radius(&self) -> Option<f64>
If all radii are equal, returns the value of the radii. Otherwise,
returns None
.
Trait Implementations
impl Clone for RoundedRectRadii
pub fn clone(&self) -> RoundedRectRadii
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for RoundedRectRadii
impl Debug for RoundedRectRadii
impl Default for RoundedRectRadii
pub fn default() -> RoundedRectRadii
impl From<(f64, f64, f64, f64)> for RoundedRectRadii
impl From<f64> for RoundedRectRadii
pub fn from(radius: f64) -> RoundedRectRadii
impl Mul<RoundedRectRadii> for TranslateScale
type Output = RoundedRectRadii
The resulting type after applying the *
operator.
pub fn mul(self, other: RoundedRectRadii) -> RoundedRectRadii
impl PartialEq<RoundedRectRadii> for RoundedRectRadii
pub fn eq(&self, other: &RoundedRectRadii) -> bool
pub fn ne(&self, other: &RoundedRectRadii) -> bool
impl StructuralPartialEq for RoundedRectRadii
Auto Trait Implementations
impl RefUnwindSafe for RoundedRectRadii
impl Send for RoundedRectRadii
impl Sync for RoundedRectRadii
impl Unpin for RoundedRectRadii
impl UnwindSafe for RoundedRectRadii
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,
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
[src]
pub fn round_from(x: T) -> T
[src]
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
[src]
U: RoundFrom<T>,
pub fn round_into(self) -> U
[src]
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>,