Skip to main content

Glass

Struct Glass 

Source
pub struct Glass {
Show 38 fields pub face_tone: Option<GlassFaceTone>, pub variant: GlassVariant, pub shape: LiquidShape, pub tint: Option<Color>, pub tint_transmission: Option<f32>, pub tint_amount: Option<GlassTintAmount>, pub pane_blur_radius: f32, pub blur_radius: Option<f32>, pub backdrop_blur: Option<(f32, f32)>, pub saturation: Option<f32>, pub refraction_depth: f32, pub refraction_depth_dp: Option<f32>, pub refraction: GlassRefraction, pub refraction_curve: f32, pub dispersion: f32, pub edge_spectrum: Option<GlassSpectrum>, pub transmission_refraction: f32, pub meniscus_absorption: f32, pub fold_depth: f32, pub optical_zoom: f32, pub rim_reflection: f32, pub ink_recolor: Option<(Color, f32)>, pub highlight: f32, pub face_lighting: bool, pub key_fill: Option<GlassKeyFill>, pub contour_highlight: Option<GlassContourHighlight>, pub specular_highlight: Option<GlassSpecularHighlight>, pub face_response: Option<GlassFaceResponse>, pub inner_shadow: Option<GlassShadow>, pub lift: Option<f32>, pub contrast: Option<f32>, pub shadow: bool, pub shadow_style: Option<GlassShadow>, pub clip: bool, pub foreground: Option<Color>, pub adaptive_frost: f32, pub adaptive_tone: bool, pub resting_edge_sharpness: f32,
}
Expand description

Builder describing a glass material. Resolved against the theme at the composition site, then evaluated per frame for density and dynamics.

Fields§

§face_tone: Option<GlassFaceTone>

Optional fixed face transfer, replacing adaptive tone, saturation, contrast and lift.

§variant: GlassVariant§shape: LiquidShape§tint: Option<Color>

Tint over the refracted backdrop; defaults to the theme’s glass tint.

§tint_transmission: Option<f32>

Minimum transmitted luminance for a colored tint. None uses alpha tinting.

§tint_amount: Option<GlassTintAmount>

Optional sharp/blurred pane blend, separate from the color tint.

§pane_blur_radius: f32

Diffuse pane kernel reach in dp; its Gaussian standard deviation is half this value.

§blur_radius: Option<f32>

Backdrop blur radius in dp (defaults per variant).

§backdrop_blur: Option<(f32, f32)>

Radius in dp and opacity of the blurred backdrop mixed with an edge lens’s outer warp.

§saturation: Option<f32>

Saturation boost (defaults per variant).

§refraction_depth: f32

wcKSRD refraction depth as a fraction of the shape inradius. Regular frosted surfaces default to zero so their backdrop stays motion-stable; interactive lenses opt into optical displacement explicitly.

§refraction_depth_dp: Option<f32>

Optional physical wcKSRD refraction depth in dp. When present, this keeps the optical band equally deep across surfaces with different inradii instead of scaling it from each surface’s height.

§refraction: GlassRefraction

Backdrop projection model.

§refraction_curve: f32

Normalized wcKSRD ray-return exponent.

§dispersion: f32

Normalized wcKSRD spectral ray separation.

§edge_spectrum: Option<GlassSpectrum>

Optional directional spectrum for the edge-lens projection.

§transmission_refraction: f32

Fraction of the wcKSRD displacement applied to the transmitted backdrop. Regular frosted surfaces default to zero. The mirrored meniscus follows its own optical path.

§meniscus_absorption: f32

Energy removed from the transmitted ray at the meniscus. Reflection and spectral return follow independent paths.

§fold_depth: f32

Depth of the rim fold band in dp: the raised lens rim replays its interior mirrored toward the edge (a pure displacement). Zero disables the fold.

§optical_zoom: f32

Uniform face magnification of a riding lens (1.0 = no zoom). The selected refraction model controls the surrounding rim band.

§rim_reflection: f32

Meniscus rim reflectivity multiplier (1.0 = the reference toggle’s visible rim line; near 0 = the segmented lens’s invisible body).

§ink_recolor: Option<(Color, f32)>

Optical ink recolor: the lens recolors dark transmitted ink toward this color at the given strength (the reference tab bubble’s color-mask act). None = off.

§highlight: f32

Specular rim intensity.

§face_lighting: bool

Whether the face receives the material’s diffuse directional illumination.

§key_fill: Option<GlassKeyFill>

Replaces dome lighting with a pair of opposing edge lights.

§contour_highlight: Option<GlassContourHighlight>

Contour reflection applied before the foreground’s spectral dispersion.

§specular_highlight: Option<GlassSpecularHighlight>

Directional rim reflection applied above the transmitted and tinted surface.

§face_response: Option<GlassFaceResponse>

Attenuation and illumination applied around the edge-light pass.

§inner_shadow: Option<GlassShadow>

Inset shadow on the transmitted face, covered by the chromatic foreground.

§lift: Option<f32>

Screen-lift override (brightening toward white; negative darkens). Defaults per variant.

§contrast: Option<f32>

Tone-compression override around the shader’s mid pivot (<1 pulls every backdrop toward mid-luminance — the reference dark menu reads bright magenta over deep purple AND dim gray over white through one law). Defaults per variant.

§shadow: bool

Drop shadow below the glass.

§shadow_style: Option<GlassShadow>

Per-surface shadow override.

§clip: bool

Clip the layer to shape. Morphing glass disables this — coverage comes entirely from the shader’s SDF.

§foreground: Option<Color>

Foreground color whose contrast the frost must protect. None uses the theme label color.

§adaptive_frost: f32

Strength of backdrop+foreground frost adaptation.

§adaptive_tone: bool

Adapts the face transfer curve to the mean captured backdrop brightness. Foreground polarity selects the preferred light or dark treatment.

§resting_edge_sharpness: f32

Resting edge sharpness, from a soft eight-dp fade at zero to pixel antialiasing at one.

Implementations§

Source§

impl Glass

Source

pub fn regular() -> Self

A motion-stable frosted surface without optical displacement.

Source

pub fn clear() -> Self

Source

pub fn lens() -> Self

An interactive glass lens with a radial projection and spectral rim. Self::edge_refraction selects an outward rim around a uniformly magnified face.

Source

pub fn face_lighting(self, enabled: bool) -> Self

Enables or disables diffuse face illumination without changing the specular rim.

Source

pub fn resting_edge_sharpness(self, sharpness: f32) -> Self

Sets the resting edge sharpness from zero (eight-dp fade) to one (pixel antialiasing). Out-of-range values are clamped; nonfinite values preserve the soft default.

Source

pub fn key_fill(self, lighting: GlassKeyFill) -> Self

Uses opposing edge lights with a backdrop-dependent reflected color. Self::highlight controls their opacity.

Source

pub fn face_response(self, response: GlassFaceResponse) -> Self

Sets the face attenuation and illumination around the edge-light pass.

Source

pub fn inner_shadow(self, shadow: GlassShadow) -> Self

Adds an inset shadow with a Gaussian falloff from the live surface outline. The chromatic foreground covers this shadow without refracting it. Nonfinite values, negative radii, and opacity outside zero to one disable it.

Source

pub fn shape(self, shape: LiquidShape) -> Self

Source

pub fn tint(self, tint: Color) -> Self

Source

pub fn transmission_tint(self, tint: Color, black: f32) -> Self

Colors transmitted light while retaining the backdrop’s luminance structure.

Source

pub fn blur_radius(self, radius_dp: f32) -> Self

Source

pub fn saturation(self, saturation: f32) -> Self

Source

pub fn refraction_depth(self, fraction: f32) -> Self

Source

pub fn refraction_depth_dp(self, depth_dp: f32) -> Self

Uses a density-stable physical refraction depth instead of a fraction of the live shape inradius.

Source

pub fn surface_refraction(self, reach_dp: f32) -> Self

Selects a circular depth profile along the surface normal, preserving tangential background coordinates along straight edges. reach_dp sets the inward displacement independently of depth; both remain fixed under surface scaling. Negative and nonfinite reach values become zero.

Source

pub fn edge_spectrum(self, spectrum: GlassSpectrum) -> Self

Overrides the edge lens’s spectrum; radial and surface projections use dispersion. Invalid profiles are ignored. The signed spacing supports continuous color reversal.

Source

pub fn edge_refraction(self, reach_dp: f32) -> Self

Selects a rim that enters inward, crests outward and returns smoothly to the face. reach_dp controls its maximum outward displacement; negative and nonfinite values become zero. Its inward return uses the amplitude and depth ratios in GlassRefraction::EdgeLens.

Source

pub fn refraction_curve(self, curve: f32) -> Self

Source

pub fn dispersion(self, strength: f32) -> Self

Source

pub fn transmission_refraction(self, strength: f32) -> Self

Source

pub fn meniscus_absorption(self, strength: f32) -> Self

Source

pub fn fold_depth(self, depth_dp: f32) -> Self

Sets the rim fold band depth in dp (zero disables the fold).

Source

pub fn optical_zoom(self, zoom: f32) -> Self

Sets the uniform face magnification of a riding lens (1.0 = none).

Source

pub fn rim_reflection(self, reflectivity: f32) -> Self

Sets the meniscus rim reflectivity (1.0 = full reference line).

Source

pub fn ink_recolor(self, color: Color, strength: f32) -> Self

The lens recolors dark transmitted ink toward color at strength (0..1) — the reference bubble’s color-mask act as a material optic.

Source

pub fn highlight(self, highlight: f32) -> Self

Source

pub fn lift(self, lift: f32) -> Self

Overrides the screen-lift (how hard the glass brightens what it shows; the bar lens uses a near-zero lift to stay transmissive).

Source

pub fn contrast(self, contrast: f32) -> Self

Overrides the tone compression around the shader’s mid pivot (values below one pull every backdrop toward mid-luminance).

Source

pub fn adaptive_frost(self, foreground: Color, strength: f32) -> Self

Source

pub fn adaptive_tone(self, foreground: Color) -> Self

Uses the captured backdrop’s mean brightness to adapt the face transfer curve. This replaces local frost adaptation, saturation, contrast, lift and the key/fill color response. Tint and edge-light geometry still apply. The foreground chooses the preferred polarity, with dark treatment over black backgrounds and light treatment over white backgrounds.

Source

pub fn face_tone(self, tone: GlassFaceTone) -> Self

Uses a fixed face transfer without reading a mean-backdrop texture. Invalid parameters disable the fixed transfer.

Source

pub fn shadow(self, shadow: bool) -> Self

Source

pub fn shadow_style(self, shadow: GlassShadow) -> Self

Source

pub fn no_clip(self) -> Self

Disables the layer clip: the shader’s SDF coverage is the only shape (required while morphing across geometry the clip can’t follow).

Source

pub fn tint_amount(self, amount: GlassTintAmount) -> Self

Uses a sharp/blurred backdrop blend controlled by the tint percentage. This replaces the whole-backdrop blur for this material.

Source

pub fn pane_blur_radius(self, radius: f32) -> Self

Sets the diffuse pane’s kernel reach, independently of its sharp transmitted image.

Source

pub fn backdrop_blur(self, radius_dp: f32, opacity: f32) -> Self

Crossfades the edge lens’s outer warp with a fixed-radius blurred backdrop. Radius uses the renderer’s Gaussian convention: twice the standard deviation, in dp. Nonfinite values disable the blend; finite radius is nonnegative and opacity is clamped to 0–1.

Source

pub fn backdrop_effect( &self, colors: &LiquidColors, density: f32, dynamics: GlassDynamics, ) -> RenderEffect

The backdrop effect this material produces for a node at density under dynamics, resolved against colors: the render effect the glass modifiers install, for a layer built without them.

Trait Implementations§

Source§

impl Clone for Glass

Source§

fn clone(&self) -> Self

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 Glass

Source§

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

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

impl Default for Glass

Source§

fn default() -> Self

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

impl PartialEq for Glass

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Glass

Auto Trait Implementations§

§

impl Freeze for Glass

§

impl RefUnwindSafe for Glass

§

impl Send for Glass

§

impl Sync for Glass

§

impl Unpin for Glass

§

impl UnsafeUnpin for Glass

§

impl UnwindSafe for Glass

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> AnyEq for T
where T: Any + PartialEq,

Source§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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<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> 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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.