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: f32Diffuse 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: f32wcKSRD 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: GlassRefractionBackdrop projection model.
refraction_curve: f32Normalized wcKSRD ray-return exponent.
dispersion: f32Normalized wcKSRD spectral ray separation.
edge_spectrum: Option<GlassSpectrum>Optional directional spectrum for the edge-lens projection.
transmission_refraction: f32Fraction 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: f32Energy removed from the transmitted ray at the meniscus. Reflection and spectral return follow independent paths.
fold_depth: f32Depth 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: f32Uniform face magnification of a riding lens (1.0 = no zoom). The selected refraction model controls the surrounding rim band.
rim_reflection: f32Meniscus 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: f32Specular rim intensity.
face_lighting: boolWhether 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: boolDrop shadow below the glass.
shadow_style: Option<GlassShadow>Per-surface shadow override.
clip: boolClip 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: f32Strength of backdrop+foreground frost adaptation.
adaptive_tone: boolAdapts the face transfer curve to the mean captured backdrop brightness. Foreground polarity selects the preferred light or dark treatment.
resting_edge_sharpness: f32Resting edge sharpness, from a soft eight-dp fade at zero to pixel antialiasing at one.
Implementations§
Source§impl Glass
impl Glass
pub fn clear() -> Self
Sourcepub fn lens() -> Self
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.
Sourcepub fn face_lighting(self, enabled: bool) -> Self
pub fn face_lighting(self, enabled: bool) -> Self
Enables or disables diffuse face illumination without changing the specular rim.
Sourcepub fn resting_edge_sharpness(self, sharpness: f32) -> Self
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.
Sourcepub fn key_fill(self, lighting: GlassKeyFill) -> Self
pub fn key_fill(self, lighting: GlassKeyFill) -> Self
Uses opposing edge lights with a backdrop-dependent reflected color.
Self::highlight controls their opacity.
Sourcepub fn face_response(self, response: GlassFaceResponse) -> Self
pub fn face_response(self, response: GlassFaceResponse) -> Self
Sets the face attenuation and illumination around the edge-light pass.
Sourcepub fn inner_shadow(self, shadow: GlassShadow) -> Self
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.
pub fn shape(self, shape: LiquidShape) -> Self
pub fn tint(self, tint: Color) -> Self
Sourcepub fn transmission_tint(self, tint: Color, black: f32) -> Self
pub fn transmission_tint(self, tint: Color, black: f32) -> Self
Colors transmitted light while retaining the backdrop’s luminance structure.
pub fn blur_radius(self, radius_dp: f32) -> Self
pub fn saturation(self, saturation: f32) -> Self
pub fn refraction_depth(self, fraction: f32) -> Self
Sourcepub fn refraction_depth_dp(self, depth_dp: f32) -> Self
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.
Sourcepub fn surface_refraction(self, reach_dp: f32) -> Self
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.
Sourcepub fn edge_spectrum(self, spectrum: GlassSpectrum) -> Self
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.
Sourcepub fn edge_refraction(self, reach_dp: f32) -> Self
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.
pub fn refraction_curve(self, curve: f32) -> Self
pub fn dispersion(self, strength: f32) -> Self
pub fn transmission_refraction(self, strength: f32) -> Self
pub fn meniscus_absorption(self, strength: f32) -> Self
Sourcepub fn fold_depth(self, depth_dp: f32) -> Self
pub fn fold_depth(self, depth_dp: f32) -> Self
Sets the rim fold band depth in dp (zero disables the fold).
Sourcepub fn optical_zoom(self, zoom: f32) -> Self
pub fn optical_zoom(self, zoom: f32) -> Self
Sets the uniform face magnification of a riding lens (1.0 = none).
Sourcepub fn rim_reflection(self, reflectivity: f32) -> Self
pub fn rim_reflection(self, reflectivity: f32) -> Self
Sets the meniscus rim reflectivity (1.0 = full reference line).
Sourcepub fn ink_recolor(self, color: Color, strength: f32) -> Self
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.
pub fn highlight(self, highlight: f32) -> Self
Sourcepub fn lift(self, lift: f32) -> Self
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).
Sourcepub fn contrast(self, contrast: f32) -> Self
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).
pub fn adaptive_frost(self, foreground: Color, strength: f32) -> Self
Sourcepub fn adaptive_tone(self, foreground: Color) -> Self
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.
Sourcepub fn face_tone(self, tone: GlassFaceTone) -> Self
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.
pub fn shadow(self, shadow: bool) -> Self
pub fn shadow_style(self, shadow: GlassShadow) -> Self
Sourcepub fn no_clip(self) -> Self
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).
Sourcepub fn tint_amount(self, amount: GlassTintAmount) -> Self
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.
Sourcepub fn pane_blur_radius(self, radius: f32) -> Self
pub fn pane_blur_radius(self, radius: f32) -> Self
Sets the diffuse pane’s kernel reach, independently of its sharp transmitted image.
Sourcepub fn backdrop_blur(self, radius_dp: f32, opacity: f32) -> Self
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.
Sourcepub fn backdrop_effect(
&self,
colors: &LiquidColors,
density: f32,
dynamics: GlassDynamics,
) -> RenderEffect
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.