pub enum BlpError {
Io(Error),
InvalidMagic,
InvalidFormatVersion(u32),
UnsupportedEncoding(u8),
NoMipmaps,
OutOfBounds,
DataTooShort,
ImageTooLarge,
JpegDecode(String),
}Expand description
All errors that can be returned by this crate.
Variants§
Io(Error)
An I/O error occurred while reading the file or buffer.
InvalidMagic
The first four bytes of the file are not a recognised BLP magic number
(BLP0, BLP1, or BLP2).
InvalidFormatVersion(u32)
A BLP2 file declared a format version other than 1.
UnsupportedEncoding(u8)
The color encoding byte is not one of the five known values (JPEG=0, Palette=1, DXT=2, ARGB8888=3, ARGB8888Dup=4).
NoMipmaps
[BlpFile::get_pixels] was called on a file whose mipmap offset table
contains no non-zero entries.
OutOfBounds
A mipmap offset/size pair points outside the bounds of the file buffer,
or offset + size overflows usize.
DataTooShort
The mipmap data slice is present but shorter than the decoded image requires (e.g. palette indices are truncated, or alpha bytes are missing).
ImageTooLarge
The declared image dimensions (width × height × 4) would exceed the
256 MiB allocation ceiling, or the multiplication overflows usize.
JpegDecode(String)
JPEG decoding failed. The inner string contains the decoder’s error message.
Trait Implementations§
Source§impl Error for BlpError
impl Error for BlpError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()