Skip to main content

Module surface

Module surface 

Source
Expand description

crate::surface — the backdrop surface a floating card sits on: wraps a popover/dialog card so its ENTIRE subtree paints inside one scene layer (a single draw order).

The single layer order is the point: with per-primitive bounds-tree ordering, a hover repaint elsewhere can reassign the card’s quads relative to siblings — inside one layer the card’s stacking is structural.

The blur is painted first, structurally under the content: inside one layer the order is blur, then shadow, tint, border, rows, text. It needs Window::paint_backdrop_blur from our gpui fork (macOS Metal only); elsewhere the primitive is ignored and the glass reads as the theme’s translucent tint over the OS window blur.

Material and glass are different things — a material has thickness, a glass has a variant — and they meet only at the numbers they resolve to, which is why one element paints both and theme::SurfaceStyle names which.

Structs§

Layered
Surface

Traits§

Surfaced
The backdrop surfaces, on any element carrying a corner radius.

Functions§

layered
Paint child in its own scene layer, giving it a fresh draw order above everything painted so far in the enclosing layer.
lensed
Whether [Glass::glass_effect] will actually refract here, or fall back to the flat backdrop tint. Capability and choice both: the primitive is macOS Metal’s and wgpu’s, and components with glass off paint no lens.
of
Paint an already-composed card as a surface, at the rounding the caller states — the shape the popover layers need, where the card arrives erased to an AnyElement and cannot be chained onto. The look comes off whichever theme paints it; a caller wanting its own hands one over through [Glass::glass_effect].
popover
The same, on [Theme::menu_style] — what the popover layers mount on, so an app moves every menu between frost and glass by moving one token.