FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    DropShadowRecipe

    struct · ferroui-base · v0.5.0

    struct DropShadowRecipe
    

    The values of the drop shadow of a theme shadow (WinUI's DropShadowRecipe, GetDropShadowRecipe): an ambient and a directional shadow of the elevation of an element.

    View source

    Members

    radius_x

    radius_x: f64
    

    The corner radii of the rounded rectangle that casts the shadow.

    Source

    radius_y

    radius_y: f64
    

    Source

    elevation

    elevation: f32
    

    The elevation: half the Z of the translation, at most 64.

    Source

    ambient_blur_radius

    ambient_blur_radius: f32
    

    Source

    directional_blur_radius

    directional_blur_radius: f32
    

    Source

    ambient_y_offset

    ambient_y_offset: f32
    

    How far each shadow is moved down.

    Source

    directional_y_offset

    directional_y_offset: f32
    

    Source

    ambient_opacity

    ambient_opacity: f32
    

    Source

    directional_opacity

    directional_opacity: f32
    

    Source

    ambient_color

    ambient_color: crate::media::Color
    

    Black with the opacity in the alpha (truncated, as WinUI converts it).

    Source

    directional_color

    directional_color: crate::media::Color
    

    Source

    insets

    insets: crate::Thickness
    

    How far the shadow reaches around the element.

    Source

    new

    fn new(translation_z: f32, theme: ThemeShadowTheme) -> DropShadowRecipe
    

    GetDropShadowRecipe(translationZ, theme): no shadow below an elevation of 2; up to 16 a directional shadow only, of the opacity min(elevation / 100 + 0.06, 0.14) in the light theme and 0.26 in the dark one; above 16 also an ambient shadow, blurred by a third of the elevation and moved down by 2, of the opacity 0.15 (light) or 0.37 (dark), the directional one 0.19 (light) or 0.37 (dark). The directional shadow is blurred by the elevation and moved down by half of it. The corner radii are zero; see with_corner_radius.

    A high contrast theme has no shadow: both opacities are zero.

    Source

    with_corner_radius

    fn with_corner_radius(self: Self, radius_x: f64, radius_y: f64) -> DropShadowRecipe
    

    The recipe with the corner radii of the rounded rectangle that casts the shadow.

    Source

    is_visible

    fn is_visible(self: &Self) -> bool
    

    Whether the recipe draws anything.

    Source

    box_shadows

    fn box_shadows(self: &Self) -> Vec<BoxShadow>
    

    The two shadows as the box shadows of the rounded rectangle the shadow is drawn around, the ambient first (CreateDropShadowVisual puts it at the bottom). Each is blurred by one more than its radius, because the rectangle is one pixel smaller on each side than the element (CreateDropShadowVisual shrinks the dummy shape so that the antialiased edge of the element lies over the shadow).

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone
    • Copy
    • Debug
    • StructuralPartialEq
    • PartialEq

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.