pub struct Qoi {
    pub width: u32,
    pub height: u32,
    pub colors: Colors,
}
Expand description

QOI descriptor value.
This value is parsed from image header during decoding.
Or provided by caller to drive encoding.

Fields

width: u32

Width of the image in pixels.

height: u32

Height of the image in pixels.

colors: Colors

Specifies image color space.

Implementations

Returns bytes size for the decoded image.

Reads header from encoded QOI image.
Returned header can be analyzed before proceeding parsing with Qoi::decode_skip_header.

Decode a QOI image from bytes slice.
Decoded raw RGB or RGBA pixels are written into output slice.

On success this function returns Ok(qoi) with qoi describing image dimensions and color space.
On failure this function returns Err(err) with err describing cause of the error.

Decode a QOI image from bytes slice.
bytes does not include QOI header. Uses provided Qoi value instead.
Decoded raw RGB or RGBA (depending on self.colors value) pixels are written into output slice.

On success this function returns Ok(()).
On failure this function returns Err(err) with err describing cause of the error.

Decode range of pixels into pixels slice.

Decode a QOI image from bytes slice.
Decoded raw RGB or RGBA pixels are written into allocated Vec.

On success this function returns Ok((qoi, vec)) with qoi describing image dimensions and color space and vec containing raw pixels data.
On failure this function returns Err(err) with err describing cause of the error.

Encode raw RGB or RGBA pixels into a QOI image.
Encoded image is written into output slice.

On success this function returns Ok(()).
On failure this function returns Err(err) with err describing cause of the error.

Encode range of pixels into output slice.

Returns maximum size of the Qoi::encode output size.
Using smaller slice may cause Qoi::encode to return Err(EncodeError::OutputIsTooSmall).

Encode raw RGB or RGBA pixels into a QOI image.
Encoded image is written into allocated Vec.

On success this function returns Ok(vec) with vec containing encoded image.
On failure this function returns Err(err) with err describing cause of the error.

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

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. 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.