Skip to main content

Material

Enum Material 

Source
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

§blur_radius: f32
§depth_index: u32

Z-order depth for depth-aware tinting. 0 = key/foreground window. Higher values = more background. Default: 0.

§

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.

Fields

§effect_name: String

Name of the registered shader effect (e.g. “HeatShimmer”)

§params_json: String

Dynamic parameters for the shader, serialized as a JSON string

Trait Implementations§

Source§

impl Clone for Material

Source§

fn clone(&self) -> Material

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Material

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Material

Source§

fn default() -> Material

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Material

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Material

Source§

fn eq(&self, other: &Material) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Material

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Material

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.