use crate::_impl_init;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[allow(dead_code, reason = "Not exposed: U16, U32, F64")]
pub(crate) enum RasterSampleFormat {
#[default]
Unknown,
U8,
U16,
U32,
F32,
F64,
}
_impl_init![Self::Unknown => RasterSampleFormat];
impl RasterSampleFormat {
pub const fn bits(self) -> Option<u16> {
match self {
Self::Unknown => None,
Self::U8 => Some(8),
Self::U16 => Some(16),
Self::U32 => Some(32),
Self::F32 => Some(32),
Self::F64 => Some(64),
}
}
pub const fn is_unknown(self) -> bool {
matches!(self, Self::Unknown)
}
pub const fn is_float(self) -> bool {
matches!(self, Self::F32 | Self::F64)
}
pub const fn is_integer(self) -> bool {
matches!(self, Self::U8 | Self::U16 | Self::U32)
}
}