pub struct CornerRadii {
pub top_left: f64,
pub top_right: f64,
pub bottom_right: f64,
pub bottom_left: f64,
}Expand description
Per-corner radii for a rounded rectangle, in the pre-transform coordinate space.
Corners are named clockwise from the top-left, matching
kurbo::RoundedRectRadii — the concrete shape frust-render builds at
encode time (scene-layer purity keeps the shape type itself out of this
crate’s commands).
From<f64> covers the uniform case, so the one-radius callers that predate
this type keep passing a bare f64 and the builder converts:
CornerRadii::from(8.0) == CornerRadii::new(8.0, 8.0, 8.0, 8.0).
Fields§
§top_left: f64Top-left corner radius.
top_right: f64Top-right corner radius.
bottom_right: f64Bottom-right corner radius.
bottom_left: f64Bottom-left corner radius.
Implementations§
Source§impl CornerRadii
impl CornerRadii
Sourcepub const fn new(
top_left: f64,
top_right: f64,
bottom_right: f64,
bottom_left: f64,
) -> CornerRadii
pub const fn new( top_left: f64, top_right: f64, bottom_right: f64, bottom_left: f64, ) -> CornerRadii
Radii for each corner, clockwise from the top-left (the
kurbo::RoundedRectRadii::new argument order).
Sourcepub const fn uniform(radius: f64) -> CornerRadii
pub const fn uniform(radius: f64) -> CornerRadii
The same radius on all four corners — what From<f64> builds.
Sourcepub fn largest(&self) -> f64
pub fn largest(&self) -> f64
The largest of the four corner radii.
A backend that can only express a single radius (both blurred-shadow primitives take one) lowers through this rather than through the smallest: a shadow rounded more than its caster only lightens a square corner, while one rounded less pushes a hard shadow wedge out through a rounded corner’s notch.
Trait Implementations§
Source§impl Clone for CornerRadii
impl Clone for CornerRadii
Source§fn clone(&self) -> CornerRadii
fn clone(&self) -> CornerRadii
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CornerRadii
Source§impl Debug for CornerRadii
impl Debug for CornerRadii
Source§impl Default for CornerRadii
impl Default for CornerRadii
Source§fn default() -> CornerRadii
fn default() -> CornerRadii
Source§impl From<f64> for CornerRadii
impl From<f64> for CornerRadii
Source§fn from(radius: f64) -> CornerRadii
fn from(radius: f64) -> CornerRadii
Source§impl PartialEq for CornerRadii
impl PartialEq for CornerRadii
impl StructuralPartialEq for CornerRadii
Auto Trait Implementations§
impl Freeze for CornerRadii
impl RefUnwindSafe for CornerRadii
impl Send for CornerRadii
impl Sync for CornerRadii
impl Unpin for CornerRadii
impl UnsafeUnpin for CornerRadii
impl UnwindSafe for CornerRadii
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
impl<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.