FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    AcrylicBrush

    struct · ferroui-base · v0.5.0

    struct AcrylicBrush
    

    A brush that paints the acrylic material of WinUI (WinUI Microsoft.UI.Xaml.Media.AcrylicBrush): what is behind the element, blurred, with its luminosity taken from a luminosity colour and its colour from the tint, and a little noise; or, when the tint is opaque, the tint with noise.

    The brush falls back to its fallback_color when always_use_fallback is set or the MaterialPolicy disables materials (energy saver, transparency effects off), cross-fading over 167 ms. With the background_source HostBackdrop (WinUI 2's window acrylic) it shows what is behind the window, and also falls back while no window of the application is active; in a window the platform shows nothing behind (an opaque window) it paints its fallback colour. Changes of the tint animate over tint_transition_duration.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<AcrylicBrush>
    

    Returns a strong reference to this object.

    Source

    tint_color_property

    fn tint_color_property() -> &'static StyledProperty<Color>
    

    TintColor (default #CCFFFFFF).

    Source

    tint_opacity_property

    fn tint_opacity_property() -> &'static StyledProperty<f64>
    

    TintOpacity (default 1), coerced to 0..1.

    Source

    tint_luminosity_opacity_property

    fn tint_luminosity_opacity_property() -> &'static StyledProperty<Option<f64>>
    

    TintLuminosityOpacity (default none), coerced to 0..1.

    Source

    tint_transition_duration_property

    fn tint_transition_duration_property() -> &'static StyledProperty<Duration>
    

    TintTransitionDuration (default 500 ms): how long a change of the tint or of the fallback colour animates.

    Source

    background_source_property

    fn background_source_property() -> &'static StyledProperty<AcrylicBrushBackgroundSource>
    

    BackgroundSource (WinUI 2; default Backdrop): what the brush blurs.

    Source

    always_use_fallback_property

    fn always_use_fallback_property() -> &'static StyledProperty<bool>
    

    AlwaysUseFallback (default false).

    Source

    construct

    fn construct() -> Self
    

    Creates the class data.

    Source

    register_effect_prewarm

    fn register_effect_prewarm()
    

    Registers the effects of the in-app material for the prewarm of the GPU programs (effects::register_effect_prewarm, #437), under ACRYLIC_PREWARM_EFFECTS: the translucent material over the backdrop (the blur, the luminosity and colour blends, the noise), and the same cross-faded with the fallback colour (the cross-fade of a change of the material policy). The opaque material and the window acrylic are fills and the noise, which these draw too. The colours are those of AcrylicInAppFillColorDefaultBrush of the dark theme: the programs depend on the blends and the layers, not on the colours.

    A theme that draws acrylic calls it when it is created, so that the programs are made after the first frame of a window rather than when a flyout or a pane first shows the material; creating a brush calls it too. Calls after the first do nothing.

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    tint_color

    fn tint_color(self: &Self) -> Color
    

    Source

    set_tint_color

    fn set_tint_color(self: &Self, value: Color)
    

    Source

    tint_opacity

    fn tint_opacity(self: &Self) -> f64
    

    Source

    set_tint_opacity

    fn set_tint_opacity(self: &Self, value: f64)
    

    Source

    tint_luminosity_opacity

    fn tint_luminosity_opacity(self: &Self) -> Option<f64>
    

    Source

    set_tint_luminosity_opacity

    fn set_tint_luminosity_opacity(self: &Self, value: Option<f64>)
    

    Source

    tint_transition_duration

    fn tint_transition_duration(self: &Self) -> Duration
    

    Source

    set_tint_transition_duration

    fn set_tint_transition_duration(self: &Self, value: Duration)
    

    Source

    background_source

    fn background_source(self: &Self) -> AcrylicBrushBackgroundSource
    

    Source

    set_background_source

    fn set_background_source(self: &Self, value: AcrylicBrushBackgroundSource)
    

    Source

    always_use_fallback

    fn always_use_fallback(self: &Self) -> bool
    

    Source

    set_always_use_fallback

    fn set_always_use_fallback(self: &Self, value: bool)
    

    Source

    effective_tint_color

    fn effective_tint_color(self: &Self) -> Color
    

    GetEffectiveTintColor: the tint colour with its alpha times the tint opacity (and the tint opacity modifier when no luminosity opacity is set).

    Source

    effective_luminosity_color

    fn effective_luminosity_color(self: &Self) -> Color
    

    GetEffectiveLuminosityColor: the luminosity colour of the tint at the tint opacity the user set.

    Source

    is_using_acrylic_brush

    fn is_using_acrylic_brush(self: &Self) -> bool
    

    Whether the brush draws the material now (rather than its fallback colour).

    Source

    is_waiting_for_fallback_animation

    fn is_waiting_for_fallback_animation(self: &Self) -> bool
    

    Whether the cross-fade between the material and the fallback colour is running.

    Source

    Trait implementations

    Availability

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