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,
) -> Self
pub const fn new( top_left: f64, top_right: f64, bottom_right: f64, bottom_left: f64, ) -> Self
Radii for each corner, clockwise from the top-left (the
kurbo::RoundedRectRadii::new argument order).
Sourcepub const fn uniform(radius: f64) -> Self
pub const fn uniform(radius: f64) -> Self
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.