Struct image::dxt::DXTDecoder
source · pub struct DXTDecoder<R: Read> { /* private fields */ }
Expand description
DXT decoder
Implementations
sourceimpl<R: Read> DXTDecoder<R>
impl<R: Read> DXTDecoder<R>
sourcepub fn new(
r: R,
width: u32,
height: u32,
variant: DXTVariant
) -> Result<DXTDecoder<R>, ImageError>
pub fn new(
r: R,
width: u32,
height: u32,
variant: DXTVariant
) -> Result<DXTDecoder<R>, ImageError>
Create a new DXT decoder that decodes from the stream r
.
As DXT is often stored as raw buffers with the width/height
somewhere else the width and height of the image need
to be passed in width
and height
, as well as the
DXT variant in variant
.
width and height are required to be powers of 2 and at least 4.
otherwise an error will be returned
Trait Implementations
sourceimpl<R: Read> ImageDecoder for DXTDecoder<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.
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 indexsourcefn read_image(&mut self) -> ImageResult<DecodingResult>
fn read_image(&mut self) -> ImageResult<DecodingResult>
Decodes the entire image and return it as a Vector
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 Read more
Auto Trait Implementations
impl<R> RefUnwindSafe for DXTDecoder<R>where
R: RefUnwindSafe,
impl<R> Send for DXTDecoder<R>where
R: Send,
impl<R> Sync for DXTDecoder<R>where
R: Sync,
impl<R> Unpin for DXTDecoder<R>where
R: Unpin,
impl<R> UnwindSafe for DXTDecoder<R>where
R: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more