use crate::ColorModel;
use crate::chan::{Ch8, Ch16, Ch32, Channel, Linear, Premultiplied};
use crate::el::{Pix, PixRgba, Pixel};
use std::ops::Range;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct Matte {}
impl ColorModel for Matte {
const CIRCULAR: Range<usize> = 0..0;
const LINEAR: Range<usize> = 0..0;
const ALPHA: usize = 0;
fn into_rgba<P>(p: P) -> PixRgba<P>
where
P: Pixel<Model = Self>,
{
let max = P::Chan::MAX;
PixRgba::<P>::new::<P::Chan>(max, max, max, p.alpha())
}
fn from_rgba<P>(rgba: PixRgba<P>) -> P
where
P: Pixel<Model = Self>,
{
let chan = rgba.channels();
P::from_channels(&[chan[3]])
}
}
pub type Matte8 = Pix<1, Ch8, Matte, Premultiplied, Linear>;
pub type Matte16 = Pix<1, Ch16, Matte, Premultiplied, Linear>;
pub type Matte32 = Pix<1, Ch32, Matte, Premultiplied, Linear>;