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.
Members
TYPEto_reftint_color_propertytint_opacity_propertytint_luminosity_opacity_propertytint_transition_duration_propertybackground_source_propertyalways_use_fallback_propertyconstructregister_effect_prewarmnewtint_colorset_tint_colortint_opacityset_tint_opacitytint_luminosity_opacityset_tint_luminosity_opacitytint_transition_durationset_tint_transition_durationbackground_sourceset_background_sourcealways_use_fallbackset_always_use_fallbackeffective_tint_coloreffective_luminosity_coloris_using_acrylic_brushis_waiting_for_fallback_animation
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<AcrylicBrush>
Returns a strong reference to this object.
tint_color_property
fn tint_color_property() -> &'static StyledProperty<Color>
TintColor (default #CCFFFFFF).
tint_opacity_property
fn tint_opacity_property() -> &'static StyledProperty<f64>
TintOpacity (default 1), coerced to 0..1.
tint_luminosity_opacity_property
fn tint_luminosity_opacity_property() -> &'static StyledProperty<Option<f64>>
TintLuminosityOpacity (default none), coerced to 0..1.
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.
background_source_property
fn background_source_property() -> &'static StyledProperty<AcrylicBrushBackgroundSource>
BackgroundSource (WinUI 2; default Backdrop): what the brush
blurs.
always_use_fallback_property
fn always_use_fallback_property() -> &'static StyledProperty<bool>
AlwaysUseFallback (default false).
construct
fn construct() -> Self
Creates the class data.
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.
new
fn new() -> Ref<Self>
tint_color
fn tint_color(self: &Self) -> Color
set_tint_color
fn set_tint_color(self: &Self, value: Color)
tint_opacity
fn tint_opacity(self: &Self) -> f64
set_tint_opacity
fn set_tint_opacity(self: &Self, value: f64)
tint_luminosity_opacity
fn tint_luminosity_opacity(self: &Self) -> Option<f64>
set_tint_luminosity_opacity
fn set_tint_luminosity_opacity(self: &Self, value: Option<f64>)
tint_transition_duration
fn tint_transition_duration(self: &Self) -> Duration
set_tint_transition_duration
fn set_tint_transition_duration(self: &Self, value: Duration)
background_source
fn background_source(self: &Self) -> AcrylicBrushBackgroundSource
set_background_source
fn set_background_source(self: &Self, value: AcrylicBrushBackgroundSource)
always_use_fallback
fn always_use_fallback(self: &Self) -> bool
set_always_use_fallback
fn set_always_use_fallback(self: &Self, value: bool)
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).
effective_luminosity_color
fn effective_luminosity_color(self: &Self) -> Color
GetEffectiveLuminosityColor: the luminosity colour of the tint at
the tint opacity the user set.
is_using_acrylic_brush
fn is_using_acrylic_brush(self: &Self) -> bool
Whether the brush draws the material now (rather than its fallback colour).
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.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBrushImplExtXamlCompositionBrushBaseImplExtFerroObjectImplExtClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyErasedDestructorIntoEitherDerefUpcast<T>Upcast<AcrylicBrush>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleBrushImplFerroObjectImplXamlCompositionBrushBaseImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.