#[cfg(feature = "gif")]
pub mod gif;
#[cfg(feature = "jpeg")]
pub mod jpeg;
#[cfg(feature = "png")]
pub mod png;
#[cfg(feature = "webp")]
pub mod webp;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum ColorType {
L,
LA,
Rgb,
Rgba,
PaletteRgb,
PaletteRgba,
Dynamic,
}
impl ColorType {
#[must_use]
pub const fn channels(&self) -> usize {
match self {
Self::L | Self::PaletteRgb | Self::PaletteRgba => 1,
Self::LA => 2,
Self::Rgb => 3,
Self::Rgba => 4,
Self::Dynamic => 0,
}
}
#[must_use]
pub const fn has_alpha(&self) -> bool {
matches!(
self,
Self::LA | Self::Rgba | Self::PaletteRgba | Self::Dynamic
)
}
#[must_use]
pub const fn is_paletted(&self) -> bool {
matches!(self, Self::PaletteRgb | Self::PaletteRgba)
}
#[must_use]
pub const fn is_dynamic(&self) -> bool {
matches!(self, Self::Dynamic)
}
}