pub struct BorderRadius {
pub top_left: f32,
pub top_right: f32,
pub bottom_right: f32,
pub bottom_left: f32,
}Expand description
Corner radii, per corner (logical px). From<f32> covers the uniform case:
anywhere a radius is expected, a plain 10.0 still works.
Fields§
§top_left: f32The top-left corner’s radius, in logical pixels.
top_right: f32The top-right corner’s radius, in logical pixels.
bottom_right: f32The bottom-right corner’s radius, in logical pixels.
bottom_left: f32The bottom-left corner’s radius, in logical pixels.
Implementations§
Source§impl BorderRadius
impl BorderRadius
Sourcepub const ZERO: BorderRadius
pub const ZERO: BorderRadius
No rounding at all.
Sourcepub fn lerp(self, other: BorderRadius, t: f32) -> BorderRadius
pub fn lerp(self, other: BorderRadius, t: f32) -> BorderRadius
Each corner t of the way from self to other.
Not clamped: a corner past its target is what a spring asks for at the end of its travel, and the one rule for a radius in flight is this one — an animated container and a decoration transition both go through it.
Sourcepub const fn uniform(radius: f32) -> BorderRadius
pub const fn uniform(radius: f32) -> BorderRadius
The same radius on all four corners.
Sourcepub const fn top(radius: f32) -> BorderRadius
pub const fn top(radius: f32) -> BorderRadius
Only the top corners rounded (headers, rising sheets).
Sourcepub const fn bottom(radius: f32) -> BorderRadius
pub const fn bottom(radius: f32) -> BorderRadius
Only the bottom corners rounded.
Sourcepub const fn left(radius: f32) -> BorderRadius
pub const fn left(radius: f32) -> BorderRadius
Only the left corners rounded.
Sourcepub const fn right(radius: f32) -> BorderRadius
pub const fn right(radius: f32) -> BorderRadius
Sourcepub fn clamped(self) -> BorderRadius
pub fn clamped(self) -> BorderRadius
Radii clamped at zero — a negative radius is meaningless when painting.
Sourcepub fn inflate(self, by: f32) -> BorderRadius
pub fn inflate(self, by: f32) -> BorderRadius
Every corner grown by by — the envelope of a blurred shadow.
Sourcepub fn scale(self, factor: f32) -> BorderRadius
pub fn scale(self, factor: f32) -> BorderRadius
Every radius multiplied by factor (DPI scaling).
Trait Implementations§
Source§impl Clone for BorderRadius
impl Clone for BorderRadius
Source§fn clone(&self) -> BorderRadius
fn clone(&self) -> BorderRadius
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 BorderRadius
Source§impl Debug for BorderRadius
impl Debug for BorderRadius
Source§impl Default for BorderRadius
impl Default for BorderRadius
Source§fn default() -> BorderRadius
fn default() -> BorderRadius
Source§impl From<f32> for BorderRadius
impl From<f32> for BorderRadius
Source§fn from(radius: f32) -> BorderRadius
fn from(radius: f32) -> BorderRadius
Source§impl Lerp for BorderRadius
impl Lerp for BorderRadius
Source§fn lerp(self, other: BorderRadius, t: f32) -> BorderRadius
fn lerp(self, other: BorderRadius, t: f32) -> BorderRadius
self (at t=0) to other (at t=1).