pub trait PixelBound {
fn min_pixel() -> Self;
fn max_pixel() -> Self;
fn discrete_levels() -> Option<usize>;
}
impl PixelBound for f64 {
fn min_pixel() -> Self {
0.0f64
}
fn max_pixel() -> Self {
1.0f64
}
fn discrete_levels() -> Option<usize> {
None
}
}
impl PixelBound for f32 {
fn min_pixel() -> Self {
0.0f32
}
fn max_pixel() -> Self {
1.0f32
}
fn discrete_levels() -> Option<usize> {
None
}
}
impl PixelBound for u8 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for u16 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for u32 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for u64 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for u128 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for i8 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for i16 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for i32 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for i64 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}
impl PixelBound for i128 {
fn min_pixel() -> Self {
Self::min_value()
}
fn max_pixel() -> Self {
Self::max_value()
}
fn discrete_levels() -> Option<usize> {
Some(Self::max_value() as usize + 1)
}
}