pub struct Shadow {
pub color: Color,
pub offset: Offset,
pub blur_radius: f64,
}Expand description
A representation of a shadow.
Fields§
§color: ColorColor that the shadow will be drawn with.
The shadows are shapes composited directly over the base canvas, and do not represent optical occlusion.
offset: OffsetThe displacement of the shadow from the casting element.
Positive x/y offsets will shift the shadow to the right and down, while negative offsets shift the shadow to the left and up. The offsets are relative to the position of the element that is casting it.
blur_radius: f64The standard deviation of the Gaussian to convolve with the shadow’s shape.
Implementations§
Source§impl Shadow
impl Shadow
Sourcepub fn new(color: Color, offset: Offset, blur_radius: f64) -> Shadow
pub fn new(color: Color, offset: Offset, blur_radius: f64) -> Shadow
Construct a shadow.
The default shadow is a black shadow with zero offset and zero blur. Default shadows should be completely covered by the casting element, and not be visible.
Transparency should be adjusted through the color alpha.
Shadow order matters due to compositing multiple translucent objects not being commutative.
Sourcepub fn convert_radius_to_sigma(radius: f64) -> f64
pub fn convert_radius_to_sigma(radius: f64) -> f64
Converts a blur radius in pixels to sigmas.
See SkBlurMask::ConvertRadiusToSigma().
Sourcepub fn blur_sigma(&self) -> f64
pub fn blur_sigma(&self) -> f64
The blur_radius in sigmas instead of logical pixels.
Sourcepub fn scale(&self, factor: f64) -> Shadow
pub fn scale(&self, factor: f64) -> Shadow
Returns a new shadow with its offset and
blur_radius scaled by the given factor.