pub struct Material {Show 28 fields
pub refraction: f32,
pub depth: f32,
pub outer_refraction: f32,
pub outer_depth: f32,
pub pinch: f32,
pub pinch_width: f32,
pub sideways: f32,
pub dispersion: f32,
pub corner_dispersion: f32,
pub blur: f32,
pub magnify: f32,
pub light_range: (f32, f32),
pub dark_range: (f32, f32),
pub saturation: f32,
pub rim: f32,
pub rim_width: f32,
pub rim_base: f32,
pub dark_edge: f32,
pub light_spill: f32,
pub inner_glow: f32,
pub inner_shadow: f32,
pub shadow: f32,
pub shadow_radius: f32,
pub shadow_y: f32,
pub shadow_tint: f32,
pub tint: Option<Color>,
pub tint_follow: f32,
pub glass_tint_response: f32,
}Expand description
The optical parameters of glass. Lengths are in points.
The surface is flat in the middle and curves down near its outline.
Light passing through the curved part bends towards the middle, so the
edge shows the backdrop from further inside. Start from a preset such as
Material::REGULAR and change what you need.
Fields§
§refraction: f32How far the curved edge bends the backdrop towards the middle.
depth: f32Width of the curved edge, measured inwards from the outline.
outer_refraction: f32Bend in the opposite direction, in a thin ring right at the outline.
outer_depth: f32Width of the outer ring.
pinch: f32Outward bend in a wide zone further in, like the raised shoulder of a drop of liquid.
pinch_width: f32Width of the pinch zone.
sideways: f320 bends equally in all directions. At 1 the main bend works only sideways and the pinch only up and down.
dispersion: f32Separation of colors at the edge, as a fraction of the bend.
corner_dispersion: f320 separates colors evenly around the outline. At 1 only the corners do, with the order of the colors alternating from corner to corner.
blur: f32Blur radius of the backdrop.
magnify: f32Magnification of the backdrop. 1 shows it at its real size.
light_range: (f32, f32)Range the backdrop brightness is mapped to on light glass, as
(darkest, brightest).
dark_range: (f32, f32)Range the backdrop brightness is mapped to on dark glass.
saturation: f32Color saturation of the backdrop. 1 keeps it unchanged.
rim: f32Strength of the bright edge that catches the light.
rim_width: f32Width of the bright edge.
rim_base: f32Part of the bright edge that shows all around, whatever the light direction.
dark_edge: f32Strength of the thin dark line just inside the outline.
light_spill: f32Light from the surroundings that spills onto the edge.
inner_glow: f32Glow on the side facing away from the light.
inner_shadow: f32Shade on the side facing the light.
shadow: f32Opacity of the drop shadow.
shadow_radius: f32Blur radius of the drop shadow.
shadow_y: f32Downward offset of the drop shadow.
shadow_tint: f32How much of the color of the light passing through the shadow carries, from 0 (gray) to 1.
tint: Option<Color>Colored glass. The alpha is the strength of the color.
tint_follow: f32How much the tint follows the brightness of the backdrop. 0 is a flat fill.
glass_tint_response: f32How much Theme::glass_tint and reduced
transparency change this material, from 0 to 1. Use 0 for glass that
must stay clear, such as a lens above its own label.
Implementations§
Source§impl Material
impl Material
Sourcepub const CLEAR: Material
pub const CLEAR: Material
Clear glass that stays transparent, for controls over photos and video.
Sourcepub const THICK: Material
pub const THICK: Material
Menus, sheets, windows and panels: thicker, with a deeper shadow and softer light.
Sourcepub const LENS: Material
pub const LENS: Material
The lens a slider, switch or segment thumb turns into while it is held.
Sourcepub const BLOB: Material
pub const BLOB: Material
The selection of a tab bar while it is held: a clear blob that stands out from the bar. A thin rim shows the bar from further inside, and the wide zone behind it pulls the edge of the bar inwards.
Sourcepub const BLOB_LABELS: Material
pub const BLOB_LABELS: Material
Bends the tab labels under Material::BLOB: near its outline they
smear inwards.
Sourcepub fn blur(radius: f32) -> Material
pub fn blur(radius: f32) -> Material
Glass that only blurs: no bend, edge, light, shadow or tint. See
Painter::blur.
Sourcepub fn tinted(self, color: Color) -> Self
pub fn tinted(self, color: Color) -> Self
Returns the material colored with color. Its alpha is the strength.
Trait Implementations§
impl Copy for Material
impl StructuralPartialEq for Material
Auto Trait Implementations§
impl Forget for Material
impl Freeze for Material
impl Move 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,
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.