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

Constructs a new Chromaton instance.

Constructs a specific Chromaton instance for yuv8.

Constructs a specific Chromaton instance for yuvhb.

Constructs a specific Chromaton instance for packrgb.

Constructs a specific Chromaton instance for pal8.

Returns the subsampling of a component.

Tells whether a component is packed.

Returns the bit depth of a component.

Returns the bit shift of a packed component.

Returns the byte offset of a packed component.

Returns the byte offset to the next element of a packed component.

Calculates the width for a component from general image width.

Calculates the height for a component from general image height.

Calculates the minimal stride for a component from general image width.

Calculates the required image size in pixels for a component from general image width.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.