Lms

Struct Lms 

Source
#[repr(C)]
pub struct Lms<M, T> { pub long: T, pub medium: T, pub short: T, pub meta: PhantomData<M>, }
Expand description

Generic LMS.

LMS represents the response of the eye’s cone cells. L, M and S are for “long”, “medium” and “short” wavelengths, roughly corresponding to red, green and blue. Many newer mentions of an LMS representation use the letters R, G and B instead (or sometimes ρ, γ, β), but this library sticks to LMS to differentiate it from Rgb.

The LMS color space is a model of the physiological response to color stimuli. It has some mathematical shortcomings that Xyz improves on, such as severe spectral sensitivity overlap between L, M and S. Despite this, LMS has a lot of uses, include chromatic adaptation and emulating different types of color vision deficiency, and it’s sometimes part of the conversion process between other color spaces.

§Creating a Value

An LMS value is often derived from another color space, through a conversion matrix. Two such matrices are VonKries and Bradford, and Palette offers type aliases in the lms module to make using them a bit more convenient. It’s of course also possible to simply use Lms::new, but it may not be as intuitive.

use palette::{
    lms::{Lms, VonKriesLms, matrix::VonKries},
    white_point::D65,
    Srgb, FromColor
};

let von_kries_lms = Lms::<VonKries, f32>::new(0.1, 0.2, 0.3);
let von_kries_d65_lms = VonKriesLms::<D65, f32>::new(0.1, 0.2, 0.3);

// `new` is also `const`:
const VON_KRIES_LMS: Lms<VonKries, f32> = Lms::new(0.1, 0.2, 0.3);

// Von Kries LMS from sRGB:
let lms_from_srgb = VonKriesLms::<D65, f32>::from_color(Srgb::new(0.3f32, 0.8, 0.1));

// It's also possible to convert from (and to) arrays and tuples:
let lms_from_array = VonKriesLms::<D65, f32>::from([0.1, 0.2, 0.3]);
let lms_from_tuple = VonKriesLms::<D65, f32>::from((0.1, 0.2, 0.3));

Fields§

§long: T

Stimulus from long wavelengths, or red, or ρ. The typical range is between 0.0 and 1.0, but it doesn’t have an actual upper bound.

§medium: T

Stimulus from medium wavelengths, or green, or γ. The typical range is between 0.0 and 1.0, but it doesn’t have an actual upper bound.

§short: T

Stimulus from short wavelengths, or blue, or β. The typical range is between 0.0 and 1.0, but it doesn’t have an actual upper bound.

§meta: PhantomData<M>

Type level meta information, such as reference white, or which matrix was used when converting from XYZ.

Implementations§

Source§

impl<M, T> Lms<M, T>

Source

pub const fn new(long: T, medium: T, short: T) -> Self

Create a new LMS color.

Source

pub fn into_format<U>(self) -> Lms<M, U>
where U: FromStimulus<T>,

Convert the LMS components into another number type.

use palette::{
    lms::VonKriesLms,
    white_point::D65,
};

let lms_f64: VonKriesLms<D65, f64> = VonKriesLms::new(0.3f32, 0.7, 0.2).into_format();
Source

pub fn from_format<U>(color: Lms<M, U>) -> Self
where T: FromStimulus<U>,

Convert the LMS components from another number type.

use palette::{
    lms::VonKriesLms,
    white_point::D65,
};

let lms_f64 = VonKriesLms::<D65, f64>::from_format(VonKriesLms::new(0.3f32, 0.7, 0.2));
Source

pub fn into_components(self) -> (T, T, T)

Convert to a (long, medium, short) tuple.

Source

pub fn from_components((long, medium, short): (T, T, T)) -> Self

Convert from a (long, medium, short) tuple.

Source

pub fn with_meta<NewM>(self) -> Lms<NewM, T>

Changes the meta type without changing the color value.

This function doesn’t change the numerical values, and thus the stimuli it represents in an absolute sense. However, the appearance of the color may not be the same. The effect may be similar to taking a photo with an incorrect white balance.

Source§

impl<M, T> Lms<M, T>
where T: Zero,

Source

pub fn min_short() -> T

Return the short value minimum.

Source

pub fn min_medium() -> T

Return the medium value minimum.

Source

pub fn min_long() -> T

Return the long value minimum.

Source§

impl<M, T> Lms<M, T>

Source

pub fn matrix_from_xyz() -> Matrix3<Xyz<M::XyzMeta, T>, Self>

Produce a conversion matrix from Xyz to Lms.

Source§

impl<M, T> Lms<M, &T>

Source

pub fn copied(&self) -> Lms<M, T>
where T: Copy,

Get an owned, copied version of this color.

Source

pub fn cloned(&self) -> Lms<M, T>
where T: Clone,

Get an owned, cloned version of this color.

Source§

impl<M, T> Lms<M, &mut T>

Source

pub fn set(&mut self, value: Lms<M, T>)

Update this color with new values.

Source

pub fn as_refs(&self) -> Lms<M, &T>

Borrow this color’s components as shared references.

Source

pub fn copied(&self) -> Lms<M, T>
where T: Copy,

Get an owned, copied version of this color.

Source

pub fn cloned(&self) -> Lms<M, T>
where T: Clone,

Get an owned, cloned version of this color.

Source§

impl<M, C> Lms<M, C>

Source

pub fn iter<'a>(&'a self) -> <&'a Self as IntoIterator>::IntoIter
where &'a Self: IntoIterator,

Return an iterator over the colors in the wrapped collections.

Source

pub fn iter_mut<'a>(&'a mut self) -> <&'a mut Self as IntoIterator>::IntoIter
where &'a mut Self: IntoIterator,

Return an iterator that allows modifying the colors in the wrapped collections.

Source

pub fn get<'a, I, T>( &'a self, index: I, ) -> Option<Lms<M, &'a <I as SliceIndex<[T]>>::Output>>
where T: 'a, C: AsRef<[T]>, I: SliceIndex<[T]> + Clone,

Get a color, or slice of colors, with references to the components at index. See slice::get for details.

Source

pub fn get_mut<'a, I, T>( &'a mut self, index: I, ) -> Option<Lms<M, &'a mut <I as SliceIndex<[T]>>::Output>>
where T: 'a, C: AsMut<[T]>, I: SliceIndex<[T]> + Clone,

Get a color, or slice of colors, that allows modifying the components at index. See slice::get_mut for details.

Source§

impl<M, T> Lms<M, Vec<T>>

Source

pub fn with_capacity(capacity: usize) -> Self

Create a struct of vectors with a minimum capacity. See Vec::with_capacity for details.

Source

pub fn push(&mut self, value: Lms<M, T>)

Push an additional color’s components onto the component vectors. See Vec::push for details.

Source

pub fn pop(&mut self) -> Option<Lms<M, T>>

Pop a color’s components from the component vectors. See Vec::pop for details.

Source

pub fn clear(&mut self)

Clear the component vectors. See Vec::clear for details.

Source

pub fn drain<R>(&mut self, range: R) -> Iter<Drain<'_, T>, M>
where R: RangeBounds<usize> + Clone,

Return an iterator that moves colors out of the specified range.

Trait Implementations§

Source§

impl<M, T> AbsDiffEq for Lms<M, T>
where T: AbsDiffEq, T::Epsilon: Clone,

Available on crate feature approx only.
Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
Source§

fn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Self, epsilon: T::Epsilon) -> bool

The inverse of [AbsDiffEq::abs_diff_eq].
Source§

impl<M, T> Add<T> for Lms<M, T>
where T: Add<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type after applying the + operator.
Source§

fn add(self, c: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<M, T> Add for Lms<M, T>
where T: Add<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<M, T> AddAssign<T> for Lms<M, T>
where T: AddAssign + Clone,

Source§

fn add_assign(&mut self, c: T)

Performs the += operation. Read more
Source§

impl<M, T> AddAssign for Lms<M, T>
where T: AddAssign,

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<M, T> ArrayCast for Lms<M, T>

Source§

type Array = [T; 3]

The output type of a cast to an array.
Source§

impl<M, T> AsMut<[T]> for Lms<M, T>

Source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<M, T> AsMut<[T; 3]> for Lms<M, T>

Source§

fn as_mut(&mut self) -> &mut [T; 3]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<M, T> AsMut<Lms<M, T>> for [T; 3]

Source§

fn as_mut(&mut self) -> &mut Lms<M, T>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<M, T> AsRef<[T]> for Lms<M, T>

Source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<M, T> AsRef<[T; 3]> for Lms<M, T>

Source§

fn as_ref(&self) -> &[T; 3]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<M, T> AsRef<Lms<M, T>> for [T; 3]

Source§

fn as_ref(&self) -> &Lms<M, T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<M, T> Clamp for Lms<M, T>
where T: Clamp + Stimulus,

Source§

fn clamp(self) -> Self

Return a new color where out-of-bounds components have been changed to the nearest valid values. Read more
Source§

impl<M, T> ClampAssign for Lms<M, T>
where T: ClampAssign + Stimulus,

Source§

fn clamp_assign(&mut self)

Changes out-of-bounds components to the nearest valid values. Read more
Source§

impl<M, T> Clone for Lms<M, T>
where T: Clone,

Source§

fn clone(&self) -> Lms<M, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: Debug, T: Debug> Debug for Lms<M, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M, T> Default for Lms<M, T>
where T: Default,

Source§

fn default() -> Lms<M, T>

Returns the “default value” for a type. Read more
Source§

impl<'de, M, T> Deserialize<'de> for Lms<M, T>
where T: Deserialize<'de>,

Source§

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<M, T> Distribution<Lms<M, T>> for Standard

Available on crate feature random only.
Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Lms<M, T>

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl<M, T> Div<T> for Lms<M, T>
where T: Div<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type after applying the / operator.
Source§

fn div(self, c: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<M, T> Div for Lms<M, T>
where T: Div<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type after applying the / operator.
Source§

fn div(self, other: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<M, T> DivAssign<T> for Lms<M, T>
where T: DivAssign + Clone,

Source§

fn div_assign(&mut self, c: T)

Performs the /= operation. Read more
Source§

impl<M, T> DivAssign for Lms<M, T>
where T: DivAssign,

Source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
Source§

impl<M, T> EuclideanDistance for Lms<M, T>
where T: Real + Sub<T, Output = T> + Add<T, Output = T> + Mul<T, Output = T> + Clone,

Source§

type Scalar = T

The type for the distance value.
Source§

fn distance_squared(self, other: Self) -> Self::Scalar

Calculate the squared Euclidean distance from self to other. Read more
Source§

fn distance(self, other: Self) -> Self::Scalar
where Self::Scalar: Sqrt,

Calculate the Euclidean distance from self to other.
Source§

impl<M, T, C> Extend<Lms<M, T>> for Lms<M, C>
where C: Extend<T>,

Source§

fn extend<I: IntoIterator<Item = Lms<M, T>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, M, T> From<&'a [T; 3]> for &'a Lms<M, T>

Source§

fn from(array: &'a [T; 3]) -> Self

Converts to this type from the input type.
Source§

impl<'a, M, T> From<&'a Lms<M, T>> for &'a [T]

Source§

fn from(color: &'a Lms<M, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, M, T> From<&'a Lms<M, T>> for &'a [T; 3]

Source§

fn from(color: &'a Lms<M, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, M, T> From<&'a mut [T; 3]> for &'a mut Lms<M, T>

Source§

fn from(array: &'a mut [T; 3]) -> Self

Converts to this type from the input type.
Source§

impl<'a, M, T> From<&'a mut Lms<M, T>> for &'a mut [T]

Source§

fn from(color: &'a mut Lms<M, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, M, T> From<&'a mut Lms<M, T>> for &'a mut [T; 3]

Source§

fn from(color: &'a mut Lms<M, T>) -> Self

Converts to this type from the input type.
Source§

impl<M, T, V, const N: usize> From<[Lms<M, T>; N]> for Lms<M, V>
where [T; N]: Default, V: FromScalarArray<N, Scalar = T>,

Source§

fn from(colors: [Lms<M, T>; N]) -> Self

Converts to this type from the input type.
Source§

impl<M, T> From<[T; 3]> for Lms<M, T>

Source§

fn from(array: [T; 3]) -> Self

Converts to this type from the input type.
Source§

impl<M, T> From<(T, T, T)> for Lms<M, T>

Source§

fn from(components: (T, T, T)) -> Self

Converts to this type from the input type.
Source§

impl<M, T> From<Box<[T; 3]>> for Box<Lms<M, T>>

Available on crate feature alloc only.
Source§

fn from(array: Box<[T; 3]>) -> Self

Converts to this type from the input type.
Source§

impl<M, T> From<Lms<M, T>> for [T; 3]

Source§

fn from(color: Lms<M, T>) -> Self

Converts to this type from the input type.
Source§

impl<M, T> From<Lms<M, T>> for (T, T, T)

Source§

fn from(color: Lms<M, T>) -> (T, T, T)

Converts to this type from the input type.
Source§

impl<M, T, V, const N: usize> From<Lms<M, V>> for [Lms<M, T>; N]
where Self: Default, V: IntoScalarArray<N, Scalar = T>,

Source§

fn from(color: Lms<M, V>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Lms<M, f32>> for Lms<M, f64>

Source§

fn from(color: Lms<M, f32>) -> Self

Converts to this type from the input type.
Source§

impl<M> From<Lms<M, f64>> for Lms<M, f32>

Source§

fn from(color: Lms<M, f64>) -> Self

Converts to this type from the input type.
Source§

impl<M, T> From<PreAlpha<Lms<M, T>>> for Lms<M, T>
where Self: Premultiply<Scalar = T>,

Source§

fn from(premultiplied: PreAlpha<Self>) -> Self

Converts to this type from the input type.
Source§

impl<M, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Lms<M, T>
where _C: IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Alpha<_C, _A>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Hsl<_S, T>> for Lms<M, T>
where _S: RgbStandard, _S::Space: RgbSpace<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Hsl<_S, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Hsl<_S, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Hsluv<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Hsluv<_Wp, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Hsluv<_Wp, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Hsv<_S, T>> for Lms<M, T>
where _S: RgbStandard, _S::Space: RgbSpace<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Hsv<_S, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Hsv<_S, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Hwb<_S, T>> for Lms<M, T>
where _S: RgbStandard, _S::Space: RgbSpace<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Hwb<_S, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Hwb<_S, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Lab<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Lab<_Wp, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lab<_Wp, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Lch<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Lch<_Wp, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lch<_Wp, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Lchuv<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Lchuv<_Wp, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lchuv<_Wp, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Lms<M, T>> for Lms<M, T>

Source§

fn from_color_unclamped(val: Lms<M, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Lms<M, T>> for Xyz<M::XyzMeta, T>

Source§

fn from_color_unclamped(val: Lms<M, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Hsl<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <<S as RgbStandard>::Space as RgbSpace>::WhitePoint>, S: RgbStandard, Rgb<S, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Hsluv<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Lchuv<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Hsv<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <<S as RgbStandard>::Space as RgbSpace>::WhitePoint>, S: RgbStandard, Rgb<S, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Hwb<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <<S as RgbStandard>::Space as RgbSpace>::WhitePoint>, S: RgbStandard, Hsv<S, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Lab<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Xyz<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Lch<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Lab<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Lchuv<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Luv<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Luma<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <S as LumaStandard>::WhitePoint>, S: LumaStandard, Xyz<<S as LumaStandard>::WhitePoint, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Luv<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Xyz<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Okhsl<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Oklab<T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Okhsv<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Oklab<T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Okhwb<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Okhsv<T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Oklab<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Xyz<D65, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Oklch<T>
where _LmsM: HasXyzMeta<XyzMeta = D65>, D65: WhitePoint<T>, Oklab<T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<S, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Rgb<S, T>
where _LmsM: HasXyzMeta<XyzMeta = <<S as RgbStandard>::Space as RgbSpace>::WhitePoint>, S: RgbStandard, Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<Wp, T, _LmsM> FromColorUnclamped<Lms<_LmsM, T>> for Yxy<Wp, T>
where _LmsM: HasXyzMeta<XyzMeta = Wp>, Wp: WhitePoint<T>, Xyz<Wp, T>: FromColorUnclamped<Lms<_LmsM, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Lms<_LmsM, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Luma<_S, T>> for Lms<M, T>
where _S: LumaStandard<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Luma<_S, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Luma<_S, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Luv<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Luv<_Wp, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Luv<_Wp, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Okhsl<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Okhsl<T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Okhsv<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Okhsv<T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Okhwb<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Okhwb<T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Oklab<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Oklab<T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Oklch<T>> for Lms<M, T>

Source§

fn from_color_unclamped(color: Oklch<T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _S, _Wp> FromColorUnclamped<Rgb<_S, T>> for Lms<M, T>
where _S: RgbStandard, _S::Space: RgbSpace<WhitePoint = _Wp>, Xyz<_Wp, T>: FromColorUnclamped<Rgb<_S, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Rgb<_S, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T> FromColorUnclamped<Xyz<<M as HasXyzMeta>::XyzMeta, T>> for Lms<M, T>

Source§

fn from_color_unclamped(val: Xyz<M::XyzMeta, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, _Wp> FromColorUnclamped<Yxy<_Wp, T>> for Lms<M, T>
where Xyz<_Wp, T>: FromColorUnclamped<Yxy<_Wp, T>> + IntoColorUnclamped<Self>,

Source§

fn from_color_unclamped(color: Yxy<_Wp, T>) -> Self

Convert from T. The resulting color might be invalid in its color space. Read more
Source§

impl<M, T, C> FromIterator<Lms<M, T>> for Lms<M, C>
where Self: Extend<Lms<M, T>>, C: Default,

Source§

fn from_iter<I: IntoIterator<Item = Lms<M, T>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<M, T> HasBoolMask for Lms<M, T>
where T: HasBoolMask,

Source§

type Mask = <T as HasBoolMask>::Mask

The mask type to use for selecting Self values.
Source§

impl<'a, 'b, M, T> IntoIterator for &'a Lms<M, &'b [T]>

Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, 'b, M, T> IntoIterator for &'a Lms<M, &'b mut [T]>

Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T, const N: usize> IntoIterator for &'a Lms<M, [T; N]>

Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for &'a Lms<M, Box<[T]>>

Available on crate feature alloc only.
Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for &'a Lms<M, Vec<T>>

Available on crate feature alloc only.
Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, 'b, M, T> IntoIterator for &'a mut Lms<M, &'b mut [T]>

Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T, const N: usize> IntoIterator for &'a mut Lms<M, [T; N]>

Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for &'a mut Lms<M, Box<[T]>>
where T: 'a,

Available on crate feature alloc only.
Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for &'a mut Lms<M, Vec<T>>

Available on crate feature alloc only.
Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for Lms<M, &'a [T]>

Source§

type Item = Lms<M, &'a T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<Iter<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, M, T> IntoIterator for Lms<M, &'a mut [T]>

Source§

type Item = Lms<M, &'a mut T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IterMut<'a, T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<M, T, const N: usize> IntoIterator for Lms<M, [T; N]>

Source§

type Item = Lms<M, T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IntoIter<T, N>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<M, T> IntoIterator for Lms<M, Vec<T>>

Available on crate feature alloc only.
Source§

type Item = Lms<M, T>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IntoIter<T>, M>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<M, T> IsWithinBounds for Lms<M, T>
where T: PartialCmp + Stimulus, T::Mask: BitAnd<Output = T::Mask>,

Source§

fn is_within_bounds(&self) -> T::Mask

Check if the color’s components are within the expected range bounds. Read more
Source§

impl<M, T> Mix for Lms<M, T>
where T: Real + Zero + One + Arithmetics + Clamp + Clone,

Source§

type Scalar = T

The type of the mixing factor.
Source§

fn mix(self, other: Self, factor: T) -> Self

Mix the color with an other color, by factor. Read more
Source§

impl<M, T> MixAssign for Lms<M, T>
where T: Real + Zero + One + AddAssign + Arithmetics + Clamp + Clone,

Source§

type Scalar = T

The type of the mixing factor.
Source§

fn mix_assign(&mut self, other: Self, factor: T)

Mix the color with an other color, by factor. Read more
Source§

impl<M, T> Mul<T> for Lms<M, T>
where T: Mul<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type after applying the * operator.
Source§

fn mul(self, c: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<M, T> Mul for Lms<M, T>
where T: Mul<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<M, T> MulAssign<T> for Lms<M, T>
where T: MulAssign + Clone,

Source§

fn mul_assign(&mut self, c: T)

Performs the *= operation. Read more
Source§

impl<M, T> MulAssign for Lms<M, T>
where T: MulAssign,

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl<M, T> PartialEq for Lms<M, T>
where T: PartialEq,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<M, T> Premultiply for Lms<M, T>
where T: Real + Stimulus + Zero + IsValidDivisor + Mul<T, Output = T> + Div<T, Output = T> + Clone, T::Mask: LazySelect<T> + Clone,

Source§

type Scalar = T

The color’s component type.
Source§

fn premultiply(self, alpha: T) -> PreAlpha<Self>

Alpha mask the color. Read more
Source§

fn unpremultiply(premultiplied: PreAlpha<Self>) -> (Self, T)

Alpha unmask the color, resulting in a color and transparency pair. Read more
Source§

impl<M, T> RelativeEq for Lms<M, T>
where T: RelativeEq, T::Epsilon: Clone,

Available on crate feature approx only.
Source§

fn default_max_relative() -> T::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
Source§

fn relative_eq( &self, other: &Self, epsilon: T::Epsilon, max_relative: T::Epsilon, ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
Source§

fn relative_ne( &self, other: &Self, epsilon: T::Epsilon, max_relative: T::Epsilon, ) -> bool

The inverse of [RelativeEq::relative_eq].
Source§

impl<M, T> SampleUniform for Lms<M, T>
where T: SampleUniform + Clone,

Available on crate feature random only.
Source§

type Sampler = UniformLms<M, T>

The UniformSampler implementation supporting type X.
Source§

impl<M, T> SaturatingAdd<T> for Lms<M, T>
where T: SaturatingAdd<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type.
Source§

fn saturating_add(self, c: T) -> Self::Output

Returns the sum of self and other, but saturates instead of overflowing.
Source§

impl<M, T> SaturatingAdd for Lms<M, T>
where T: SaturatingAdd<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type.
Source§

fn saturating_add(self, other: Self) -> Self::Output

Returns the sum of self and other, but saturates instead of overflowing.
Source§

impl<M, T> SaturatingSub<T> for Lms<M, T>
where T: SaturatingSub<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type.
Source§

fn saturating_sub(self, c: T) -> Self::Output

Returns the difference of self and other, but saturates instead of overflowing.
Source§

impl<M, T> SaturatingSub for Lms<M, T>
where T: SaturatingSub<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type.
Source§

fn saturating_sub(self, other: Self) -> Self::Output

Returns the difference of self and other, but saturates instead of overflowing.
Source§

impl<M, T> Serialize for Lms<M, T>
where T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<M, T> Sub<T> for Lms<M, T>
where T: Sub<Output = T> + Clone,

Source§

type Output = Lms<M, T>

The resulting type after applying the - operator.
Source§

fn sub(self, c: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<M, T> Sub for Lms<M, T>
where T: Sub<Output = T>,

Source§

type Output = Lms<M, T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<M, T> SubAssign<T> for Lms<M, T>
where T: SubAssign + Clone,

Source§

fn sub_assign(&mut self, c: T)

Performs the -= operation. Read more
Source§

impl<M, T> SubAssign for Lms<M, T>
where T: SubAssign,

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<'a, M, T> TryFrom<&'a [T]> for &'a Lms<M, T>

Source§

type Error = <&'a [T; 3] as TryFrom<&'a [T]>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from(slice: &'a [T]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a, M, T> TryFrom<&'a mut [T]> for &'a mut Lms<M, T>

Source§

type Error = <&'a mut [T; 3] as TryFrom<&'a mut [T]>>::Error

The type returned in the event of a conversion error.
Source§

fn try_from(slice: &'a mut [T]) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<M, T> UlpsEq for Lms<M, T>
where T: UlpsEq, T::Epsilon: Clone,

Available on crate feature approx only.
Source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
Source§

fn ulps_eq(&self, other: &Self, epsilon: T::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
Source§

fn ulps_ne(&self, other: &Self, epsilon: T::Epsilon, max_ulps: u32) -> bool

The inverse of [UlpsEq::ulps_eq].
Source§

impl<M, T, _A> WithAlpha<_A> for Lms<M, T>
where _A: Stimulus,

Source§

type Color = Lms<M, T>

The opaque color type, without any transparency. Read more
Source§

type WithAlpha = Alpha<Lms<M, T>, _A>

The color type with transparency applied. Read more
Source§

fn with_alpha(self, alpha: _A) -> Self::WithAlpha

Transforms the color into a transparent color with the provided alpha value. If Self already has a transparency, it is overwritten. Read more
Source§

fn without_alpha(self) -> Self::Color

Removes the transparency from the color. If Self::Color has an internal transparency field, that field will be set to A::max_intensity() to make it opaque. Read more
Source§

fn split(self) -> (Self::Color, _A)

Splits the color into separate color and transparency values. Read more
Source§

fn opaque(self) -> Self::WithAlpha
where A: Stimulus,

Transforms the color into a fully opaque color with a transparency field. If Self already has a transparency, it is overwritten. Read more
Source§

fn transparent(self) -> Self::WithAlpha
where A: Zero,

Transforms the color into a fully transparent color. If Self already has a transparency, it is overwritten. Read more
Source§

impl<M, T> Zeroable for Lms<M, T>
where T: Zeroable,

Available on crate feature bytemuck only.
§

fn zeroed() -> Self

Source§

impl<M, T> Copy for Lms<M, T>
where T: Copy,

Source§

impl<M, T> Eq for Lms<M, T>
where T: Eq,

Source§

impl<M: 'static, T> Pod for Lms<M, T>
where T: Pod,

Available on crate feature bytemuck only.
Source§

impl<M, T> StimulusColor for Lms<M, T>
where T: Stimulus,

Auto Trait Implementations§

§

impl<M, T> Freeze for Lms<M, T>
where T: Freeze,

§

impl<M, T> RefUnwindSafe for Lms<M, T>

§

impl<M, T> Send for Lms<M, T>
where T: Send, M: Send,

§

impl<M, T> Sync for Lms<M, T>
where T: Sync, M: Sync,

§

impl<M, T> Unpin for Lms<M, T>
where T: Unpin, M: Unpin,

§

impl<M, T> UnwindSafe for Lms<M, T>
where T: UnwindSafe, M: UnwindSafe,

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, S: IntoColorUnclamped<Xyz<Swp, T>>, D: FromColorUnclamped<Xyz<Dwp, T>>,

Source§

fn adapt_from_using<M>(color: S, method: M) -> D
where M: TransformMatrix<T>,

👎Deprecated since 0.7.7: replaced by palette::chromatic_adaptation::AdaptFromUnclamped
Convert the source color to the destination color using the specified method.
Source§

fn adapt_from(color: S) -> Self

👎Deprecated since 0.7.7: replaced by palette::chromatic_adaptation::AdaptFromUnclamped
Convert the source color to the destination color using the bradford method by default.
Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

👎Deprecated since 0.7.7: replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

👎Deprecated since 0.7.7: replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Convert the source color to the destination color using the bradford method by default.
Source§

impl<T, C> AdaptIntoUnclamped<T> for C
where T: AdaptFromUnclamped<C>,

Source§

type Scalar = <T as AdaptFromUnclamped<C>>::Scalar

The number type that’s used as the color’s components.
Source§

fn adapt_into_unclamped_with<M>(self) -> T

Adapt a color of type Self into a color of type T, using the custom matrix M. Read more
Source§

fn adapt_into_unclamped(self) -> T
where Bradford: LmsToXyz<Self::Scalar> + XyzToLms<Self::Scalar>,

Adapt a color of type Self into a color of type T, using the Bradford matrix. Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<C, T, const N: usize> Blend for C
where C: Premultiply<Scalar = T> + StimulusColor + ArrayCast<Array = [T; N]> + Clone, T: Real + Zero + One + MinMax + Clamp + Sqrt + Abs + Arithmetics + PartialCmp + Clone, <T as HasBoolMask>::Mask: LazySelect<T>,

Source§

fn multiply(self, other: C) -> C

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: C) -> C

Make a color which is at least as light as self or other.
Source§

fn overlay(self, other: C) -> C

Multiply self or other if other is dark, or screen them if other is light. This results in an S curve.
Source§

fn darken(self, other: C) -> C

Return the darkest parts of self and other.
Source§

fn lighten(self, other: C) -> C

Return the lightest parts of self and other.
Source§

fn dodge(self, other: C) -> C

Lighten other to reflect self. Results in other if self is black.
Source§

fn burn(self, other: C) -> C

Darken other to reflect self. Results in other if self is white.
Source§

fn hard_light(self, other: C) -> C

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: C) -> C

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: C) -> C

Return the absolute difference between self and other. It’s basically abs(self - other), but regulated by the alpha component.
Source§

fn exclusion(self, other: C) -> C

Similar to difference, but appears to result in a lower contrast. other is inverted if self is white, and preserved if self is black.
Source§

impl<C> BlendWith for C

Source§

type Color = C

The base color type of Self.
Source§

fn blend_with<F>(self, other: C, blend_function: F) -> C
where F: BlendFunction<<C as BlendWith>::Color>,

Blend self, as the source color, with destination, using blend_function. Anything that implements BlendFunction is acceptable, including functions and closures. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<C> Compose for C

Source§

fn over(self, other: C) -> C

Place self over other. This is the good old common alpha composition equation.
Source§

fn inside(self, other: C) -> C

Results in the parts of self that overlaps the visible parts of other.
Source§

fn outside(self, other: C) -> C

Results in the parts of self that lies outside the visible parts of other.
Source§

fn atop(self, other: C) -> C

Place self over only the visible parts of other.
Source§

fn xor(self, other: C) -> C

Results in either self or other, where they do not overlap.
Source§

fn plus(self, other: C) -> C

Add self and other. This uses the alpha component to regulate the effect, so it’s not just plain component wise addition.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromColor<T> for U
where U: FromColorUnclamped<T> + Clamp,

Source§

fn from_color(t: T) -> U

Convert from T with values clamped to the color defined bounds. Read more
Source§

impl<T, U> FromColorMut<U> for T
where T: FromColor<U> + ArrayCast + Clone, U: FromColor<T> + ArrayCast<Array = <T as ArrayCast>::Array> + Clone,

Source§

fn from_color_mut(color: &mut U) -> FromColorMutGuard<'_, T, U>

Temporarily convert from another color type in place. Read more
Source§

impl<T, U> FromColorUnclampedMut<U> for T
where T: FromColorUnclamped<U> + ArrayCast + Clone, U: FromColorUnclamped<T> + ArrayCast<Array = <T as ArrayCast>::Array> + Clone,

Source§

fn from_color_unclamped_mut( color: &mut U, ) -> FromColorUnclampedMutGuard<'_, T, U>

Temporarily convert from another color type in place, without clamping. Read more
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorMut<T> for U
where T: FromColorMut<U> + ?Sized, U: FromColorMut<T> + ?Sized,

Source§

fn into_color_mut(&mut self) -> FromColorMutGuard<'_, T, U>

Temporarily convert to another color type in place. Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T, U> IntoColorUnclampedMut<T> for U

Source§

fn into_color_unclamped_mut(&mut self) -> FromColorUnclampedMutGuard<'_, T, U>

Temporarily convert to another color type in place, without clamping. Read more
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<Borrowed> SampleBorrow<Borrowed> for Borrowed
where Borrowed: SampleUniform,

Source§

fn borrow(&self) -> &Borrowed

Immutably borrows from an owned value. See Borrow::borrow
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryFromColor<T> for U
where U: FromColorUnclamped<T> + IsWithinBounds<Mask = bool>,

Source§

fn try_from_color(t: T) -> Result<U, OutOfBounds<U>>

Convert from T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> NoUninit for T
where T: Pod,