pub enum Material {
Show 20 variants
Opaque,
Glass {
blur_radius: f32,
depth_index: u32,
},
Overlay,
Multiply,
Screen,
BlendOverlay,
Darken,
Lighten,
ColorDodge,
ColorBurn,
HardLight,
SoftLight,
Difference,
Exclusion,
Hue,
Saturation,
Color,
Luminosity,
Isolated,
ShaderEffect {
effect_name: String,
params_json: String,
},
}Expand description
Material type that determines which GPU pass a layer’s draw calls are routed to in the Backdrop Capture Architecture.
The blend mode variants correspond to the 16 SVG 1.1 blend modes from the CSS Compositing and Blending Level 1 specification. When a blend mode is set, the draw call’s fragment shader uses the corresponding blend function instead of standard alpha compositing.
Isolated triggers off-screen buffer rendering: the layer and all its
children are rendered to a separate texture, then composited back into the
main scene. This matches the SVG isolation property.
Variants§
Opaque
Opaque or standard UI. Rendered in the initial Scene Capture pass with standard alpha compositing (src-over).
Glass
Glassmorphism elements. Rendered in the Material Composite pass,
sampling from the Kawase Blur pyramid.
The blur_radius controls the blur intensity.
The depth_index (0=foreground, higher=more background) controls
depth-aware tinting: background windows get stronger tint.
Fields
Overlay
Overlay UI (crisp text, focus rings, edge lighting). Rendered in the final Foreground pass, on top of glass.
Multiply
Multiplied blend: multiplies source and destination colors. Formula: result = src * dst
Screen
Screen blend: inverse of multiply. Formula: result = 1 - (1 - src) * (1 - dst)
BlendOverlay
Overlay blend: combines multiply and screen based on destination. Formula: if dst < 0.5 then 2srcdst else 1-2*(1-src)*(1-dst)
Darken
Darken blend: keeps the darker of source and destination per channel. Formula: result = min(src, dst)
Lighten
Lighten blend: keeps the lighter of source and destination per channel. Formula: result = max(src, dst)
ColorDodge
Color-dodge blend: brightens destination to reflect source. Formula: result = dst / (1 - src)
ColorBurn
Color-burn blend: darkens destination to reflect source. Formula: result = 1 - (1 - dst) / src
HardLight
Hard-light blend: like overlay, but based on source instead of dest. Formula: if src < 0.5 then 2srcdst else 1-2*(1-src)*(1-dst)
SoftLight
Soft-light blend: subtle highlights/shadows. Formula: result = (1-2src)dst^2 + 2srcdst (simplified Pegtop)
Difference
Difference blend: subtracts colors and takes absolute value. Formula: result = |src - dst|
Exclusion
Exclusion blend: similar to difference but lower contrast. Formula: result = src + dst - 2srcdst
Hue
Hue blend: applies source hue to destination saturation/luminosity.
Saturation
Saturation blend: applies source saturation to destination hue/luminosity.
Color
Color blend: applies source hue/saturation to destination luminosity.
Luminosity
Luminosity blend: applies source luminosity to destination hue/saturation.
Isolated
Isolated rendering: layer and children are rendered to an off-screen
buffer, then composited back into the main scene. This matches the
SVG isolation property and is required for correct blend mode
behavior when child elements should not blend with the background.
ShaderEffect
Renders the layer and its children into an offscreen buffer, then applies a custom post-processing WGSL shader when blending back into the scene.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Material
impl<'de> Deserialize<'de> for Material
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Material
Auto Trait Implementations§
impl Freeze for Material
impl RefUnwindSafe for Material
impl Send for Material
impl Sync for Material
impl Unpin for Material
impl UnsafeUnpin for Material
impl UnwindSafe for Material
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.