Struct qoi::Decoder [−][src]
pub struct Decoder<R> { /* fields omitted */ }Expand description
Decode QOI images from slices or from streams.
Implementations
Creates a new decoder from a slice of bytes.
The header will be decoded immediately upon construction.
Note: this provides the most efficient decoding, but requires the source data to
be loaded in memory in order to decode it. In order to decode from a generic
stream, use Decoder::from_stream instead.
Creates a new decoder from a generic reader that implements Read.
The header will be decoded immediately upon construction.
Note: while it’s possible to pass a &[u8] slice here since it implements Read, it
would be more efficient to use a specialized constructor instead: Decoder::new.
Consumes the decoder and returns the underlying reader back.
Returns a new decoder with modified number of channels.
By default, the number of channels in the decoded image will be equal to whatever is specified in the header. However, it is also possible to decode RGB into RGBA (in which case the alpha channel will be set to 255), and vice versa (in which case the alpha channel will be ignored).
Returns the number of channels in the decoded image.
Note: this may differ from the number of channels specified in the header.
The number of bytes the decoded image will take.
Can be used to pre-allocate the buffer to decode the image into.
Decodes the image to a pre-allocated buffer and returns the number of bytes written.
The minimum size of the buffer can be found via Decoder::required_buf_len.
Decodes the image into a newly allocated vector of bytes and returns it.
Trait Implementations
Auto Trait Implementations
impl<R> RefUnwindSafe for Decoder<R> where
R: RefUnwindSafe,
impl<R> UnwindSafe for Decoder<R> where
R: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more