pub type SrgbLuma<T = f32> = Luma<Srgb, T>;
Expand description
sRGB encoded luminance.
Aliased Type§
struct SrgbLuma<T = f32> {
pub luma: T,
pub standard: PhantomData<Srgb>,
}
Fields§
§luma: T
The lightness of the color. 0.0 is black and 1.0 is white.
standard: PhantomData<Srgb>
The kind of RGB standard. sRGB is the default.
Implementations
source§impl<S, T> Luma<S, T>where
T: Component,
S: LumaStandard,
impl<S, T> Luma<S, T>where
T: Component,
S: LumaStandard,
sourcepub fn into_format<U: Component>(self) -> Luma<S, U>
pub fn into_format<U: Component>(self) -> Luma<S, U>
Convert into another component type.
sourcepub fn from_format<U: Component>(color: Luma<S, U>) -> Self
pub fn from_format<U: Component>(color: Luma<S, U>) -> Self
Convert from another component type.
sourcepub fn into_components(self) -> (T,)
pub fn into_components(self) -> (T,)
Convert to a (luma,)
tuple.
sourcepub fn from_components((luma): (T,)) -> Self
pub fn from_components((luma): (T,)) -> Self
Convert from a (luma,)
tuple.
source§impl<S, T> Luma<S, T>
impl<S, T> Luma<S, T>
sourcepub fn into_linear(self) -> Luma<Linear<S::WhitePoint>, T>
pub fn into_linear(self) -> Luma<Linear<S::WhitePoint>, T>
Convert the color to linear luminance.
sourcepub fn from_linear(color: Luma<Linear<S::WhitePoint>, T>) -> Luma<S, T>
pub fn from_linear(color: Luma<Linear<S::WhitePoint>, T>) -> Luma<S, T>
Convert linear luminance to nonlinear luminance.
sourcepub fn into_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
self
) -> Luma<St, T>
pub fn into_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>( self ) -> Luma<St, T>
Convert the color to a different encoding.
sourcepub fn from_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>(
color: Luma<St, T>
) -> Luma<S, T>
pub fn from_encoding<St: LumaStandard<WhitePoint = S::WhitePoint>>( color: Luma<St, T> ) -> Luma<S, T>
Convert luminance from a different encoding.
Trait Implementations
source§impl<S, T> From<Alpha<Lab<<S as LumaStandard>::WhitePoint, T>, T>> for Luma<S, T>
impl<S, T> From<Alpha<Lab<<S as LumaStandard>::WhitePoint, T>, T>> for Luma<S, T>
source§impl<S, T, _S> From<Alpha<Hwb<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Alpha<Hwb<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<S, T> Pixel<T> for Luma<S, T>where
T: Component,
S: LumaStandard,
impl<S, T> Pixel<T> for Luma<S, T>where
T: Component,
S: LumaStandard,
source§fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
Cast as a mutable reference to raw color components.
source§fn into_raw<P: RawPixelSized<T>>(self) -> P
fn into_raw<P: RawPixelSized<T>>(self) -> P
Convert from raw color components.
source§fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
Cast from a reference to raw color components.
source§fn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
fn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
Cast from a mutable reference to raw color components.
source§fn from_raw_slice(slice: &[T]) -> &[Self]
fn from_raw_slice(slice: &[T]) -> &[Self]
Cast a slice of raw color components to a slice of colors. Read more
source§fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]
fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]
Cast a mutable slice of raw color components to a mutable slice of colors. Read more
source§impl<S, T, _S> From<Hsv<_S, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Hsv<_S, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<S, T, _S> From<Alpha<Luma<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: LumaStandard<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Alpha<Luma<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: LumaStandard<WhitePoint = S::WhitePoint>,
source§impl<S, T> From<Yxy<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T>
impl<S, T> From<Yxy<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T>
source§fn from(color: Yxy<S::WhitePoint, T>) -> Self
fn from(color: Yxy<S::WhitePoint, T>) -> Self
Converts to this type from the input type.
source§impl<S, T> Blend for Luma<S, T>
impl<S, T> Blend for Luma<S, T>
source§fn into_premultiplied(self) -> PreAlpha<Luma<S, T>, T>
fn into_premultiplied(self) -> PreAlpha<Luma<S, T>, T>
Convert the color to premultiplied alpha.
source§fn from_premultiplied(color: PreAlpha<Luma<S, T>, T>) -> Self
fn from_premultiplied(color: PreAlpha<Luma<S, T>, T>) -> Self
Convert the color from premultiplied alpha.
source§fn blend<F>(self, destination: Self, blend_function: F) -> Selfwhere
F: BlendFunction<Self::Color>,
fn blend<F>(self, destination: Self, blend_function: F) -> Selfwhere
F: BlendFunction<Self::Color>,
Blend self, as the source color, with
destination
, using
blend_function
. Anything that implements BlendFunction
is
acceptable, including functions and closures. Read moresource§fn over(self, other: Self) -> Self
fn over(self, other: Self) -> Self
Place
self
over other
. This is the good old common alpha
composition equation.source§fn inside(self, other: Self) -> Self
fn inside(self, other: Self) -> Self
Results in the parts of
self
that overlaps the visible parts of
other
.source§fn outside(self, other: Self) -> Self
fn outside(self, other: Self) -> Self
Results in the parts of
self
that lies outside the visible parts of
other
.source§fn plus(self, other: Self) -> Self
fn plus(self, other: Self) -> Self
Add
self
and other
. This uses the alpha component to regulate the
effect, so it’s not just plain component wise addition.source§fn multiply(self, other: Self) -> Self
fn multiply(self, other: Self) -> Self
Multiply
self
with other
. This uses the alpha component to regulate
the effect, so it’s not just plain component wise multiplication.source§fn screen(self, other: Self) -> Self
fn screen(self, other: Self) -> Self
Make a color which is at least as light as
self
or other
.source§fn overlay(self, other: Self) -> Self
fn overlay(self, other: Self) -> Self
Multiply
self
or other
if other is dark, or screen them if other
is light. This results in an S curve.source§fn dodge(self, other: Self) -> Self
fn dodge(self, other: Self) -> Self
Lighten
other
to reflect self
. Results in other
if self
is
black.source§fn burn(self, other: Self) -> Self
fn burn(self, other: Self) -> Self
Darken
other
to reflect self
. Results in other
if self
is
white.source§fn hard_light(self, other: Self) -> Self
fn hard_light(self, other: Self) -> Self
Multiply
self
or other
if other is dark, or screen them if self
is light. This is similar to overlay
, but depends on self
instead
of other
.source§fn soft_light(self, other: Self) -> Self
fn soft_light(self, other: Self) -> Self
Lighten
other
if self
is light, or darken other
as if it’s burned
if self
is dark. The effect is increased if the components of self
is further from 0.5.source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
Return the absolute difference between
self
and other
. It’s
basically abs(self - other)
, but regulated by the alpha component.source§impl<S, T> MulAssign<T> for Luma<S, T>
impl<S, T> MulAssign<T> for Luma<S, T>
source§fn mul_assign(&mut self, c: T)
fn mul_assign(&mut self, c: T)
Performs the
*=
operation. Read moresource§impl<S, T> From<Alpha<Xyz<<S as LumaStandard>::WhitePoint, T>, T>> for Luma<S, T>
impl<S, T> From<Alpha<Xyz<<S as LumaStandard>::WhitePoint, T>, T>> for Luma<S, T>
source§impl<S, T, _S> From<Hwb<_S, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Hwb<_S, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<S, T> AddAssign<T> for Luma<S, T>
impl<S, T> AddAssign<T> for Luma<S, T>
source§fn add_assign(&mut self, c: T)
fn add_assign(&mut self, c: T)
Performs the
+=
operation. Read moresource§impl<S, T> UlpsEq for Luma<S, T>
impl<S, T> UlpsEq for Luma<S, T>
source§impl<S, T, _S> From<Alpha<Hsv<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Alpha<Hsv<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<S, T, _S> From<Alpha<Rgb<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Alpha<Rgb<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<S, T> FromColor<<S as LumaStandard>::WhitePoint, T> for Luma<S, T>
impl<S, T> FromColor<<S as LumaStandard>::WhitePoint, T> for Luma<S, T>
source§fn from_xyz(color: Xyz<S::WhitePoint, T>) -> Self
fn from_xyz(color: Xyz<S::WhitePoint, T>) -> Self
Convert from XYZ color space
source§fn from_yxy(color: Yxy<S::WhitePoint, T>) -> Self
fn from_yxy(color: Yxy<S::WhitePoint, T>) -> Self
Convert from Yxy color space
source§fn from_rgb<S: RgbSpace<WhitePoint = Wp>>(inp: Rgb<Linear<S>, T>) -> Self
fn from_rgb<S: RgbSpace<WhitePoint = Wp>>(inp: Rgb<Linear<S>, T>) -> Self
Convert from RGB color space
source§fn from_hsl<S: RgbSpace<WhitePoint = Wp>>(inp: Hsl<S, T>) -> Self
fn from_hsl<S: RgbSpace<WhitePoint = Wp>>(inp: Hsl<S, T>) -> Self
Convert from HSL color space
source§impl<S, T> SubAssign for Luma<S, T>
impl<S, T> SubAssign for Luma<S, T>
source§fn sub_assign(&mut self, other: Luma<S, T>)
fn sub_assign(&mut self, other: Luma<S, T>)
Performs the
-=
operation. Read moresource§impl<S, T> From<Alpha<Yxy<<S as LumaStandard>::WhitePoint, T>, T>> for Luma<S, T>
impl<S, T> From<Alpha<Yxy<<S as LumaStandard>::WhitePoint, T>, T>> for Luma<S, T>
source§impl<S, T> Limited for Luma<S, T>where
T: Component,
S: LumaStandard,
impl<S, T> Limited for Luma<S, T>where
T: Component,
S: LumaStandard,
source§impl<S, Wp, T> IntoColor<Wp, T> for Luma<S, T>
impl<S, Wp, T> IntoColor<Wp, T> for Luma<S, T>
source§impl<S, T> AbsDiffEq for Luma<S, T>
impl<S, T> AbsDiffEq for Luma<S, T>
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
source§impl<S, T> DivAssign for Luma<S, T>
impl<S, T> DivAssign for Luma<S, T>
source§fn div_assign(&mut self, other: Luma<S, T>)
fn div_assign(&mut self, other: Luma<S, T>)
Performs the
/=
operation. Read moresource§impl<S, T> From<Alpha<Lch<<S as LumaStandard>::WhitePoint, T>, T>> for Luma<S, T>
impl<S, T> From<Alpha<Lch<<S as LumaStandard>::WhitePoint, T>, T>> for Luma<S, T>
source§impl<S, T> DivAssign<T> for Luma<S, T>
impl<S, T> DivAssign<T> for Luma<S, T>
source§fn div_assign(&mut self, c: T)
fn div_assign(&mut self, c: T)
Performs the
/=
operation. Read moresource§impl<S, T> From<Lch<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T>
impl<S, T> From<Lch<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T>
source§fn from(color: Lch<S::WhitePoint, T>) -> Self
fn from(color: Lch<S::WhitePoint, T>) -> Self
Converts to this type from the input type.
source§impl<S, T> RelativeEq for Luma<S, T>
impl<S, T> RelativeEq for Luma<S, T>
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
impl<S, T> StructuralPartialEq for Luma<S, T>where
T: Component,
S: LumaStandard,
source§impl<S, T> ComponentWise for Luma<S, T>where
T: Component,
S: LumaStandard,
impl<S, T> ComponentWise for Luma<S, T>where
T: Component,
S: LumaStandard,
source§impl<S, T, _S> From<Rgb<_S, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Rgb<_S, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<S, T> PartialEq for Luma<S, T>
impl<S, T> PartialEq for Luma<S, T>
impl<S, T> Copy for Luma<S, T>where
T: Component,
S: LumaStandard,
source§impl<S, T, _S> From<Alpha<Hsl<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
impl<S, T, _S> From<Alpha<Hsl<_S, T>, T>> for Luma<S, T>where
T: Component + Component + _FloatTrait,
S: LumaStandard,
_S: RgbSpace<WhitePoint = S::WhitePoint>,
source§impl<S, T> SubAssign<T> for Luma<S, T>
impl<S, T> SubAssign<T> for Luma<S, T>
source§fn sub_assign(&mut self, c: T)
fn sub_assign(&mut self, c: T)
Performs the
-=
operation. Read moresource§impl<S, T> From<Lab<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T>
impl<S, T> From<Lab<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T>
source§fn from(color: Lab<S::WhitePoint, T>) -> Self
fn from(color: Lab<S::WhitePoint, T>) -> Self
Converts to this type from the input type.
source§impl<S, T> MulAssign for Luma<S, T>
impl<S, T> MulAssign for Luma<S, T>
source§fn mul_assign(&mut self, other: Luma<S, T>)
fn mul_assign(&mut self, other: Luma<S, T>)
Performs the
*=
operation. Read moresource§impl<S, T> AddAssign for Luma<S, T>
impl<S, T> AddAssign for Luma<S, T>
source§fn add_assign(&mut self, other: Luma<S, T>)
fn add_assign(&mut self, other: Luma<S, T>)
Performs the
+=
operation. Read moresource§impl<'de, S, T> Deserialize<'de> for Luma<S, T>
impl<'de, S, T> Deserialize<'de> for Luma<S, T>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<S, T> From<Xyz<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T>
impl<S, T> From<Xyz<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T>
source§fn from(color: Xyz<S::WhitePoint, T>) -> Self
fn from(color: Xyz<S::WhitePoint, T>) -> Self
Converts to this type from the input type.