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: u8
Horizontal subsampling in power of two
(e.g. 0
= no subsampling, 1
= only every second value is stored).
v_ss: u8
Vertical subsampling in power of two
(e.g. 0
= no subsampling, 1
= only every second value is stored).
packed: bool
Tells if a component is packed.
depth: u8
Bit depth of a component.
shift: u8
Shift for packed components.
comp_offs: u8
Component offset for byte-packed components.
next_elem: u8
The distance to the next packed element in bytes.
Implementations§
Source§impl 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.