Struct Legible
pub struct Legible {
pub dark: f64,
pub light: f64,
}Expand description
The luminance range what shows through a translucent surface is
compressed into, so ink chosen against the surface’s ground stays
legible over anything below it: the material’s band
(material_band) as relative luminances. The backdrop pass maps what
it sampled into it (Self::tone is the same arithmetic): luminance
is compressed evenly in contrast (a contrast ratio below becomes a
smaller, fixed power of itself), and each colour keeps its hue: dimmed,
its channels scale with its luminance; lifted, it keeps how far its
channels stand off its grey, so a near-grey stays near-grey. A bright
photo shows dimmed but in its own colours and shapes, a dark page lifted
without a cast, never as one flat colour.
Fields§
§dark: f64Relative luminance black maps to.
light: f64Relative luminance white maps to.
Implementations§
§impl Legible
impl Legible
pub fn of(theme: &Theme, ground: AlphaColor<Srgb>) -> Legible
pub fn of(theme: &Theme, ground: AlphaColor<Srgb>) -> Legible
The range a surface of ground under theme holds what shows
through it in.
pub fn compresses(&self) -> bool
pub fn compresses(&self) -> bool
Whether anything is compressed.
pub fn tone(&self, rgb: [f64; 3]) -> [f64; 3]
pub fn tone(&self, rgb: [f64; 3]) -> [f64; 3]
rgb (sRGB-encoded, 0–1) as it shows through: its relative
luminance y mapped so (y + 0.05) / 0.05 becomes that ratio to
the power the band allows over the whole 21:1 range; its linear
channels’ offsets from y carried to the new luminance, scaled down
with it where it falls and kept where it rises; and pulled toward
grey only where a channel would leave the gamut. The backdrop pass’s
tone computes the same.
Trait Implementations§
impl Copy for Legible
impl StructuralPartialEq for Legible
Auto Trait Implementations§
impl Freeze for Legible
impl RefUnwindSafe for Legible
impl Send for Legible
impl Sync for Legible
impl Unpin for Legible
impl UnsafeUnpin for Legible
impl UnwindSafe for Legible
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