Module backdrop
Expand description
The blurred material floating chrome is made of.
Floating chrome — the palette, menus, popovers, quick settings, sheets,
notifications and chrome over media — is drawn over a blurred copy of
what is behind it, tinted with the panel ground
(docs/design-language.md, “Material and transparency”). The blur
radius and the tint’s opacity are theme roles
(surfaces.material_blur_px, surfaces.material_opacity, set by the
theme document’s material). A surface asks for the material with
crate::floating_surface::Material::Floating; nothing outside the
theme and this module picks a blur radius or a tint.
Vello cannot sample what it has already drawn, so the blur is a pass that runs before the frame:
- While a host holds a
BackdropRecording, [fill] draws a surface’s body as a placeholder image under the tint and records what lies behind it: what the scene it is drawn into held so far, which of the host’s scenes that is (seelayer_scene), the surface’s bounds and its blur radius. - The host turns those records into a
BackdropFramein its target’s pixel space, each region carrying the complete scene composed below the surface. - A renderer that composites materials calls
BackdropBlur::prepare: each region’s backdrop is rendered at half resolution, halved until the blur fits a short kernel, blurred separably, and substituted for the placeholder. The frame then renders as usual, andBackdropBlur::releasedrops the substitutions.
The placeholder’s own pixels are the opaque panel ground, so any path that does not substitute it — no blur pass in the renderer, a failed backdrop render, a capture of the scene — shows the opaque material. Reduced transparency, forced colours and a theme without blur draw the opaque material directly.
Structs§
- Backdrop
Blur - The GPU half of the material: renders, blurs and substitutes each region’s backdrop on one device. Built once per renderer.
- Backdrop
Frame - The backdrops one frame draws its floating surfaces over.
- Backdrop
Recording - Records the surfaces drawn in the blurred material on this thread until
Self::finish. Nests: an inner recording hides the outer one and restores it when it ends. - Backdrop
Region - One surface’s backdrop, in the pixel space of the target it renders to.
- Backdrop
Stats - What
BackdropBlur::preparedid, for frame profiling. - Recorded
Backdrop - One surface drawn in the blurred material while a recording was active, in the recording’s coordinates.
Constants§
- MAX_
BACKDROP_ REGIONS - Most surfaces one frame blurs behind. Later ones in the same frame are opaque: each region costs one extra render of everything below it.
Functions§
- append_
nested scene.append(child, Some(transform)), carrying the floating surfaces drawn intochildsincenest_sceneontoscene: whatsceneholds so far lies below them. Returns how many surfaceschildcarried. A cache that carried any must be redrawn on every recorded frame: reused, its surfaces would show the opaque material.- layer_
scene - Floating surfaces drawn into
scenesit onlayer. The host names every scene it draws its frame into, so it can rebuild what lies below a surface: the scenes it composes under that layer, plusRecordedBackdrop::below. A host drawing one scene names it once. - nest_
scene childis a scene a widget draws now and composes into another scene afterwards withappend_nested(a subtree cache). Floating surfaces drawn into it wait there and take what lies below them once it is appended.childmust not move until then. A no-op outside a recording.