palette::cast

Trait ComponentOrder

Source
pub trait ComponentOrder<C, P> {
    // Required methods
    fn pack(color: C) -> P;
    fn unpack(packed: P) -> C;
}
Expand description

Packs and unpacks color types with some component order.

As an example, RGBA channels may be ordered as ABGR, ARGB, BGRA, or RGBA.

Required Methods§

Source

fn pack(color: C) -> P

Combine the components of a color into the packed format.

Source

fn unpack(packed: P) -> C

Split the packed color into its separate components.

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, T> ComponentOrder<C, u8> for T
where T: ComponentOrder<C, [u8; 1]>,

Source§

impl<C, T> ComponentOrder<C, u16> for T
where T: ComponentOrder<C, [u8; 2]>,

Source§

impl<C, T> ComponentOrder<C, u32> for T
where T: ComponentOrder<C, [u8; 4]>,

Source§

impl<C, T> ComponentOrder<C, u64> for T
where T: ComponentOrder<C, [u8; 8]>,

Source§

impl<C, T> ComponentOrder<C, u128> for T
where T: ComponentOrder<C, [u8; 16]>,

Source§

impl<S, T> ComponentOrder<Alpha<Luma<S, T>, T>, [T; 2]> for Al

Source§

impl<S, T> ComponentOrder<Alpha<Luma<S, T>, T>, [T; 2]> for La

Source§

impl<S, T> ComponentOrder<Alpha<Rgb<S, T>, T>, [T; 4]> for Abgr

Source§

impl<S, T> ComponentOrder<Alpha<Rgb<S, T>, T>, [T; 4]> for Argb

Source§

impl<S, T> ComponentOrder<Alpha<Rgb<S, T>, T>, [T; 4]> for Bgra

Source§

impl<S, T> ComponentOrder<Alpha<Rgb<S, T>, T>, [T; 4]> for Rgba