Skip to content

ui::AcrylicBrush

Header: winui/render/Brush.hpp.

An in-app acrylic material: what is behind the shape, over an opaque fallback, blurred (a Gaussian of standard deviation 30), then a Luminosity blend with effective_luminosity() and a Color blend with effective_tint(). A tint that works out opaque paints only the tint. A backend that cannot blur paints fallback_color, and so does always_use_fallback.

The defaults: a white tint at 80 % alpha, full tint opacity, no luminosity opacity (so one is derived from the tint), and a transparent fallback.

The blur reads what is already drawn, so a shape with an acrylic fill must render after the content it sits on (see DrawGeometry).

Example:

auto backdrop = std::make_unique<ui::RectangleControl>();
backdrop->set_fill(ui::AcrylicBrush{
    .tint_color     = ui::Color::from_rgba(0, 120, 215),
    .tint_opacity   = 0.6f,
    .fallback_color = ui::Color::from_rgba(0, 90, 160),
});

tint_color

Color tint_color = Color::from_argb(0xCCFFFFFF)

The tint laid over the blurred backdrop; its alpha counts.

tint_opacity

float tint_opacity = 1.0f

Multiplies the tint's alpha, 0..1.

tint_luminosity_opacity

OptionalFloat tint_luminosity_opacity {}

The opacity of the luminosity blend; nullopt derives it from the tint (see effective_luminosity()).

fallback_color

Color fallback_color = colors::Transparent

What a backend paints when it cannot blur, or when always_use_fallback is set.

always_use_fallback

bool always_use_fallback = false

Paint fallback_color even where acrylic could be drawn.

effective_tint

Color effective_tint() const

The tint with its alpha multiplied by tint_opacity. When no luminosity opacity was named, it is also capped, which holds a pure white tint to 45 % and pure black to 85 %, relaxing as saturation rises.

effective_luminosity

Color effective_luminosity() const

The luminosity layer's color: the tint's color at the named luminosity opacity, or else at its HSV value clamped to [0.125, 0.965] and the tint opacity mapped into [0.15, 1.03] (capped at 1).