[][src]Struct prisma::encoding::EncodedColor

pub struct EncodedColor<C, E> { /* fields omitted */ }

A color decorated with its encoding. This is the primary way to use encodings.

As most encodings are zero-sized structs except for GammaEncoding, there will be no size penalty for using EncodedColor.

Implementations

impl<C, E> EncodedColor<C, E> where
    C: Color + EncodableColor,
    E: ColorEncoding
[src]

pub fn new(color: C, encoding: E) -> Self[src]

Construct a new EncodedColor from a color and an encoding.

impl<C, E> EncodedColor<C, E> where
    C: Color,
    E: ColorEncoding
[src]

pub fn decompose(self) -> (C, E)[src]

Decompose a EncodedColor into it's color and encoding objects

pub fn color(&self) -> &C[src]

Returns a reference to the color object

pub fn color_mut(&mut self) -> &mut C[src]

Returns a mutable reference to the color object

pub fn strip_encoding(self) -> C[src]

Discard the encoding, returning the bare color object

pub fn encoding(&self) -> &E[src]

Returns a reference to the encoding object

impl<C, E> EncodedColor<C, E> where
    E: ColorEncoding,
    C: TranscodableColor
[src]

pub fn decode(self) -> EncodedColor<C, LinearEncoding>[src]

Decode the color, making it linearly encoded

Note: This only is implemented for Rgb. All other encoded colors must convert to Rgb first.

pub fn transcode<Encoder>(
    self,
    new_encoding: Encoder
) -> EncodedColor<C, Encoder> where
    Encoder: ColorEncoding
[src]

Change the encoding of the color

Note: This only is implemented for Rgb. All other encoded colors must convert to Rgb first.

impl<C> EncodedColor<C, LinearEncoding> where
    C: TranscodableColor
[src]

pub fn encode<Encoder>(self, encoding: Encoder) -> EncodedColor<C, Encoder> where
    Encoder: ColorEncoding
[src]

Encode a linear RGB color with encoding

impl<C, E> EncodedColor<C, E> where
    C: Color + Broadcast + EncodableColor,
    E: ColorEncoding + PartialEq
[src]

pub fn broadcast(value: C::ChannelFormat, encoding: E) -> Self[src]

Construct a new EncodedColor with all channels set to value and with encoding

impl<C, E> EncodedColor<C, E> where
    C: Color + FromTuple + EncodableColor,
    E: ColorEncoding + PartialEq
[src]

pub fn from_tuple(values: C::ChannelsTuple, encoding: E) -> Self[src]

Construct a new EncodedColor from a tuple of channels and an encoding

Trait Implementations

impl<C, E> AbsDiffEq<EncodedColor<C, E>> for EncodedColor<C, E> where
    C: Color + EncodableColor + AbsDiffEq,
    E: ColorEncoding + PartialEq
[src]

type Epsilon = C::Epsilon

Used for specifying relative comparisons.

impl<C, E> Bounded for EncodedColor<C, E> where
    C: Color + Bounded + EncodableColor,
    E: ColorEncoding + PartialEq
[src]

impl<C: Clone, E: Clone> Clone for EncodedColor<C, E>[src]

impl<C, E> Color for EncodedColor<C, E> where
    C: Color + EncodableColor,
    E: ColorEncoding + PartialEq
[src]

type Tag = C::Tag

The unique tag unit struct identifying the color type

type ChannelsTuple = C::ChannelsTuple

A tuple of types for each channel in the color

impl<C, E> Color3 for EncodedColor<C, E> where
    C: Color3 + EncodableColor,
    E: ColorEncoding + PartialEq
[src]

impl<C, E> Color4 for EncodedColor<C, E> where
    C: Color4 + EncodableColor,
    E: ColorEncoding + PartialEq
[src]

impl<C: Copy, E: Copy> Copy for EncodedColor<C, E>[src]

impl<C: Debug, E: Debug> Debug for EncodedColor<C, E>[src]

impl<C, E> Deref for EncodedColor<C, E> where
    C: EncodableColor,
    E: ColorEncoding
[src]

type Target = C

The resulting type after dereferencing.

impl<C, E> DerefMut for EncodedColor<C, E> where
    C: EncodableColor,
    E: ColorEncoding
[src]

impl<C, E> Display for EncodedColor<C, E> where
    C: Color + EncodableColor + Display,
    E: ColorEncoding + Display
[src]

impl<C, E> EncodableColor for EncodedColor<C, E> where
    C: EncodableColor,
    E: ColorEncoding + PartialEq
[src]

impl<C: Eq, E: Eq> Eq for EncodedColor<C, E>[src]

impl<C, E, C2> FromColor<EncodedColor<C2, E>> for EncodedColor<C, E> where
    C: Color + FromColor<C2> + EncodableColor,
    E: ColorEncoding,
    C2: EncodableColor
[src]

impl<C, E, T, A> FromHsi<EncodedColor<Hsi<T, A>, E>> for EncodedColor<C, E> where
    C: Color + EncodableColor + FromHsi<Hsi<T, A>>,
    E: ColorEncoding,
    T: PosNormalChannelScalar + Float,
    A: AngularChannelScalar + Angle<Scalar = T>, 
[src]

impl<C, E, T, M> FromYCbCr<EncodedColor<YCbCr<T, M>, E>> for EncodedColor<C, E> where
    C: Color + EncodableColor + FromYCbCr<YCbCr<T, M>>,
    E: ColorEncoding,
    T: PosNormalChannelScalar + Float,
    M: YCbCrModel<T>, 
[src]

impl<C, E> Invert for EncodedColor<C, E> where
    C: Color + Invert + EncodableColor,
    E: ColorEncoding + PartialEq
[src]

impl<C, E> Lerp for EncodedColor<C, E> where
    C: Color + Lerp + EncodableColor,
    E: ColorEncoding + PartialEq
[src]

type Position = C::Position

The type of the pos argument

impl<C: PartialEq, E: PartialEq> PartialEq<EncodedColor<C, E>> for EncodedColor<C, E>[src]

impl<C, E> PolarColor for EncodedColor<C, E> where
    C: Color + EncodableColor + PolarColor,
    E: ColorEncoding + PartialEq
[src]

type Angular = C::Angular

The angular channel's scalar type

type Cartesian = C::Cartesian

The remaining channels' scalar types

impl<C, E> RelativeEq<EncodedColor<C, E>> for EncodedColor<C, E> where
    C: Color + EncodableColor + RelativeEq,
    E: ColorEncoding + PartialEq
[src]

impl<C, E> StructuralEq for EncodedColor<C, E>[src]

impl<C, E> StructuralPartialEq for EncodedColor<C, E>[src]

impl<C, E> UlpsEq<EncodedColor<C, E>> for EncodedColor<C, E> where
    C: Color + EncodableColor + UlpsEq,
    E: ColorEncoding + PartialEq
[src]

impl<T, C, E, S> WithColorSpace<T, C, E, S> for EncodedColor<C, E> where
    C: EncodableColor,
    S: ColorSpace<T>,
    E: ColorEncoding,
    T: Float
[src]

Auto Trait Implementations

impl<C, E> RefUnwindSafe for EncodedColor<C, E> where
    C: RefUnwindSafe,
    E: RefUnwindSafe

impl<C, E> Send for EncodedColor<C, E> where
    C: Send,
    E: Send

impl<C, E> Sync for EncodedColor<C, E> where
    C: Sync,
    E: Sync

impl<C, E> Unpin for EncodedColor<C, E> where
    C: Unpin,
    E: Unpin

impl<C, E> UnwindSafe for EncodedColor<C, E> where
    C: UnwindSafe,
    E: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.