use super::*;
#[cfg(feature = "png")]
pub mod png;
#[cfg(feature = "gif")]
pub mod gif;
#[cfg(feature = "jpeg")]
pub mod jpeg;
#[derive(Debug)]
#[non_exhaustive]
pub enum LoadImageError {
Io(std::io::Error),
#[cfg(feature = "png")]
PNG(::png::DecodingError),
#[cfg(feature = "gif")]
GIF(::gif::DecodingFormatError),
#[cfg(feature = "jpeg")]
JPEG(::zune_jpeg::errors::DecodeErrors),
UnsupportedFormat,
}
impl From<std::io::Error> for LoadImageError {
#[inline]
fn from(e: std::io::Error) -> Self {
LoadImageError::Io(e)
}
}
#[cfg(feature = "png")]
impl From<::png::DecodingError> for LoadImageError {
#[inline]
fn from(e: ::png::DecodingError) -> Self {
match e {
::png::DecodingError::IoError(e) => LoadImageError::Io(e),
e => LoadImageError::PNG(e),
}
}
}
#[cfg(feature = "gif")]
impl From<::gif::DecodingError> for LoadImageError {
#[inline]
fn from(e: ::gif::DecodingError) -> Self {
match e {
::gif::DecodingError::Io(e) => LoadImageError::Io(e),
::gif::DecodingError::Format(e) => LoadImageError::GIF(e),
}
}
}
#[cfg(feature = "jpeg")]
impl From<::zune_jpeg::errors::DecodeErrors> for LoadImageError {
#[inline]
fn from(e: ::zune_jpeg::errors::DecodeErrors) -> Self {
match e {
::zune_jpeg::errors::DecodeErrors::IoErrors(::zune_jpeg::zune_core::bytestream::ZByteIoError::StdIoError(e)) => LoadImageError::Io(e),
e => LoadImageError::JPEG(e),
}
}
}