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
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.