module Affection.Types ( RGBA , newRGBA , getR , getG , getB , getA ) where data RGBA = RGBA Int Int Int Int newRGBA :: Int -> Int -> Int -> Int -> RGBA newRGBA r g b a = RGBA (overflow r) (overflow g) (overflow b) (overflow a) where overflow x | x < 0 = x - (x `div` 256) * 255 + 1 | otherwise = x - (x `div` 256) * 255 getR :: RGBA -> Int getR (RGBA r _ _ _) = r getG :: RGBA -> Int getG (RGBA _ g _ _) = g getB :: RGBA -> Int getB (RGBA _ _ b _) = b getA :: RGBA -> Int getA (RGBA _ _ _ a) = a