#[non_exhaustive]pub enum ColorRange {
Limited,
Full,
Unknown,
}Expand description
Color range defining the valid range of color values.
Video typically uses “limited” range where black is at level 16 and white at level 235 (for 8-bit). Computer graphics typically use “full” range where black is 0 and white is 255.
§Common Usage
- Limited: Broadcast video, Blu-ray, streaming services
- Full: Computer graphics, screenshots, game capture
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.
Limited
Limited/TV range (16-235 for Y, 16-240 for UV in 8-bit)
Full
Full/PC range (0-255 for all components in 8-bit)
Unknown
Color range is not specified or unknown
Implementations§
Source§impl ColorRange
impl ColorRange
Sourcepub const fn name(&self) -> &'static str
pub const fn name(&self) -> &'static str
Returns the name of the color range as a human-readable string.
§Examples
use ff_format::color::ColorRange;
assert_eq!(ColorRange::Limited.name(), "limited");
assert_eq!(ColorRange::Full.name(), "full");Sourcepub const fn is_full(&self) -> bool
pub const fn is_full(&self) -> bool
Returns true if this is full (PC) range.
§Examples
use ff_format::color::ColorRange;
assert!(ColorRange::Full.is_full());
assert!(!ColorRange::Limited.is_full());Sourcepub const fn is_limited(&self) -> bool
pub const fn is_limited(&self) -> bool
Returns true if this is limited (TV) range.
§Examples
use ff_format::color::ColorRange;
assert!(ColorRange::Limited.is_limited());
assert!(!ColorRange::Full.is_limited());Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true if the color range is unknown.
§Examples
use ff_format::color::ColorRange;
assert!(ColorRange::Unknown.is_unknown());
assert!(!ColorRange::Limited.is_unknown());Sourcepub const fn luma_min_8bit(&self) -> u8
pub const fn luma_min_8bit(&self) -> u8
Returns the minimum value for luma (Y) in 8-bit.
§Examples
use ff_format::color::ColorRange;
assert_eq!(ColorRange::Limited.luma_min_8bit(), 16);
assert_eq!(ColorRange::Full.luma_min_8bit(), 0);Sourcepub const fn luma_max_8bit(&self) -> u8
pub const fn luma_max_8bit(&self) -> u8
Returns the maximum value for luma (Y) in 8-bit.
§Examples
use ff_format::color::ColorRange;
assert_eq!(ColorRange::Limited.luma_max_8bit(), 235);
assert_eq!(ColorRange::Full.luma_max_8bit(), 255);Trait Implementations§
Source§impl Clone for ColorRange
impl Clone for ColorRange
Source§fn clone(&self) -> ColorRange
fn clone(&self) -> ColorRange
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 ColorRange
impl Debug for ColorRange
Source§impl Default for ColorRange
impl Default for ColorRange
Source§fn default() -> ColorRange
fn default() -> ColorRange
Returns the “default value” for a type. Read more
Source§impl Display for ColorRange
impl Display for ColorRange
Source§impl Hash for ColorRange
impl Hash for ColorRange
Source§impl PartialEq for ColorRange
impl PartialEq for ColorRange
impl Copy for ColorRange
impl Eq for ColorRange
impl StructuralPartialEq for ColorRange
Auto Trait Implementations§
impl Freeze for ColorRange
impl RefUnwindSafe for ColorRange
impl Send for ColorRange
impl Sync for ColorRange
impl Unpin for ColorRange
impl UnsafeUnpin for ColorRange
impl UnwindSafe for ColorRange
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