pub struct BoxShadow {
pub color: Color,
pub offset: Offset,
pub blur_radius: f64,
pub spread_radius: f64,
pub blur_style: BlurStyle,
}Expand description
Fields§
§color: ColorColor that the shadow will be drawn with.
offset: OffsetThe displacement of the shadow from the casting element.
blur_radius: f64The standard deviation of the Gaussian to convolve with the shadow’s shape.
spread_radius: f64The amount the box should be inflated prior to applying the blur.
blur_style: BlurStyleThe BlurStyle to use for this shadow.
Defaults to BlurStyle::Normal.
Implementations§
Source§impl BoxShadow
impl BoxShadow
Sourcepub fn new(
color: Color,
offset: Offset,
blur_radius: f64,
spread_radius: f64,
blur_style: BlurStyle,
) -> BoxShadow
pub fn new( color: Color, offset: Offset, blur_radius: f64, spread_radius: f64, blur_style: BlurStyle, ) -> BoxShadow
Creates a box shadow.
By default, the shadow is solid black with zero offset,
zero blur_radius, zero spread_radius,
and BlurStyle::Normal.
Sourcepub fn blur_sigma(&self) -> f64
pub fn blur_sigma(&self) -> f64
The blur_radius in sigmas instead of logical pixels.
Sourcepub fn to_paint(&self) -> Paint
pub fn to_paint(&self) -> Paint
Create the Paint object that corresponds to this shadow description.
The offset and spread_radius are
not represented in the Paint object. To honor those as well, the shape
should be inflated by spread_radius pixels in every
direction and then translated by offset before being
filled using this Paint.
Sourcepub fn scale(&self, factor: f64) -> BoxShadow
pub fn scale(&self, factor: f64) -> BoxShadow
Returns a new box shadow with its offset, blurRadius, and spreadRadius scaled by the given factor.
Sourcepub fn copy_with(
&self,
color: Option<Color>,
offset: Option<Offset>,
blur_radius: Option<f64>,
spread_radius: Option<f64>,
blur_style: Option<BlurStyle>,
) -> BoxShadow
pub fn copy_with( &self, color: Option<Color>, offset: Option<Offset>, blur_radius: Option<f64>, spread_radius: Option<f64>, blur_style: Option<BlurStyle>, ) -> BoxShadow
Creates a copy of this object but with the given fields replaced with the new values.
Sourcepub fn lerp(
a: Option<BoxShadow>,
b: Option<BoxShadow>,
t: f64,
) -> Option<BoxShadow>
pub fn lerp( a: Option<BoxShadow>, b: Option<BoxShadow>, t: f64, ) -> Option<BoxShadow>
Linearly interpolate between two box shadows.
If either box shadow is null, this function linearly interpolates from a box shadow that matches the other box shadow in color but has a zero offset and a zero blurRadius.