#[non_exhaustive]pub enum ColorPrimaries {
Bt709,
Bt601,
Bt2020,
Unknown,
}Expand description
Color primaries defining the color gamut (the range of colors that can be represented).
Different standards define different primary colors (red, green, blue points) which determine the overall range of colors that can be displayed.
§Common Usage
- BT.709: HD content, same as sRGB primaries
- BT.601: SD content (NTSC or PAL)
- BT.2020: Wide color gamut for UHD/HDR
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
ITU-R BT.709 primaries (same as sRGB, most common)
Bt601
ITU-R BT.601 primaries (SD video)
Bt2020
ITU-R BT.2020 primaries (wide color gamut for UHD/HDR)
Unknown
Color primaries are not specified or unknown
Implementations§
Source§impl ColorPrimaries
impl ColorPrimaries
Sourcepub const fn name(&self) -> &'static str
pub const fn name(&self) -> &'static str
Returns the name of the color primaries as a human-readable string.
§Examples
use ff_format::color::ColorPrimaries;
assert_eq!(ColorPrimaries::Bt709.name(), "bt709");
assert_eq!(ColorPrimaries::Bt2020.name(), "bt2020");Sourcepub const fn is_wide_gamut(&self) -> bool
pub const fn is_wide_gamut(&self) -> bool
Returns true if this uses wide color gamut (BT.2020).
§Examples
use ff_format::color::ColorPrimaries;
assert!(ColorPrimaries::Bt2020.is_wide_gamut());
assert!(!ColorPrimaries::Bt709.is_wide_gamut());Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true if the color primaries are unknown.
§Examples
use ff_format::color::ColorPrimaries;
assert!(ColorPrimaries::Unknown.is_unknown());
assert!(!ColorPrimaries::Bt709.is_unknown());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 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