#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.range: ColorRangeNominal sample range.
primaries: u8H.273 §8.1 ColourPrimaries (1 = BT.709, 9 = BT.2020, 12 =
Display P3, 2 = unspecified).
transfer: u8H.273 §8.2 TransferCharacteristics (13 = sRGB, 16 = PQ, 18 =
HLG, 2 = unspecified).
matrix: u8H.273 §8.3 MatrixCoefficients (0 = identity / RGB, 1 = BT.709,
6 = BT.601, 9 = BT.2020 NCL, 2 = unspecified).
Implementations§
Source§impl ColorInfo
impl ColorInfo
Sourcepub const fn new(
range: ColorRange,
primaries: u8,
transfer: u8,
matrix: u8,
) -> Self
pub const fn new( range: ColorRange, primaries: u8, transfer: u8, matrix: u8, ) -> Self
Every field as a positional argument, in declaration order.
Sourcepub const fn miaf_default() -> Self
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.
Sourcepub const fn identity_full_range() -> Self
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.
Sourcepub fn from_colr(colr: Option<&Colr>) -> Self
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).
Sourcepub fn is_identity_matrix(&self) -> bool
pub fn is_identity_matrix(&self) -> bool
true for MatrixCoefficients == 0: the planes are G, B, R.
Sourcepub fn with_range(self, range: ColorRange) -> Self
pub fn with_range(self, range: ColorRange) -> Self
Setter: replace range.
Sourcepub fn with_primaries(self, primaries: u8) -> Self
pub fn with_primaries(self, primaries: u8) -> Self
Setter: replace primaries.
Sourcepub fn with_transfer(self, transfer: u8) -> Self
pub fn with_transfer(self, transfer: u8) -> Self
Setter: replace transfer.
Sourcepub fn with_matrix(self, matrix: u8) -> Self
pub fn with_matrix(self, matrix: u8) -> Self
Setter: replace matrix.