Struct RoundedRectRadii
pub struct RoundedRectRadii {
pub top_left: f64,
pub top_right: f64,
pub bottom_right: f64,
pub bottom_left: f64,
}Expand description
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: f64The radius of the top-left corner.
top_right: f64The radius of the top-right corner.
bottom_right: f64The radius of the bottom-right corner.
bottom_left: f64The radius of the bottom-left corner.
Implementations§
§impl RoundedRectRadii
impl RoundedRectRadii
pub const fn new(
top_left: f64,
top_right: f64,
bottom_right: f64,
bottom_left: f64,
) -> RoundedRectRadii
pub const fn new( 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
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 const fn abs(&self) -> RoundedRectRadii
pub const fn abs(&self) -> RoundedRectRadii
Takes the absolute value of all corner radii.
pub const fn clamp(&self, max: f64) -> RoundedRectRadii
pub const fn clamp(&self, max: f64) -> RoundedRectRadii
For each corner, takes the min of that corner’s radius and max.
pub const fn as_single_radius(&self) -> Option<f64>
pub const 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
impl Clone for RoundedRectRadii
§fn clone(&self) -> RoundedRectRadii
fn clone(&self) -> RoundedRectRadii
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for RoundedRectRadii
impl Debug for RoundedRectRadii
§impl Default for RoundedRectRadii
impl Default for RoundedRectRadii
§fn default() -> RoundedRectRadii
fn default() -> RoundedRectRadii
§impl From<f64> for RoundedRectRadii
impl From<f64> for RoundedRectRadii
§fn from(radius: f64) -> RoundedRectRadii
fn from(radius: f64) -> RoundedRectRadii
§impl Mul<RoundedRectRadii> for TranslateScale
impl Mul<RoundedRectRadii> for TranslateScale
§type Output = RoundedRectRadii
type Output = RoundedRectRadii
* operator.§fn mul(self, other: RoundedRectRadii) -> RoundedRectRadii
fn mul(self, other: RoundedRectRadii) -> RoundedRectRadii
* operation. Read more§impl PartialEq for RoundedRectRadii
impl PartialEq for RoundedRectRadii
§fn eq(&self, other: &RoundedRectRadii) -> bool
fn eq(&self, other: &RoundedRectRadii) -> bool
self and other values to be equal, and is used by ==.impl Copy for RoundedRectRadii
impl StructuralPartialEq for RoundedRectRadii
Auto Trait Implementations§
impl Freeze for RoundedRectRadii
impl RefUnwindSafe for RoundedRectRadii
impl Send for RoundedRectRadii
impl Sync for RoundedRectRadii
impl Unpin for RoundedRectRadii
impl UnsafeUnpin for RoundedRectRadii
impl UnwindSafe for RoundedRectRadii
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more