Trait image::ImageDecoder
source · pub trait ImageDecoder: Sized {
fn dimensions(&mut self) -> ImageResult<(u32, u32)>;
fn colortype(&mut self) -> ImageResult<ColorType>;
fn row_len(&mut self) -> ImageResult<usize>;
fn read_scanline(&mut self, buf: &mut [u8]) -> ImageResult<u32>;
fn read_image(&mut self) -> ImageResult<DecodingResult>;
fn is_animated(&mut self) -> ImageResult<bool> { ... }
fn into_frames(self) -> ImageResult<Frames> { ... }
fn load_rect(
&mut self,
x: u32,
y: u32,
length: u32,
width: u32
) -> ImageResult<Vec<u8>> { ... }
}
Expand description
The trait that all decoders implement
Required Methods
sourcefn dimensions(&mut self) -> ImageResult<(u32, u32)>
fn dimensions(&mut self) -> ImageResult<(u32, u32)>
Returns a tuple containing the width and height of the image
sourcefn colortype(&mut self) -> ImageResult<ColorType>
fn colortype(&mut self) -> ImageResult<ColorType>
Returns the color type of the image e.g. RGB(8) (8bit RGB)
sourcefn row_len(&mut self) -> ImageResult<usize>
fn row_len(&mut self) -> ImageResult<usize>
Returns the length in bytes of one decoded row of the image
sourcefn read_scanline(&mut self, buf: &mut [u8]) -> ImageResult<u32>
fn read_scanline(&mut self, buf: &mut [u8]) -> ImageResult<u32>
Reads one row from the image into buf
and returns the row index
sourcefn read_image(&mut self) -> ImageResult<DecodingResult>
fn read_image(&mut self) -> ImageResult<DecodingResult>
Decodes the entire image and return it as a Vector
Provided Methods
sourcefn is_animated(&mut self) -> ImageResult<bool>
fn is_animated(&mut self) -> ImageResult<bool>
Returns true if the image is animated
sourcefn into_frames(self) -> ImageResult<Frames>
fn into_frames(self) -> ImageResult<Frames>
Returns the frames of the image
If the image is not animated it returns a single frame
Implementors
impl<R: BufRead> ImageDecoder for HDRAdapter<R>
impl<R: Read + Seek> ImageDecoder for BMPDecoder<R>
impl<R: Read + Seek> ImageDecoder for ICODecoder<R>
impl<R: Read + Seek> ImageDecoder for TGADecoder<R>
impl<R: Read + Seek> ImageDecoder for TIFFDecoder<R>
impl<R: Read> ImageDecoder for DXTDecoder<R>
Note that, due to the way that DXT compression works, a scanline is considered to consist out of 4 lines of pixels.