Skip to main content

Module frost

Module frost 

Source
Expand description

A surface that shows what is behind it, out of focus.

Frost is the backing a popover, a dialog or a rail is placed on when the window itself is translucent: the pixels underneath are blurred, and the surface colour is laid over the blur at effect.glassAlpha so the content on top keeps its contrast.

§One layer, in one order

The whole subtree paints inside a single scene layer, which is the reason this is an element and not a styled div. Paint order is per-primitive otherwise, so a repaint elsewhere in the frame can reorder the surface’s own quads underneath the blur — a divider or a border is then snapshotted and blurred away, intermittently, in a way no test reproduces. Inside one layer the relationship is structural: blur first, fill and content after.

§Where blur does not exist

A backdrop blur is a renderer capability, not a paintable colour. Where the renderer has none the blur is dropped and the tinted fill is all that remains, which is a legible surface rather than a broken one — this is why the fill is painted whether or not the blur was. A theme that declares itself opaque by setting effect.glassAlpha to 1 takes the same path deliberately: there is nothing to see through, so nothing is blurred.

Structs§

Frost
A frosted-glass surface: blurred backdrop, tinted fill, caller’s content.