Skip to main content

Color

Trait Color 

Source
pub trait Color: Clone + PartialEq {
    type Tag;
    type ChannelsTuple;

    // Required methods
    fn num_channels() -> u32;
    fn to_tuple(self) -> Self::ChannelsTuple;
}
Expand description

The base color trait, representing any color

The main use of Color is to manipulate and act on colors in a generic context. It is used extensively internally.

Required Associated Types§

Source

type Tag

The unique tag unit struct identifying the color type

Source

type ChannelsTuple

A tuple of types for each channel in the color

Required Methods§

Source

fn num_channels() -> u32

Return how many channels the color has

Source

fn to_tuple(self) -> Self::ChannelsTuple

Convert a color into a tuple of channels

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C, E> Color for EncodedColor<C, E>

Source§

impl<T> Color for Rgb<T>

Source§

impl<T> Color for Rgi<T>

Source§

impl<T> Color for XyY<T>

Source§

impl<T> Color for Xyz<T>

Source§

impl<T> Color for BareYCbCr<T>

Source§

impl<T, A> Color for Hsi<T, A>

Source§

impl<T, A> Color for Hsl<T, A>

Source§

impl<T, A> Color for Hsv<T, A>

Source§

impl<T, A> Color for Hwb<T, A>

Source§

impl<T, A> Color for eHsi<T, A>

Source§

impl<T, C, E, S> Color for SpacedColor<T, C, E, S>

Source§

impl<T, InnerColor> Color for Alpha<T, InnerColor>
where T: PosNormalChannelScalar, InnerColor: Color,

Source§

type Tag = AlphaTag<<InnerColor as Color>::Tag>

Source§

type ChannelsTuple = (<InnerColor as Color>::ChannelsTuple, T)

Source§

impl<T, M> Color for YCbCr<T, M>

Source§

impl<T, Model> Color for Lms<T, Model>
where T: FreeChannelScalar, Model: LmsModel<T>,

Source§

impl<T, W> Color for Lab<T, W>
where T: FreeChannelScalar, W: WhitePoint<T>,

Source§

impl<T, W> Color for Luv<T, W>
where T: FreeChannelScalar, W: WhitePoint<T>,

Source§

impl<T, W, A> Color for Lchab<T, W, A>

Source§

impl<T, W, A> Color for Lchuv<T, W, A>