#[non_exhaustive]pub enum ColorPrimaries {
Bt709,
Bt470bg,
Smpte170m,
Smpte240m,
Film,
DciP3,
DisplayP3,
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.470BG / SMPTE-170M: SD content (PAL/SECAM / NTSC)
- DCI-P3 / Display P3: digital cinema and wide-gamut displays
- BT.2020: Wide color gamut for UHD/HDR
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Bt709
ITU-R BT.709 primaries (same as sRGB, most common)
Bt470bg
ITU-R BT.470BG primaries (PAL/SECAM SD video)
Smpte170m
SMPTE 170M primaries (NTSC SD video)
Smpte240m
SMPTE 240M primaries (legacy HD)
Film
Generic film primaries (Illuminant C)
DciP3
DCI-P3 primaries (SMPTE RP 431-2, digital cinema)
DisplayP3
Display P3 primaries (SMPTE EG 432-1, wide-gamut displays)
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 a wide color gamut (BT.2020, DCI-P3, or Display P3).
§Examples
use ff_format::color::ColorPrimaries;
assert!(ColorPrimaries::Bt2020.is_wide_gamut());
assert!(ColorPrimaries::DciP3.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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ColorPrimaries
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
Source§impl Display for ColorPrimaries
impl Display for ColorPrimaries
impl Eq for ColorPrimaries
Source§impl Hash for ColorPrimaries
impl Hash for ColorPrimaries
Source§impl PartialEq for ColorPrimaries
impl PartialEq for ColorPrimaries
Source§fn eq(&self, other: &ColorPrimaries) -> bool
fn eq(&self, other: &ColorPrimaries) -> bool
self and other values to be equal, and is used by ==.