av_data::pixel

Struct Formaton

Source
pub struct Formaton {
    pub model: ColorModel,
    pub primaries: ColorPrimaries,
    pub xfer: TransferCharacteristic,
    pub matrix: MatrixCoefficients,
    pub chroma_location: ChromaLocation,
    pub components: u8,
    pub comp_info: [Option<Chromaton>; 5],
    pub elem_size: u8,
    pub be: bool,
    pub alpha: bool,
    pub palette: bool,
}
Expand description

Image colorspace representation.

Includes both definitions for each component and some common definitions.

For example, the format can be paletted, so the components describe the palette storage format, while the actual data is 8-bit palette indices.

Fields§

§model: ColorModel

Image color model.

§primaries: ColorPrimaries

Image color primaries.

§xfer: TransferCharacteristic

Image transfer characteristic.

§matrix: MatrixCoefficients

Image matrix coefficients.

§chroma_location: ChromaLocation

Image chroma location.

§components: u8

Actual number of components present.

§comp_info: [Option<Chromaton>; 5]

Format definition for each component.

§elem_size: u8

Single pixel size for packed formats.

§be: bool

Tells if data is stored as big-endian.

§alpha: bool

Tells if image has alpha component.

§palette: bool

Tells if data is paletted.

Implementations§

Source§

impl Formaton

Source

pub fn new( model: ColorModel, components: &[Chromaton], elem_size: u8, be: bool, alpha: bool, palette: bool, ) -> Self

Constructs a new instance of Formaton.

Source

pub fn get_model(&self) -> ColorModel

Returns current color model.

Source

pub fn get_primaries(&self) -> ColorPrimaries

Returns current image primaries.

Source

pub fn get_total_depth(&self) -> u8

Returns the total amount of bits needed for components.

Source

pub fn set_primaries(self, pc: ColorPrimaries)

Sets current image primaries.

Source

pub fn set_primaries_from_u32(self, pc: u32) -> Option<ColorPrimaries>

Sets current image primaries from u32.

Source

pub fn get_xfer(&self) -> TransferCharacteristic

Returns current image transfer characteristic.

Source

pub fn set_xfer(self, pc: TransferCharacteristic)

Sets current image transfer characteristic.

Source

pub fn set_xfer_from_u32(self, tc: u32) -> Option<TransferCharacteristic>

Sets current image transfer characteristic from u32.

Source

pub fn get_matrix(&self) -> MatrixCoefficients

Returns current image matrix coefficients.

Source

pub fn set_matrix(self, mc: MatrixCoefficients)

Sets current image matrix coefficients.

Source

pub fn set_matrix_from_u32(self, mc: u32) -> Option<MatrixCoefficients>

Sets current image matrix coefficients from u32.

Source

pub fn get_num_comp(&self) -> usize

Returns the number of components.

Source

pub fn get_chromaton(&self, idx: usize) -> Option<Chromaton>

Returns selected component information.

Source

pub fn is_be(&self) -> bool

Reports whether the packing format is big-endian.

Source

pub fn has_alpha(&self) -> bool

Reports whether a colorspace has an alpha component.

Source

pub fn is_paletted(&self) -> bool

Reports whether this is a paletted format.

Source

pub fn get_elem_size(&self) -> u8

Returns single packed pixel size.

Source

pub fn iter(&self) -> Iter<'_, Option<Chromaton>>

Returns an iterator over the format definition of each component.

Trait Implementations§

Source§

impl Clone for Formaton

Source§

fn clone(&self) -> Formaton

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Formaton

Source§

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

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

impl Display for Formaton

Source§

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

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

impl Hash for Formaton

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> Index<usize> for &'a Formaton

Source§

type Output = Option<Chromaton>

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a> IntoIterator for &'a Formaton

Source§

type Item = &'a Option<Chromaton>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Option<Chromaton>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for Formaton

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Formaton

Source§

impl Eq for Formaton

Source§

impl StructuralPartialEq for Formaton

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.