Struct qoi::Encoder[][src]

pub struct Encoder<'a> { /* fields omitted */ }
Expand description

Encode QOI images into buffers or into streams.

Implementations

Creates a new encoder from a given array of pixel data and image dimensions.

The number of channels will be inferred automatically (the valid values are 3 or 4). The color space will be set to sRGB by default.

Returns a new encoder with modified color space.

Note: the color space doesn’t affect encoding or decoding in any way, it’s a purely informative field that’s stored in the image header.

Returns the inferred number of channels.

Returns the header that will be stored in the encoded image.

The maximum number of bytes the encoded image will take.

Can be used to pre-allocate the buffer to encode the image into.

Encodes the image to a pre-allocated buffer and returns the number of bytes written.

The minimum size of the buffer can be found via Encoder::required_buf_len.

Encodes the image into a newly allocated vector of bytes and returns it.

Encodes the image directly to a generic writer that implements Write.

Note: while it’s possible to pass a &mut [u8] slice here since it implements Write, it would more effficient to use a specialized method instead: Encoder::encode_to_buf.

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

Performs the conversion.

Performs the conversion.

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.