#[non_exhaustive]pub enum ColorSpace {
Bt709,
Bt601,
Bt2020,
DciP3,
Srgb,
Unknown,
}Expand description
Color space (matrix coefficients) for YUV to RGB conversion.
The color space defines how YUV values are converted to RGB and vice versa. Different standards use different matrix coefficients for this conversion.
§Common Usage
- BT.709: HD content (720p, 1080p)
- BT.601: SD content (480i, 576i)
- BT.2020: UHD/HDR content (4K, 8K)
- sRGB: Computer graphics, web content
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Bt709
ITU-R BT.709 - HD television standard (most common for HD video)
Bt601
ITU-R BT.601 - SD television standard
Bt2020
ITU-R BT.2020 - UHD/HDR television standard
DciP3
DCI-P3 - digital cinema wide color gamut
Srgb
sRGB color space - computer graphics and web
Unknown
Color space is not specified or unknown
Implementations§
Source§impl ColorSpace
impl ColorSpace
Sourcepub const fn name(&self) -> &'static str
pub const fn name(&self) -> &'static str
Returns the name of the color space as a human-readable string.
§Examples
use ff_format::color::ColorSpace;
assert_eq!(ColorSpace::Bt709.name(), "bt709");
assert_eq!(ColorSpace::Bt601.name(), "bt601");Sourcepub const fn is_hd(&self) -> bool
pub const fn is_hd(&self) -> bool
Returns true if this is an HD color space (BT.709).
§Examples
use ff_format::color::ColorSpace;
assert!(ColorSpace::Bt709.is_hd());
assert!(!ColorSpace::Bt601.is_hd());Sourcepub const fn is_sd(&self) -> bool
pub const fn is_sd(&self) -> bool
Returns true if this is an SD color space (BT.601).
§Examples
use ff_format::color::ColorSpace;
assert!(ColorSpace::Bt601.is_sd());
assert!(!ColorSpace::Bt709.is_sd());Sourcepub const fn is_uhd(&self) -> bool
pub const fn is_uhd(&self) -> bool
Returns true if this is a UHD/HDR color space (BT.2020).
§Examples
use ff_format::color::ColorSpace;
assert!(ColorSpace::Bt2020.is_uhd());
assert!(!ColorSpace::Bt709.is_uhd());Sourcepub const fn is_cinema(&self) -> bool
pub const fn is_cinema(&self) -> bool
Returns true if this is a cinema/DCI color space (DCI-P3).
§Examples
use ff_format::color::ColorSpace;
assert!(ColorSpace::DciP3.is_cinema());
assert!(!ColorSpace::Bt709.is_cinema());Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true if the color space is unknown.
§Examples
use ff_format::color::ColorSpace;
assert!(ColorSpace::Unknown.is_unknown());
assert!(!ColorSpace::Bt709.is_unknown());Trait Implementations§
Source§impl Clone for ColorSpace
impl Clone for ColorSpace
Source§fn clone(&self) -> ColorSpace
fn clone(&self) -> ColorSpace
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more