#[non_exhaustive]#[repr(u8)]pub enum ColorPrimaries {
Bt709 = 1,
Bt2020 = 9,
DisplayP3 = 12,
Unknown = 255,
}Expand description
Color primaries (CIE xy chromaticities of R, G, B).
Discriminant values match CICP ColorPrimaries codes (ITU-T H.273).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Bt709 = 1
BT.709 / sRGB (CICP 1).
Bt2020 = 9
BT.2020 / BT.2100 (CICP 9). Wide gamut for HDR.
DisplayP3 = 12
Display P3 (CICP 12). Apple ecosystem, wide gamut SDR.
Unknown = 255
Primaries not known.
Implementations§
Source§impl ColorPrimaries
impl ColorPrimaries
Sourcepub const fn from_cicp(code: u8) -> Option<ColorPrimaries>
pub const fn from_cicp(code: u8) -> Option<ColorPrimaries>
Map a CICP color_primaries code to a ColorPrimaries.
Sourcepub const fn contains(self, other: ColorPrimaries) -> bool
pub const fn contains(self, other: ColorPrimaries) -> bool
Whether self fully contains the gamut of other.
Gamut hierarchy: BT.2020 > Display P3 > BT.709.
Trait Implementations§
Source§impl Clone for ColorPrimaries
impl Clone for ColorPrimaries
Source§fn clone(&self) -> ColorPrimaries
fn clone(&self) -> ColorPrimaries
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ColorPrimariesExt for ColorPrimaries
impl ColorPrimariesExt for ColorPrimaries
Source§fn to_xyz_matrix(&self) -> Option<&'static GamutMatrix>
fn to_xyz_matrix(&self) -> Option<&'static GamutMatrix>
Linear RGB → CIE XYZ (D65 white point). Read more
Source§fn from_xyz_matrix(&self) -> Option<&'static GamutMatrix>
fn from_xyz_matrix(&self) -> Option<&'static GamutMatrix>
CIE XYZ (D65 white point) → linear RGB. Read more
Source§impl Debug for ColorPrimaries
impl Debug for ColorPrimaries
Source§impl Default for ColorPrimaries
impl Default for ColorPrimaries
Source§fn default() -> ColorPrimaries
fn default() -> ColorPrimaries
Returns the “default value” for a type. Read more
Source§impl Display for ColorPrimaries
impl Display for ColorPrimaries
Source§impl Hash for ColorPrimaries
impl Hash for ColorPrimaries
Source§impl PartialEq for ColorPrimaries
impl PartialEq for ColorPrimaries
impl Copy for ColorPrimaries
impl Eq for ColorPrimaries
impl StructuralPartialEq for ColorPrimaries
Auto Trait Implementations§
impl Freeze for ColorPrimaries
impl RefUnwindSafe for ColorPrimaries
impl Send for ColorPrimaries
impl Sync for ColorPrimaries
impl Unpin for ColorPrimaries
impl UnsafeUnpin for ColorPrimaries
impl UnwindSafe for ColorPrimaries
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more