Trait palette::FromColor
[−]
[src]
pub trait FromColor<Wp = D65, T = f32>: Sized where
T: Float,
Wp: WhitePoint, { fn from_xyz(_: Xyz<Wp, T>) -> Self; fn from_yxy(inp: Yxy<Wp, T>) -> Self { ... } fn from_lab(inp: Lab<Wp, T>) -> Self { ... } fn from_lch(inp: Lch<Wp, T>) -> Self { ... } fn from_rgb<S: RgbSpace<WhitePoint = Wp>>(inp: Rgb<Linear<S>, T>) -> Self { ... } fn from_hsl<S: RgbSpace<WhitePoint = Wp>>(inp: Hsl<S, T>) -> Self { ... } fn from_hsv<S: RgbSpace<WhitePoint = Wp>>(inp: Hsv<S, T>) -> Self { ... } fn from_hwb<S: RgbSpace<WhitePoint = Wp>>(inp: Hwb<S, T>) -> Self { ... } fn from_luma(inp: Luma<Wp, T>) -> Self { ... } }
FromColor provides conversion between the colors.
It requires from_xyz and derives conversion to other colors as a default from this. These defaults must be overridden when direct conversion exists between colors. For example, Luma has direct conversion to LinRgb. So from_rgb conversion for Luma and from_luma for LinRgb is implemented directly. The from for the same color must override the default. For example, from_rgb for LinRgb will convert via Xyz which needs to be overridden with self to avoid the unnecessary converison.
Required Methods
Provided Methods
fn from_yxy(inp: Yxy<Wp, T>) -> Self
Convert from Yxy color space
fn from_lab(inp: Lab<Wp, T>) -> Self
Convert from L*a*b* color space
fn from_lch(inp: Lch<Wp, T>) -> Self
Convert from L*C*h° color space
fn from_rgb<S: RgbSpace<WhitePoint = Wp>>(inp: Rgb<Linear<S>, T>) -> Self
Convert from RGB color space
fn from_hsl<S: RgbSpace<WhitePoint = Wp>>(inp: Hsl<S, T>) -> Self
Convert from HSL color space
fn from_hsv<S: RgbSpace<WhitePoint = Wp>>(inp: Hsv<S, T>) -> Self
Convert from HSV color space
fn from_hwb<S: RgbSpace<WhitePoint = Wp>>(inp: Hwb<S, T>) -> Self
Convert from HWB color space
fn from_luma(inp: Luma<Wp, T>) -> Self
Convert from Luma
Implementors
impl<S, Wp, T> FromColor<Wp, T> for Rgb<S, T> where
S: RgbStandard,
T: Float,
Wp: WhitePoint,
S::Space: RgbSpace<WhitePoint = Wp>,impl<Wp, T> FromColor<Wp, T> for Luma<Wp, T> where
T: Float,
Wp: WhitePoint,impl<Wp, T> FromColor<Wp, T> for Yxy<Wp, T> where
T: Float,
Wp: WhitePoint,impl<Wp, T> FromColor<Wp, T> for Xyz<Wp, T> where
T: Float,
Wp: WhitePoint,impl<Wp, T> FromColor<Wp, T> for Lab<Wp, T> where
T: Float,
Wp: WhitePoint,impl<Wp, T> FromColor<Wp, T> for Lch<Wp, T> where
T: Float,
Wp: WhitePoint,impl<S, Wp, T> FromColor<Wp, T> for Hsv<S, T> where
T: Float,
S: RgbSpace<WhitePoint = Wp>,
Wp: WhitePoint,impl<S, Wp, T> FromColor<Wp, T> for Hsl<S, T> where
T: Float,
S: RgbSpace<WhitePoint = Wp>,
Wp: WhitePoint,impl<S, Wp, T> FromColor<Wp, T> for Hwb<S, T> where
T: Float,
S: RgbSpace<WhitePoint = Wp>,
Wp: WhitePoint,