pub struct CornerRadii {
pub top_left: f64,
pub top_right: f64,
pub bottom_right: f64,
pub bottom_left: f64,
}Expand description
The per-corner radii and dash-pattern vocabulary PaintScene’s own
signatures name, re-exported from frust-scene so a widget calling
PaintScene::fill_rounded_rect_radii/PaintScene::push_clip_rounded_radii/
PaintScene::stroke_path_dashed can name their arguments through the same
paint surface it already paints through (mirrors the crate-root accesskit
re-export).
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 more