[][src]Struct prisma::ycbcr::BareYCbCr

#[repr(C)]pub struct BareYCbCr<T> { /* fields omitted */ }

A YCbCr color that does not know its model.

BareYCbCr is used internally to implement YCbCr and is provided as a separate type for performance reasons; generally, the use of YCbCr is preferred. It is "bare" in the sense that it does not store the model information along with the channel information. This makes it less smart, but can save memory when used with custom models.

When using a custom model, YCbCr must store a reference to the model along with its channel values. This can increase the memory footprint significantly, but gives greater safety and convenience as well as forbidding illogical conversions and comparisons. It is therefore only advised to use this when the extra memory consumption has show to be an issue.

Implementations

impl<T> BareYCbCr<T> where
    T: NormalChannelScalar + PosNormalChannelScalar
[src]

pub fn new(luma: T, cb: T, cr: T) -> Self[src]

Construct a BareYCbCr from channel values.

pub fn color_cast<TOut>(&self) -> BareYCbCr<TOut> where
    T: ChannelFormatCast<TOut>,
    TOut: PosNormalChannelScalar + NormalChannelScalar
[src]

Convert the internal channel scalar format

pub fn luma(&self) -> T[src]

Get the luma (Y') channel.

pub fn cb(&self) -> T[src]

Get the Cb channel.

pub fn cr(&self) -> T[src]

Get the Cr channel.

pub fn luma_mut(&mut self) -> &mut T[src]

Get a mutable reference to the luma (Y') channel.

pub fn cb_mut(&mut self) -> &mut T[src]

Get a mutable reference to the Cb channel.

pub fn cr_mut(&mut self) -> &mut T[src]

Get a mutable reference to the Cr channel.

pub fn set_luma(&mut self, val: T)[src]

Set the luma (Y') channel to a value.

pub fn set_cb(&mut self, val: T)[src]

Set the Cb channel to a value.

pub fn set_cr(&mut self, val: T)[src]

Set the Cr channel to a value.

pub fn with_model<M>(self, model: M) -> YCbCr<T, M> where
    M: YCbCrModel<T>, 
[src]

Construct a new YCbCr object from self and a model.

Equivalent to constructing the YCbCr object directly:

let c = BareYCbCr::new(0.5, 0.3, 0.2).with_model(JpegModel);
assert_eq!(c, YCbCrJpeg::new(0.5, 0.3, 0.2));

impl<T> BareYCbCr<T> where
    T: NormalChannelScalar + PosNormalChannelScalar + NumCast
[src]

pub fn from_rgb_and_model<M: YCbCrModel<T>>(from: &Rgb<T>, model: &M) -> Self[src]

Construct a BareYCbCr by converting from an Rgb value.

model is only used within the conversion, it is up to the user to remember which model any BareYCbCr is using.

pub fn to_rgb<M: YCbCrModel<T>>(
    &self,
    model: &M,
    out_of_gamut_mode: YCbCrOutOfGamutMode
) -> Rgb<T>
[src]

Convert from YCbCr to Rgb.

Params

  • model - The model to use for the conversion. Note that this does not change the model of the color being converted. If you convert to YCbCr from Rgb and convert back under a different model, the resulting colors will be different.
  • out_of_gamut_mode - How to handle colors that are out of gamut in Rgb. See OutOfGamutMode for a description the options.

Trait Implementations

impl<T> AbsDiffEq<BareYCbCr<T>> for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar + AbsDiffEq,
    T::Epsilon: Clone
[src]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

impl<T> Bounded for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar
[src]

impl<T> Broadcast for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar
[src]

impl<T: Clone> Clone for BareYCbCr<T>[src]

impl<T> Color for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar
[src]

type Tag = YCbCrTag

The unique tag unit struct identifying the color type

type ChannelsTuple = (T, T, T)

A tuple of types for each channel in the color

impl<T: Copy> Copy for BareYCbCr<T>[src]

impl<T: Debug> Debug for BareYCbCr<T>[src]

impl<T> Default for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar + Zero
[src]

impl<T> Display for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar + Display
[src]

impl<T> EncodableColor for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar
[src]

impl<T: Eq> Eq for BareYCbCr<T>[src]

impl<T> Flatten for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar
[src]

impl<T> FromTuple for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar
[src]

impl<T: Hash> Hash for BareYCbCr<T>[src]

impl<T> HomogeneousColor for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar
[src]

type ChannelFormat = T

The scalar type of each channel

impl<T> Invert for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar
[src]

impl<T> Lerp for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar + Lerp
[src]

type Position = <T as Lerp>::Position

The type of the pos argument

impl<T: Ord> Ord for BareYCbCr<T>[src]

impl<T: PartialEq> PartialEq<BareYCbCr<T>> for BareYCbCr<T>[src]

impl<T: PartialOrd> PartialOrd<BareYCbCr<T>> for BareYCbCr<T>[src]

impl<T> RelativeEq<BareYCbCr<T>> for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar + RelativeEq,
    T::Epsilon: Clone
[src]

impl<T> StructuralEq for BareYCbCr<T>[src]

impl<T> StructuralPartialEq for BareYCbCr<T>[src]

impl<T> UlpsEq<BareYCbCr<T>> for BareYCbCr<T> where
    T: PosNormalChannelScalar + NormalChannelScalar + UlpsEq,
    T::Epsilon: Clone
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for BareYCbCr<T> where
    T: RefUnwindSafe

impl<T> Send for BareYCbCr<T> where
    T: Send

impl<T> Sync for BareYCbCr<T> where
    T: Sync

impl<T> Unpin for BareYCbCr<T> where
    T: Unpin

impl<T> UnwindSafe for BareYCbCr<T> where
    T: 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.