Struct kurbo::RoundedRectRadii
source · 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: 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§
source§impl RoundedRectRadii
impl RoundedRectRadii
sourcepub const fn new(
top_left: f64,
top_right: f64,
bottom_right: f64,
bottom_left: f64,
) -> Self
pub const fn new( top_left: f64, top_right: f64, bottom_right: f64, bottom_left: f64, ) -> Self
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
.
sourcepub const fn from_single_radius(radius: f64) -> Self
pub const fn from_single_radius(radius: f64) -> Self
Create a new RoundedRectRadii
from a single radius. The radius
argument will be set as the radius for all four corners.
sourcepub fn clamp(&self, max: f64) -> Self
pub fn clamp(&self, max: f64) -> Self
For each corner, takes the min of that corner’s radius and max
.
sourcepub fn as_single_radius(&self) -> Option<f64>
pub fn as_single_radius(&self) -> Option<f64>
If all radii are equal, returns the value of the radii. Otherwise,
returns None
.
Trait Implementations§
source§impl Clone for RoundedRectRadii
impl Clone for RoundedRectRadii
source§fn clone(&self) -> RoundedRectRadii
fn clone(&self) -> RoundedRectRadii
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for RoundedRectRadii
impl Debug for RoundedRectRadii
source§impl Default for RoundedRectRadii
impl Default for RoundedRectRadii
source§fn default() -> RoundedRectRadii
fn default() -> RoundedRectRadii
source§impl<'de> Deserialize<'de> for RoundedRectRadii
impl<'de> Deserialize<'de> for RoundedRectRadii
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<f64> for RoundedRectRadii
impl From<f64> for RoundedRectRadii
source§impl JsonSchema for RoundedRectRadii
impl JsonSchema for RoundedRectRadii
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl Mul<RoundedRectRadii> for TranslateScale
impl Mul<RoundedRectRadii> for TranslateScale
source§type Output = RoundedRectRadii
type Output = RoundedRectRadii
*
operator.source§fn mul(self, other: RoundedRectRadii) -> RoundedRectRadii
fn mul(self, other: RoundedRectRadii) -> RoundedRectRadii
*
operation. Read moresource§impl PartialEq for RoundedRectRadii
impl PartialEq for RoundedRectRadii
source§impl Serialize for RoundedRectRadii
impl Serialize for RoundedRectRadii
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 UnwindSafe for RoundedRectRadii
Blanket Implementations§
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)