Struct Finish
pub struct Finish { /* private fields */ }Expand description
What one surface role is made of: the painter set that draws it and that set’s parameters.
In a document a role names its painter set ("painter") beside the
set’s own parameters, the ones the set declares
(crate::part_paint::PartPainter::params):
| Document | Look |
|---|---|
{ "painter": "block" } | flat, square to the border |
{ "painter": "default" } | the design language’s opaque surfaces |
{ "painter": "default", "blur": 24, "tint": 0.72, "saturation": 1 } | the blurred backdrop under the ground at a tint |
{ "painter": "glass", "blur": …, "tint": …, "saturation": …, "refraction": …, "edge_highlight": …, "specular": … } | the same, bent and lit |
A set this build does not have, a parameter the set does not declare and a required one left out are not admitted.
The toolkit itself understands three parameters, whichever set states
them: blur (how far the backdrop is blurred, logical pixels), tint
(the ground’s opacity over it) and saturation. A role that states any
of them lets what is below it through (Finish::translucent).
Implementations§
§impl Finish
impl Finish
pub fn new<N>(
set: PainterSet,
params: impl IntoIterator<Item = (N, f32)>,
) -> Result<Finish, &'static str>
pub fn new<N>( set: PainterSet, params: impl IntoIterator<Item = (N, f32)>, ) -> Result<Finish, &'static str>
set with params, as the set declares them: every parameter it
requires stated, none it does not declare.
pub fn named<N>(
name: &str,
params: impl IntoIterator<Item = (N, f32)>,
) -> Result<Finish, &'static str>
pub fn named<N>( name: &str, params: impl IntoIterator<Item = (N, f32)>, ) -> Result<Finish, &'static str>
The set a document calls name, with params.
pub fn with_shader(self, source: Source) -> Finish
pub fn with_shader(self, source: Source) -> Finish
This finish with source as its surface shader.
pub fn frosted(blur: f32, tint: f32, saturation: f32) -> Finish
pub fn frosted(blur: f32, tint: f32, saturation: f32) -> Finish
The Default set showing what is below, blurred by blur logical
pixels, its colour scaled by saturation, under the ground at
tint opacity.
pub fn stock_floating() -> Finish
pub fn stock_floating() -> Finish
The stock floating material: the design language’s blurred panel.
pub fn stock_glass() -> Finish
pub fn stock_glass() -> Finish
The stock glass material: what a bar and the floating chrome are made of where a person
asks to see what lies below — the backdrop blurred, left mostly to show and a little
bent and lit at the rim, so a glass bar reads as glass over any wallpaper rather than
as its ground. Its tint stays high enough that the theme’s ink keeps the contrast
material_band holds every backdrop to, in light and in dark.
pub fn set(&self) -> &PainterSet
pub fn set(&self) -> &PainterSet
The set that draws this finish.
pub fn translucent(&self) -> bool
pub fn translucent(&self) -> bool
Whether the role lets what is below it through: it states a blur, a tint or a saturation.
pub fn saturation(&self) -> f32
pub fn saturation(&self) -> f32
The backdrop’s saturation; 1 where none is stated.
pub fn hairline(&self) -> bool
pub fn hairline(&self) -> bool
Whether the role draws the hairline the design language gives it: every set’s surfaces but Block’s, which carry the border alone.
pub fn opaque(&self) -> &Finish
pub fn opaque(&self) -> &Finish
The finish actually painted where nothing may be translucent (reduced transparency, high contrast): the toolkit’s own sets become solid, Block staying flat; a theme’s own set keeps drawing, every backdrop it asks for shown as its fallback.
pub fn forced(&self) -> &Finish
pub fn forced(&self) -> &Finish
The finish painted under forced colours: what they guarantee is not a theme’s set to keep, so always the toolkit’s own, solid (Block staying flat).
pub fn validate(&self) -> Result<(), &'static str>
pub fn validate(&self) -> Result<(), &'static str>
Structural check: every parameter finite and in the band its set
admits, and a shader a theme stated is a surface shader
(crate::tokens::shader::Source::validate).
pub fn usable(&self) -> Finish
pub fn usable(&self) -> Finish
This finish with every parameter held to the band its set is built at.
pub fn with_translucency(&self, strength: f32) -> Finish
pub fn with_translucency(&self, strength: f32) -> Finish
This finish at strength of its translucency: 0 turns its blur off
and its tint opaque (and a glass body’s light with it), 1 leaves it
as it is. An opaque finish stays as it is.
Trait Implementations§
§impl<'de> Deserialize<'de> for Finish
impl<'de> Deserialize<'de> for Finish
§fn deserialize<D>(
deserializer: D,
) -> Result<Finish, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Finish, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Serialize for Finish
impl Serialize for Finish
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Auto Trait Implementations§
impl Freeze for Finish
impl !RefUnwindSafe for Finish
impl Send for Finish
impl Sync for Finish
impl Unpin for Finish
impl UnsafeUnpin for Finish
impl !UnwindSafe for Finish
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more