pub struct Chromaton {
pub h_ss: u8,
pub v_ss: u8,
pub packed: bool,
pub depth: u8,
pub shift: u8,
pub comp_offs: u8,
pub next_elem: u8,
}Expand description
Single colorspace component definition.
Defines how the components of a colorspace are subsampled and where and how they are stored.
Fields
h_ss: u8Horizontal subsampling in power of two
(e.g. 0 = no subsampling, 1 = only every second value is stored).
v_ss: u8Vertical subsampling in power of two
(e.g. 0 = no subsampling, 1 = only every second value is stored).
packed: boolTells if a component is packed.
depth: u8Bit depth of a component.
shift: u8Shift for packed components.
comp_offs: u8Component offset for byte-packed components.
next_elem: u8The distance to the next packed element in bytes.
Implementations
sourceimpl Chromaton
impl Chromaton
sourcepub const fn new(
h_ss: u8,
v_ss: u8,
packed: bool,
depth: u8,
shift: u8,
comp_offs: u8,
next_elem: u8
) -> Self
pub const fn new(
h_ss: u8,
v_ss: u8,
packed: bool,
depth: u8,
shift: u8,
comp_offs: u8,
next_elem: u8
) -> Self
Constructs a new Chromaton instance.
sourcepub const fn yuv8(h_ss: u8, v_ss: u8, comp_offs: u8) -> Chromaton
pub const fn yuv8(h_ss: u8, v_ss: u8, comp_offs: u8) -> Chromaton
Constructs a specific Chromaton instance for yuv8.
sourcepub const fn yuvhb(h_ss: u8, v_ss: u8, depth: u8, comp_offs: u8) -> Chromaton
pub const fn yuvhb(h_ss: u8, v_ss: u8, depth: u8, comp_offs: u8) -> Chromaton
Constructs a specific Chromaton instance for yuvhb.
sourcepub const fn packrgb(
depth: u8,
shift: u8,
comp_offs: u8,
next_elem: u8
) -> Chromaton
pub const fn packrgb(
depth: u8,
shift: u8,
comp_offs: u8,
next_elem: u8
) -> Chromaton
Constructs a specific Chromaton instance for packrgb.
sourcepub const fn pal8(comp_offs: u8) -> Chromaton
pub const fn pal8(comp_offs: u8) -> Chromaton
Constructs a specific Chromaton instance for pal8.
sourcepub fn get_subsampling(self) -> (u8, u8)
pub fn get_subsampling(self) -> (u8, u8)
Returns the subsampling of a component.
sourcepub fn get_offset(self) -> u8
pub fn get_offset(self) -> u8
Returns the byte offset of a packed component.
sourcepub fn get_width(self, width: usize) -> usize
pub fn get_width(self, width: usize) -> usize
Calculates the width for a component from general image width.
sourcepub fn get_height(self, height: usize) -> usize
pub fn get_height(self, height: usize) -> usize
Calculates the height for a component from general image height.
sourcepub fn get_linesize(self, width: usize, alignment: usize) -> usize
pub fn get_linesize(self, width: usize, alignment: usize) -> usize
Calculates the minimal stride for a component from general image width.
Trait Implementations
sourceimpl PartialEq<Chromaton> for Chromaton
impl PartialEq<Chromaton> for Chromaton
impl Copy for Chromaton
impl Eq for Chromaton
impl StructuralEq for Chromaton
impl StructuralPartialEq for Chromaton
Auto Trait Implementations
impl RefUnwindSafe for Chromaton
impl Send for Chromaton
impl Sync for Chromaton
impl Unpin for Chromaton
impl UnwindSafe for Chromaton
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