[−][src]Struct prisma::ycbcr::YCbCr
A color in the YCbCr family of color spaces.
See the parent module description for a discussion on the properties of the color space.
The YCbCr
type is represented with a set of channel values, plus a model. The model
is stored with the color, and comes in two forms:
- A unit struct, defining the model at compile time. These do not store any value and thus
do not increase the size of a color instance.
JpegModel
,Bt709Model
andYiqModel
and of this type. These types implement theUnitModel
trait, and do not need to be passed to most functions. - A type which stores its transformations in memory at runtime. For these models, it is
usually preferable to store a reference to the model in the color to minimize the size
impact. However, this will still increase the size of the type by one pointer size. Only
CustomYCbCrModel
is of this type.
Implementations
impl<T, M> YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T> + UnitModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T> + UnitModel<T>,
pub fn new(y: T, cb: T, cr: T) -> Self
[src]
Construct a YCbCr
from channel values.
This method does not take a model parameter, and is only usable for
colors where the model is a stateless type implementing UnitModel. For such types,
it sets the model to M::unit_value()
.
For colors that have a stateful model, the new_and_model
method
should be used instead.
impl<T, M> YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
pub fn from_color_and_model(ycbcr: BareYCbCr<T>, model: M) -> Self
[src]
Construct a YCbCr
from a BareYCbCr
and model.
pub fn new_and_model(y: T, cb: T, cr: T, model: M) -> Self
[src]
Construct a YCbCr
from channel values and a model.
pub fn color_cast<TOut>(&self) -> YCbCr<TOut, M> where
T: ChannelFormatCast<TOut>,
TOut: NormalChannelScalar + PosNormalChannelScalar,
[src]
T: ChannelFormatCast<TOut>,
TOut: NormalChannelScalar + PosNormalChannelScalar,
Cast between different channel scalar representation.
pub fn model(&self) -> &M
[src]
Get a reference to the model of the given YCbCr
.
pub fn bare_ycbcr(&self) -> &BareYCbCr<T>
[src]
Get a reference to the "bare" color.
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 strip_model(self) -> BareYCbCr<T>
[src]
Remove the model information from the given YCbCr
.
This returns a BareYCbCr
with all the same channel values.
No conversion is necessary, the model information is simply dropped.
impl<T, M> YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T> + Canonicalize<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T> + Canonicalize<T>,
pub fn to_canonical_representation(&self) -> (T, T, T)
[src]
Return the channels rescaled to their canonical range for the given YCbCr
's model.
Most YUV and YIQ standards define the channel range to be different than the
[-1, 1]
used by this library. This function returns the values for the same
color rescaled to the defined range.
impl<T> YCbCr<T, YiqModel> where
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
YiqModel: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
YiqModel: YCbCrModel<T>,
pub fn i(&self) -> T
[src]
The I
channel of a YIQ color.
Because YIQ is implemented as a model on top of YCbCr,
this is equivalent to self.cb()
.
pub fn q(&self) -> T
[src]
The Q
channel of a YIQ color.
Because YIQ is implemented as a model on top of YCbCr,
this is equivalent to self.cr()
.
pub fn i_mut(&mut self) -> &mut T
[src]
Return a mutable reference to the I
channel.
pub fn q_mut(&mut self) -> &mut T
[src]
Return a mutable reference to the Q
channel.
pub fn set_i(&mut self, val: T)
[src]
Set the I
channel to a value.
pub fn set_q(&mut self, val: T)
[src]
Set the Q
channel to a value.
impl<T, M> YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T> + UnitModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T> + UnitModel<T>,
impl<T, M> YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T>,
pub fn from_rgb_and_model(from: &Rgb<T>, model: M) -> Self
[src]
Convert from RGB to YCbCr, using model
.
The returned value stores the passed model.
pub fn to_rgb(&self, out_of_gamut_mode: YCbCrOutOfGamutMode) -> Rgb<T>
[src]
Convert from YCbCr to RGB.
Params
- out_of_gamut_mode - How to handle out of gamut colors.
See
YCbCrOutOfGamutMode
for a description of the options.
Trait Implementations
impl<T, M> AbsDiffEq<YCbCr<T, M>> for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + AbsDiffEq,
T::Epsilon: Clone,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + AbsDiffEq,
T::Epsilon: Clone,
M: YCbCrModel<T>,
type Epsilon = <BareYCbCr<T> as AbsDiffEq>::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> Self::Epsilon
[src]
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
[src]
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
[src]
impl<T, M> Bounded for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
fn normalize(self) -> Self
[src]
fn is_normalized(&self) -> bool
[src]
impl<T, M> Broadcast for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T> + UnitModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T> + UnitModel<T>,
impl<T: Clone, M: Clone> Clone for YCbCr<T, M>
[src]
impl<T, M> Color for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
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
fn num_channels() -> u32
[src]
fn to_tuple(self) -> Self::ChannelsTuple
[src]
impl<T: Copy, M: Copy> Copy for YCbCr<T, M>
[src]
impl<T: Debug, M: Debug> Debug for YCbCr<T, M>
[src]
impl<T, M> Default for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + Zero + Default,
M: YCbCrModel<T> + UnitModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + Zero + Default,
M: YCbCrModel<T> + UnitModel<T>,
impl<T, M> Display for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + Display,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + Display,
M: YCbCrModel<T>,
impl<T, M> EncodableColor for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
fn encoded_as<E>(self, encoding: E) -> EncodedColor<Self, E> where
E: ColorEncoding,
[src]
E: ColorEncoding,
fn linear(self) -> EncodedColor<Self, LinearEncoding>
[src]
fn srgb_encoded(self) -> EncodedColor<Self, SrgbEncoding>
[src]
fn gamma_encoded<T: Float>(
self,
gamma: T
) -> EncodedColor<Self, GammaEncoding<T>>
[src]
self,
gamma: T
) -> EncodedColor<Self, GammaEncoding<T>>
impl<T: Eq, M: Eq> Eq for YCbCr<T, M>
[src]
impl<T, M> Flatten for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T> + UnitModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T> + UnitModel<T>,
impl<T, M> From<Rgb<T>> for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T> + UnitModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T> + UnitModel<T>,
impl<T, M> FromColor<Rgb<T>> for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T> + UnitModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T> + UnitModel<T>,
fn from_color(from: &Rgb<T>) -> YCbCr<T, M>
[src]
impl<T, M> FromTuple for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T> + UnitModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T> + UnitModel<T>,
fn from_tuple(values: Self::ChannelsTuple) -> Self
[src]
impl<T, M> FromYCbCr<YCbCr<T, M>> for Rgb<T> where
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
M: YCbCrModel<T>,
fn from_ycbcr(
from: &YCbCr<T, M>,
out_of_gamut_mode: YCbCrOutOfGamutMode
) -> Rgb<T>
[src]
from: &YCbCr<T, M>,
out_of_gamut_mode: YCbCrOutOfGamutMode
) -> Rgb<T>
impl<T: Hash, M: Hash> Hash for YCbCr<T, M>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T, M> HomogeneousColor for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
impl<T, M> Invert for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar,
M: YCbCrModel<T>,
impl<T, M> Lerp for YCbCr<T, M> where
T: NormalChannelScalar + Lerp + PosNormalChannelScalar,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + Lerp + PosNormalChannelScalar,
M: YCbCrModel<T>,
type Position = <T as Lerp>::Position
The type of the pos
argument
fn lerp(&self, other: &Self, pos: Self::Position) -> Self
[src]
impl<T: Ord, M: Ord> Ord for YCbCr<T, M>
[src]
fn cmp(&self, other: &YCbCr<T, M>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq, M: PartialEq> PartialEq<YCbCr<T, M>> for YCbCr<T, M>
[src]
impl<T: PartialOrd, M: PartialOrd> PartialOrd<YCbCr<T, M>> for YCbCr<T, M>
[src]
fn partial_cmp(&self, other: &YCbCr<T, M>) -> Option<Ordering>
[src]
fn lt(&self, other: &YCbCr<T, M>) -> bool
[src]
fn le(&self, other: &YCbCr<T, M>) -> bool
[src]
fn gt(&self, other: &YCbCr<T, M>) -> bool
[src]
fn ge(&self, other: &YCbCr<T, M>) -> bool
[src]
impl<T, M> RelativeEq<YCbCr<T, M>> for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + RelativeEq,
T::Epsilon: Clone,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + RelativeEq,
T::Epsilon: Clone,
M: YCbCrModel<T>,
fn default_max_relative() -> Self::Epsilon
[src]
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl<T, M> StructuralEq for YCbCr<T, M>
[src]
impl<T, M> StructuralPartialEq for YCbCr<T, M>
[src]
impl<T, M> UlpsEq<YCbCr<T, M>> for YCbCr<T, M> where
T: NormalChannelScalar + PosNormalChannelScalar + UlpsEq,
T::Epsilon: Clone,
M: YCbCrModel<T>,
[src]
T: NormalChannelScalar + PosNormalChannelScalar + UlpsEq,
T::Epsilon: Clone,
M: YCbCrModel<T>,
Auto Trait Implementations
impl<T, M> RefUnwindSafe for YCbCr<T, M> where
M: RefUnwindSafe,
T: RefUnwindSafe,
M: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, M> Send for YCbCr<T, M> where
M: Send,
T: Send,
M: Send,
T: Send,
impl<T, M> Sync for YCbCr<T, M> where
M: Sync,
T: Sync,
M: Sync,
T: Sync,
impl<T, M> Unpin for YCbCr<T, M> where
M: Unpin,
T: Unpin,
M: Unpin,
T: Unpin,
impl<T, M> UnwindSafe for YCbCr<T, M> where
M: UnwindSafe,
T: UnwindSafe,
M: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,