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.
Trait Implementations§
impl Copy for BoxShadow
impl StructuralPartialEq for BoxShadow
Auto Trait Implementations§
impl Forget for BoxShadow
impl Freeze for BoxShadow
impl Move for BoxShadow
impl RefUnwindSafe for BoxShadow
impl Send for BoxShadow
impl Sync for BoxShadow
impl Unpin for BoxShadow
impl UnsafeUnpin for BoxShadow
impl UnwindSafe for BoxShadow
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<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.