Upstream: crates/rune/README.md § Subtree blur and rounded layer clips at
65f8eb43f710, MIT © Anomaly. Bundled by build-rune-apps; links point at this snapshot or at GitHub at that rev.
Subtree blur and rounded layer clips
el().blur(1.5).blur_motion(rune_motion::Curve::ease_in_out(0.2)).child(content)
el().live_blur(blur.smooth(Spring::new(0.3, 0.0))).child(content)
Blur is Gaussian standard deviation in points. Ordinary target changes use the element's
motion spring; blur_motion selects a curve or a different spring. Presence-transition blur
uses the same completed-subtree filter. Zero creates no filter passes or textures, and a
single blurred primitive still opens a scope. Nested blur, dissolve, native video and image
atlas pages use the same path. A dissolve saturates its source texels before convolution.
The renderer caps sigma at 64 device pixels and expands bounds by ceil(3 * sigma), retaining
off-viewport sources that can affect visible pixels. Sigma up to 3 px uses two full-resolution
Gaussian passes with paired linear samples. Wider kernels use area downsampling, two Gaussian
passes and linear reconstruction, with resolution varying continuously with sigma. This is an
approximation; tested rectangle coverage differs from a full-resolution Gaussian by at most
2/255 through sigma 64. Scratch textures follow the layer's allocation bucket and are released
at zero. They cache storage, not frames.
Low-level callers can mask the completed output, after blur:
Instance::begin_layer(bounds, [left, top, right, bottom], LayerSpec {
blur: 3.0, clip_radius: 20.0, ..Default::default()
})
clip_radius uses device pixels and clamps to half the shorter clip dimension. Each scope
keeps its own rounded rectangle, so nested masks do not move when rectangles intersect.
Use el().clip_rounded(radius) for the same mask in logical points on an element and its
descendants. Ordinary paint clips directly; isolated subtrees clip after filtering. Hit tests
remain rectangular, including visually clipped corners. The 128-byte instance stores radius
in attribute 7 fade[3].
For a known opaque neutral backdrop, use theme::srgb_equivalent(white.alpha(authored_alpha), bg)
to match AppKit's sRGB source-over in a window that blends in linear light (srgb_blend(false));
theme::for_blend applies it only in such a window. Recompute from the current authored
alpha during animation. This changes only alpha and adds no GPU work. It is exact for neutral
foreground/background pairs apart from quantization, but chromatic pairs are approximate;
unknown/translucent backdrops, group opacity and overlapping paints require different math.