module Vision.Image.Grey.Type (
Grey, GreyPixel (..), GreyDelayed
) where
import Data.Bits
import Data.Word
import Foreign.Storable (Storable)
import Vision.Image.Class (Pixel (..))
import Vision.Image.Interpolate (Interpolable (..))
import Vision.Image.Type (Manifest, Delayed)
newtype GreyPixel = GreyPixel Word8
deriving (Bits, Bounded, Enum, Eq, Integral, Num, Ord, Real, Read, Show
, Storable)
type Grey = Manifest GreyPixel
type GreyDelayed = Delayed GreyPixel
instance Pixel GreyPixel where
type PixelChannel GreyPixel = Word8
pixNChannels _ = 1
pixIndex !(GreyPixel v) _ = v
instance Interpolable GreyPixel where
interpol f (GreyPixel a) (GreyPixel b) = GreyPixel $ f a b