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: ColorModelImage color model.
primaries: ColorPrimariesImage color primaries.
xfer: TransferCharacteristicImage transfer characteristic.
matrix: MatrixCoefficientsImage matrix coefficients.
chroma_location: ChromaLocationImage chroma location.
components: u8Actual number of components present.
comp_info: [Option<Chromaton>; 5]Format definition for each component.
elem_size: u8Single pixel size for packed formats.
be: boolTells if data is stored as big-endian.
alpha: boolTells if image has alpha component.
palette: boolTells if data is paletted.
Implementations
sourceimpl Formaton
impl Formaton
sourcepub fn new(
model: ColorModel,
components: &[Chromaton],
elem_size: u8,
be: bool,
alpha: bool,
palette: bool
) -> Self
pub fn new(
model: ColorModel,
components: &[Chromaton],
elem_size: u8,
be: bool,
alpha: bool,
palette: bool
) -> Self
Constructs a new instance of Formaton.
sourcepub fn get_model(&self) -> ColorModel
pub fn get_model(&self) -> ColorModel
Returns current color model.
sourcepub fn get_primaries(&self) -> ColorPrimaries
pub fn get_primaries(&self) -> ColorPrimaries
Returns current image primaries.
sourcepub fn get_total_depth(&self) -> u8
pub fn get_total_depth(&self) -> u8
Returns the total amount of bits needed for components.
sourcepub fn set_primaries(self, pc: ColorPrimaries)
pub fn set_primaries(self, pc: ColorPrimaries)
Sets current image primaries.
sourcepub fn set_primaries_from_u32(self, pc: u32) -> Option<ColorPrimaries>
pub fn set_primaries_from_u32(self, pc: u32) -> Option<ColorPrimaries>
Sets current image primaries from u32.
sourcepub fn get_xfer(&self) -> TransferCharacteristic
pub fn get_xfer(&self) -> TransferCharacteristic
Returns current image transfer characteristic.
sourcepub fn set_xfer(self, pc: TransferCharacteristic)
pub fn set_xfer(self, pc: TransferCharacteristic)
Sets current image transfer characteristic.
sourcepub fn set_xfer_from_u32(self, tc: u32) -> Option<TransferCharacteristic>
pub fn set_xfer_from_u32(self, tc: u32) -> Option<TransferCharacteristic>
Sets current image transfer characteristic from u32.
sourcepub fn get_matrix(&self) -> MatrixCoefficients
pub fn get_matrix(&self) -> MatrixCoefficients
Returns current image matrix coefficients.
sourcepub fn set_matrix(self, mc: MatrixCoefficients)
pub fn set_matrix(self, mc: MatrixCoefficients)
Sets current image matrix coefficients.
sourcepub fn set_matrix_from_u32(self, mc: u32) -> Option<MatrixCoefficients>
pub fn set_matrix_from_u32(self, mc: u32) -> Option<MatrixCoefficients>
Sets current image matrix coefficients from u32.
sourcepub fn get_num_comp(&self) -> usize
pub fn get_num_comp(&self) -> usize
Returns the number of components.
sourcepub fn get_chromaton(&self, idx: usize) -> Option<Chromaton>
pub fn get_chromaton(&self, idx: usize) -> Option<Chromaton>
Returns selected component information.
sourcepub fn is_paletted(&self) -> bool
pub fn is_paletted(&self) -> bool
Reports whether this is a paletted format.
sourcepub fn get_elem_size(&self) -> u8
pub fn get_elem_size(&self) -> u8
Returns single packed pixel size.
Trait Implementations
sourceimpl<'a> IntoIterator for &'a Formaton
impl<'a> IntoIterator for &'a Formaton
sourceimpl PartialEq<Formaton> for Formaton
impl PartialEq<Formaton> for Formaton
impl Copy for Formaton
impl Eq for Formaton
impl StructuralEq for Formaton
impl StructuralPartialEq for Formaton
Auto Trait Implementations
impl RefUnwindSafe for Formaton
impl Send for Formaton
impl Sync for Formaton
impl Unpin for Formaton
impl UnwindSafe for Formaton
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more