Skip to main content

ColorInfo

Struct ColorInfo 

Source
#[non_exhaustive]
pub struct ColorInfo { pub range: ColorRange, pub primaries: u8, pub transfer: u8, pub matrix: u8, }
Expand description

The H.273 colour description of a picture: nominal range plus the ColourPrimaries / TransferCharacteristics / MatrixCoefficients code points (one byte each on the wire).

Filled from the item’s colr nclx on decode; when a file carries none (or only an ICC colr) the MIAF §7.3.6.4 default applies — BT.709 primaries (1), sRGB transfer (13), BT.601 matrix (6), full range — which is also Default here.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§range: ColorRange

Nominal sample range.

§primaries: u8

H.273 §8.1 ColourPrimaries (1 = BT.709, 9 = BT.2020, 12 = Display P3, 2 = unspecified).

§transfer: u8

H.273 §8.2 TransferCharacteristics (13 = sRGB, 16 = PQ, 18 = HLG, 2 = unspecified).

§matrix: u8

H.273 §8.3 MatrixCoefficients (0 = identity / RGB, 1 = BT.709, 6 = BT.601, 9 = BT.2020 NCL, 2 = unspecified).

Implementations§

Source§

impl ColorInfo

Source

pub const fn new( range: ColorRange, primaries: u8, transfer: u8, matrix: u8, ) -> Self

Every field as a positional argument, in declaration order.

Source

pub const fn miaf_default() -> Self

The MIAF §7.3.6.4 default for an item without CICP: BT.709 primaries, sRGB transfer, BT.601 matrix, full range.

Source

pub const fn identity_full_range() -> Self

The description the RGB constructors use: BT.709 primaries, sRGB transfer, the identity matrix (planes are G, B, R), full range.

Source

pub fn from_colr(colr: Option<&Colr>) -> Self

The effective colour of an item from its colr (MIAF §7.3.6.4): the nclx code points as signalled, else Self::miaf_default. Code points past 255 read as unspecified (2).

Source

pub fn to_colr(&self) -> Colr

The colr nclx property carrying this description.

Source

pub fn is_identity_matrix(&self) -> bool

true for MatrixCoefficients == 0: the planes are G, B, R.

Source

pub fn with_range(self, range: ColorRange) -> Self

Setter: replace range.

Source

pub fn with_primaries(self, primaries: u8) -> Self

Setter: replace primaries.

Source

pub fn with_transfer(self, transfer: u8) -> Self

Setter: replace transfer.

Source

pub fn with_matrix(self, matrix: u8) -> Self

Setter: replace matrix.

Trait Implementations§

Source§

impl Clone for ColorInfo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ColorInfo

Source§

impl Debug for ColorInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ColorInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for ColorInfo

Source§

impl From<ColorSignal> for ColorInfo

Source§

fn from(s: ColorSignal) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ColorInfo

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ColorInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.