[−][src]Struct prisma::ycbcr::BareYCbCr
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]
T: NormalChannelScalar + PosNormalChannelScalar,
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]
T: ChannelFormatCast<TOut>,
TOut: PosNormalChannelScalar + NormalChannelScalar,
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]
M: YCbCrModel<T>,
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]
T: NormalChannelScalar + PosNormalChannelScalar + NumCast,
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]
&self,
model: &M,
out_of_gamut_mode: YCbCrOutOfGamutMode
) -> Rgb<T>
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]
T: PosNormalChannelScalar + NormalChannelScalar + AbsDiffEq,
T::Epsilon: Clone,
type Epsilon = T::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> Bounded for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar,
[src]
T: PosNormalChannelScalar + NormalChannelScalar,
fn normalize(self) -> Self
[src]
fn is_normalized(&self) -> bool
[src]
impl<T> Broadcast for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar,
[src]
T: PosNormalChannelScalar + NormalChannelScalar,
impl<T: Clone> Clone for BareYCbCr<T>
[src]
impl<T> Color for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar,
[src]
T: PosNormalChannelScalar + NormalChannelScalar,
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> 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]
T: PosNormalChannelScalar + NormalChannelScalar + Zero,
impl<T> Display for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar + Display,
[src]
T: PosNormalChannelScalar + NormalChannelScalar + Display,
impl<T> EncodableColor for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar,
[src]
T: PosNormalChannelScalar + NormalChannelScalar,
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> Eq for BareYCbCr<T>
[src]
impl<T> Flatten for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar,
[src]
T: PosNormalChannelScalar + NormalChannelScalar,
fn as_slice(&self) -> &[Self::ChannelFormat]
[src]
fn from_slice(vals: &[T]) -> Self
[src]
impl<T> FromTuple for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar,
[src]
T: PosNormalChannelScalar + NormalChannelScalar,
fn from_tuple(values: Self::ChannelsTuple) -> Self
[src]
impl<T: Hash> Hash for BareYCbCr<T>
[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> HomogeneousColor for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar,
[src]
T: PosNormalChannelScalar + NormalChannelScalar,
impl<T> Invert for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar,
[src]
T: PosNormalChannelScalar + NormalChannelScalar,
impl<T> Lerp for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar + Lerp,
[src]
T: PosNormalChannelScalar + NormalChannelScalar + Lerp,
type Position = <T as Lerp>::Position
The type of the pos
argument
fn lerp(&self, right: &Self, pos: Self::Position) -> Self
[src]
impl<T: Ord> Ord for BareYCbCr<T>
[src]
fn cmp(&self, other: &BareYCbCr<T>) -> 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> PartialEq<BareYCbCr<T>> for BareYCbCr<T>
[src]
impl<T: PartialOrd> PartialOrd<BareYCbCr<T>> for BareYCbCr<T>
[src]
fn partial_cmp(&self, other: &BareYCbCr<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &BareYCbCr<T>) -> bool
[src]
fn le(&self, other: &BareYCbCr<T>) -> bool
[src]
fn gt(&self, other: &BareYCbCr<T>) -> bool
[src]
fn ge(&self, other: &BareYCbCr<T>) -> bool
[src]
impl<T> RelativeEq<BareYCbCr<T>> for BareYCbCr<T> where
T: PosNormalChannelScalar + NormalChannelScalar + RelativeEq,
T::Epsilon: Clone,
[src]
T: PosNormalChannelScalar + NormalChannelScalar + RelativeEq,
T::Epsilon: Clone,
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> 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]
T: PosNormalChannelScalar + NormalChannelScalar + UlpsEq,
T::Epsilon: Clone,
Auto Trait Implementations
impl<T> RefUnwindSafe for BareYCbCr<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for BareYCbCr<T> where
T: Send,
T: Send,
impl<T> Sync for BareYCbCr<T> where
T: Sync,
T: Sync,
impl<T> Unpin for BareYCbCr<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for BareYCbCr<T> where
T: 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>,