{-# OPTIONS_HADDOCK not-home #-}
module Data.Colour.SRGB.Linear
(Colour, RGB(..)
,rgb, toRGB
,sRGBGamut
)
where
import qualified Data.Colour.Internal as Internal(Colour(RGB))
import Data.Colour.Internal (Colour)
import Data.Colour.Chan
import Data.Colour.RGB
import Data.Colour.CIE.Chromaticity
import Data.Colour.CIE.Illuminant (d65)
rgb :: Fractional a => a -> a -> a -> Colour a
rgb :: a -> a -> a -> Colour a
rgb a
r a
g a
b = Chan Red a -> Chan Green a -> Chan Blue a -> Colour a
forall a. Chan Red a -> Chan Green a -> Chan Blue a -> Colour a
Internal.RGB (a -> Chan Red a
forall p a. a -> Chan p a
Chan a
r) (a -> Chan Green a
forall p a. a -> Chan p a
Chan a
g) (a -> Chan Blue a
forall p a. a -> Chan p a
Chan a
b)
toRGB :: Fractional a => Colour a -> RGB a
toRGB :: Colour a -> RGB a
toRGB (Internal.RGB (Chan a
r) (Chan a
g) (Chan a
b)) = a -> a -> a -> RGB a
forall a. a -> a -> a -> RGB a
RGB a
r a
g a
b
sRGBGamut :: RGBGamut
sRGBGamut :: RGBGamut
sRGBGamut = RGB (Chromaticity Rational) -> Chromaticity Rational -> RGBGamut
RGBGamut (Chromaticity Rational
-> Chromaticity Rational
-> Chromaticity Rational
-> RGB (Chromaticity Rational)
forall a. a -> a -> a -> RGB a
RGB (Rational -> Rational -> Chromaticity Rational
forall a. Fractional a => a -> a -> Chromaticity a
mkChromaticity Rational
0.64 Rational
0.33)
(Rational -> Rational -> Chromaticity Rational
forall a. Fractional a => a -> a -> Chromaticity a
mkChromaticity Rational
0.30 Rational
0.60)
(Rational -> Rational -> Chromaticity Rational
forall a. Fractional a => a -> a -> Chromaticity a
mkChromaticity Rational
0.15 Rational
0.06))
Chromaticity Rational
forall a. Fractional a => Chromaticity a
d65