# AcrylicBrush

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-acrylicbrush/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
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`](/docs/0.5.0/api/ferroui-base/media/struct-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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L370)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`tint_color_property`](#function-tint_color_property)
- [`tint_opacity_property`](#function-tint_opacity_property)
- [`tint_luminosity_opacity_property`](#function-tint_luminosity_opacity_property)
- [`tint_transition_duration_property`](#function-tint_transition_duration_property)
- [`background_source_property`](#function-background_source_property)
- [`always_use_fallback_property`](#function-always_use_fallback_property)
- [`construct`](#function-construct)
- [`register_effect_prewarm`](#function-register_effect_prewarm)
- [`new`](#function-new)
- [`tint_color`](#function-tint_color)
- [`set_tint_color`](#function-set_tint_color)
- [`tint_opacity`](#function-tint_opacity)
- [`set_tint_opacity`](#function-set_tint_opacity)
- [`tint_luminosity_opacity`](#function-tint_luminosity_opacity)
- [`set_tint_luminosity_opacity`](#function-set_tint_luminosity_opacity)
- [`tint_transition_duration`](#function-tint_transition_duration)
- [`set_tint_transition_duration`](#function-set_tint_transition_duration)
- [`background_source`](#function-background_source)
- [`set_background_source`](#function-set_background_source)
- [`always_use_fallback`](#function-always_use_fallback)
- [`set_always_use_fallback`](#function-set_always_use_fallback)
- [`effective_tint_color`](#function-effective_tint_color)
- [`effective_luminosity_color`](#function-effective_luminosity_color)
- [`is_using_acrylic_brush`](#function-is_using_acrylic_brush)
- [`is_waiting_for_fallback_animation`](#function-is_waiting_for_fallback_animation)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L375)

<a id="function-to_ref"></a>

### to_ref

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

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L375)

<a id="function-tint_color_property"></a>

### tint_color_property

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

`TintColor` (default `#CCFFFFFF`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L446)

<a id="function-tint_opacity_property"></a>

### tint_opacity_property

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L446)

<a id="function-tint_luminosity_opacity_property"></a>

### tint_luminosity_opacity_property

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L446)

<a id="function-tint_transition_duration_property"></a>

### tint_transition_duration_property

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L446)

<a id="function-background_source_property"></a>

### background_source_property

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

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L446)

<a id="function-always_use_fallback_property"></a>

### always_use_fallback_property

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

`AlwaysUseFallback` (default `false`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L446)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L507)

<a id="function-register_effect_prewarm"></a>

### register_effect_prewarm

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L527)

<a id="function-new"></a>

### new

```rust
fn new() -> Ref<Self>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L548)

<a id="function-tint_color"></a>

### tint_color

```rust
fn tint_color(self: &Self) -> Color
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L552)

<a id="function-set_tint_color"></a>

### set_tint_color

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L556)

<a id="function-tint_opacity"></a>

### tint_opacity

```rust
fn tint_opacity(self: &Self) -> f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L560)

<a id="function-set_tint_opacity"></a>

### set_tint_opacity

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L564)

<a id="function-tint_luminosity_opacity"></a>

### tint_luminosity_opacity

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L568)

<a id="function-set_tint_luminosity_opacity"></a>

### set_tint_luminosity_opacity

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L572)

<a id="function-tint_transition_duration"></a>

### tint_transition_duration

```rust
fn tint_transition_duration(self: &Self) -> Duration
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L576)

<a id="function-set_tint_transition_duration"></a>

### set_tint_transition_duration

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L580)

<a id="function-background_source"></a>

### background_source

```rust
fn background_source(self: &Self) -> AcrylicBrushBackgroundSource
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L584)

<a id="function-set_background_source"></a>

### set_background_source

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L588)

<a id="function-always_use_fallback"></a>

### always_use_fallback

```rust
fn always_use_fallback(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L592)

<a id="function-set_always_use_fallback"></a>

### set_always_use_fallback

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L596)

<a id="function-effective_tint_color"></a>

### effective_tint_color

```rust
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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L603)

<a id="function-effective_luminosity_color"></a>

### effective_luminosity_color

```rust
fn effective_luminosity_color(self: &Self) -> Color
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L613)

<a id="function-is_using_acrylic_brush"></a>

### is_using_acrylic_brush

```rust
fn is_using_acrylic_brush(self: &Self) -> bool
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L621)

<a id="function-is_waiting_for_fallback_animation"></a>

### is_waiting_for_fallback_animation

```rust
fn is_waiting_for_fallback_animation(self: &Self) -> bool
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/acrylic_brush.rs#L627)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`BrushImplExt`](/docs/0.5.0/api/ferroui-base/media/trait-brushimplext/)
- [`XamlCompositionBrushBaseImplExt`](/docs/0.5.0/api/ferroui-base/media/trait-xamlcompositionbrushbaseimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<AcrylicBrush>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`BrushImpl`](/docs/0.5.0/api/ferroui-base/media/trait-brushimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`XamlCompositionBrushBaseImpl`](/docs/0.5.0/api/ferroui-base/media/trait-xamlcompositionbrushbaseimpl/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
