{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Graphics.Color.Space.RGB.Alternative.CMYK
( pattern ColorCMYK
, pattern ColorCMYKA
, CMYK
, Color(CMYK)
) where
import Data.Coerce
import Data.Proxy
import Data.Typeable
import Foreign.Storable
import qualified Graphics.Color.Model.CMYK as CM
import Graphics.Color.Model.Internal
import Graphics.Color.Space.Internal
import Graphics.Color.Space.RGB.Internal
import qualified Graphics.Color.Space.RGB.ITU.Rec470 as Rec470
import Graphics.Color.Space.RGB.AdobeRGB
import Graphics.Color.Space.RGB.SRGB
import Graphics.Color.Space.RGB.ITU.Rec601
import Graphics.Color.Space.RGB.ITU.Rec709
data CMYK cs
newtype instance Color (CMYK cs) e = CMYK (Color CM.CMYK e)
deriving instance Eq e => Eq (Color (CMYK cs) e)
deriving instance Ord e => Ord (Color (CMYK cs) e)
deriving instance Functor (Color (CMYK cs))
deriving instance Applicative (Color (CMYK cs))
deriving instance Foldable (Color (CMYK cs))
deriving instance Traversable (Color (CMYK cs))
deriving instance Storable e => Storable (Color (CMYK cs) e)
instance ColorModel cs e => Show (Color (CMYK cs) e) where
showsPrec :: Int -> Color (CMYK cs) e -> ShowS
showsPrec Int
_ = Color (CMYK cs) e -> ShowS
forall cs e. ColorModel cs e => Color cs e -> ShowS
showsColorModel
pattern ColorCMYK :: e -> e -> e -> e -> Color (CMYK cs) e
pattern $bColorCMYK :: e -> e -> e -> e -> Color (CMYK cs) e
$mColorCMYK :: forall r k e (cs :: k).
Color (CMYK cs) e -> (e -> e -> e -> e -> r) -> (Void# -> r) -> r
ColorCMYK c m y k = CMYK (CM.ColorCMYK c m y k)
{-# COMPLETE ColorCMYK #-}
pattern ColorCMYKA :: e -> e -> e -> e -> e -> Color (Alpha (CMYK cs)) e
pattern $bColorCMYKA :: e -> e -> e -> e -> e -> Color (Alpha (CMYK cs)) e
$mColorCMYKA :: forall r k e (cs :: k).
Color (Alpha (CMYK cs)) e
-> (e -> e -> e -> e -> e -> r) -> (Void# -> r) -> r
ColorCMYKA c m y k a = Alpha (CMYK (CM.ColorCMYK c m y k)) a
{-# COMPLETE ColorCMYKA #-}
instance ColorModel cs e => ColorModel (CMYK cs) e where
type Components (CMYK cs) e = (e, e, e, e)
toComponents :: Color (CMYK cs) e -> Components (CMYK cs) e
toComponents = Color CMYK e -> (e, e, e, e)
forall cs e. ColorModel cs e => Color cs e -> Components cs e
toComponents (Color CMYK e -> (e, e, e, e))
-> (Color (CMYK cs) e -> Color CMYK e)
-> Color (CMYK cs) e
-> (e, e, e, e)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK cs) e -> Color CMYK e
coerce
{-# INLINE toComponents #-}
fromComponents :: Components (CMYK cs) e -> Color (CMYK cs) e
fromComponents = Color CMYK e -> Color (CMYK cs) e
coerce (Color CMYK e -> Color (CMYK cs) e)
-> ((e, e, e, e) -> Color CMYK e)
-> (e, e, e, e)
-> Color (CMYK cs) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e, e, e, e) -> Color CMYK e
forall cs e. ColorModel cs e => Components cs e -> Color cs e
fromComponents
{-# INLINE fromComponents #-}
showsColorModelName :: Proxy (Color (CMYK cs) e) -> ShowS
showsColorModelName Proxy (Color (CMYK cs) e)
_ = (String
"CMYK-" String -> ShowS
forall a. [a] -> [a] -> [a]
++) ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy (Color cs e) -> ShowS
forall cs e. ColorModel cs e => Proxy (Color cs e) -> ShowS
showsColorModelName (Proxy (Color cs e)
forall k (t :: k). Proxy t
Proxy :: Proxy (Color cs e))
instance (Typeable cs, ColorSpace (cs i l) i e, RedGreenBlue (cs i) i) =>
ColorSpace (CMYK (cs i l)) i e where
type BaseModel (CMYK (cs i l)) = CM.CMYK
type BaseSpace (CMYK (cs i l)) = cs i l
toBaseSpace :: Color (CMYK (cs i l)) e -> Color (BaseSpace (CMYK (cs i l))) e
toBaseSpace = Color RGB e -> Color (cs i l) e
forall k (cs :: Linearity -> *) (i :: k) e (l :: Linearity).
RedGreenBlue cs i =>
Color RGB e -> Color (cs l) e
mkColorRGB (Color RGB e -> Color (cs i l) e)
-> (Color (CMYK (cs i l)) e -> Color RGB e)
-> Color (CMYK (cs i l)) e
-> Color (cs i l) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color RGB Double -> Color RGB e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color RGB Double -> Color RGB e)
-> (Color (CMYK (cs i l)) e -> Color RGB Double)
-> Color (CMYK (cs i l)) e
-> Color RGB e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color CMYK Double -> Color RGB Double
forall e. (RealFloat e, Elevator e) => Color CMYK e -> Color RGB e
CM.cmyk2rgb (Color CMYK Double -> Color RGB Double)
-> (Color (CMYK (cs i l)) e -> Color CMYK Double)
-> Color (CMYK (cs i l)) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color CMYK e -> Color CMYK Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color CMYK e -> Color CMYK Double)
-> (Color (CMYK (cs i l)) e -> Color CMYK e)
-> Color (CMYK (cs i l)) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (cs i l)) e -> Color CMYK e
coerce
{-# INLINE toBaseSpace #-}
fromBaseSpace :: Color (BaseSpace (CMYK (cs i l))) e -> Color (CMYK (cs i l)) e
fromBaseSpace = Color CMYK e -> Color (CMYK (cs i l)) e
coerce (Color CMYK e -> Color (CMYK (cs i l)) e)
-> (Color (cs i l) e -> Color CMYK e)
-> Color (cs i l) e
-> Color (CMYK (cs i l)) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color CMYK Double -> Color CMYK e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color CMYK Double -> Color CMYK e)
-> (Color (cs i l) e -> Color CMYK Double)
-> Color (cs i l) e
-> Color CMYK e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color RGB Double -> Color CMYK Double
forall e. (RealFloat e, Elevator e) => Color RGB e -> Color CMYK e
CM.rgb2cmyk (Color RGB Double -> Color CMYK Double)
-> (Color (cs i l) e -> Color RGB Double)
-> Color (cs i l) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color RGB e -> Color RGB Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color RGB e -> Color RGB Double)
-> (Color (cs i l) e -> Color RGB e)
-> Color (cs i l) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (cs i l) e -> Color RGB e
forall k (cs :: Linearity -> *) (i :: k) (l :: Linearity) e.
RedGreenBlue cs i =>
Color (cs l) e -> Color RGB e
unColorRGB
{-# INLINE fromBaseSpace #-}
luminance :: Color (CMYK (cs i l)) e -> Color (Y i) a
luminance = Color (cs i l) e -> Color (Y i) a
forall k cs (i :: k) e a.
(ColorSpace cs i e, Elevator a, RealFloat a) =>
Color cs e -> Color (Y i) a
luminance (Color (cs i l) e -> Color (Y i) a)
-> (Color (CMYK (cs i l)) e -> Color (cs i l) e)
-> Color (CMYK (cs i l)) e
-> Color (Y i) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (cs i l)) e -> Color (cs i l) e
forall k cs (i :: k) e.
(ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) =>
Color cs e -> Color (BaseSpace cs) e
toBaseSpace
{-# INLINE luminance #-}
instance ColorSpace (SRGB l) D65 e => ColorSpace (CMYK (SRGB l)) D65 e where
type BaseModel (CMYK (SRGB l)) = CM.CMYK
type BaseSpace (CMYK (SRGB l)) = SRGB l
toBaseSpace :: Color (CMYK (SRGB l)) e -> Color (BaseSpace (CMYK (SRGB l))) e
toBaseSpace = Color RGB e -> Color (SRGB l) e
forall k (cs :: Linearity -> *) (i :: k) e (l :: Linearity).
RedGreenBlue cs i =>
Color RGB e -> Color (cs l) e
mkColorRGB (Color RGB e -> Color (SRGB l) e)
-> (Color (CMYK (SRGB l)) e -> Color RGB e)
-> Color (CMYK (SRGB l)) e
-> Color (SRGB l) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color RGB Double -> Color RGB e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color RGB Double -> Color RGB e)
-> (Color (CMYK (SRGB l)) e -> Color RGB Double)
-> Color (CMYK (SRGB l)) e
-> Color RGB e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color CMYK Double -> Color RGB Double
forall e. (RealFloat e, Elevator e) => Color CMYK e -> Color RGB e
CM.cmyk2rgb (Color CMYK Double -> Color RGB Double)
-> (Color (CMYK (SRGB l)) e -> Color CMYK Double)
-> Color (CMYK (SRGB l)) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color CMYK e -> Color CMYK Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color CMYK e -> Color CMYK Double)
-> (Color (CMYK (SRGB l)) e -> Color CMYK e)
-> Color (CMYK (SRGB l)) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (SRGB l)) e -> Color CMYK e
coerce
{-# INLINE toBaseSpace #-}
fromBaseSpace :: Color (BaseSpace (CMYK (SRGB l))) e -> Color (CMYK (SRGB l)) e
fromBaseSpace = Color CMYK e -> Color (CMYK (SRGB l)) e
coerce (Color CMYK e -> Color (CMYK (SRGB l)) e)
-> (Color (SRGB l) e -> Color CMYK e)
-> Color (SRGB l) e
-> Color (CMYK (SRGB l)) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color CMYK Double -> Color CMYK e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color CMYK Double -> Color CMYK e)
-> (Color (SRGB l) e -> Color CMYK Double)
-> Color (SRGB l) e
-> Color CMYK e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color RGB Double -> Color CMYK Double
forall e. (RealFloat e, Elevator e) => Color RGB e -> Color CMYK e
CM.rgb2cmyk (Color RGB Double -> Color CMYK Double)
-> (Color (SRGB l) e -> Color RGB Double)
-> Color (SRGB l) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color RGB e -> Color RGB Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color RGB e -> Color RGB Double)
-> (Color (SRGB l) e -> Color RGB e)
-> Color (SRGB l) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (SRGB l) e -> Color RGB e
forall k (cs :: Linearity -> *) (i :: k) (l :: Linearity) e.
RedGreenBlue cs i =>
Color (cs l) e -> Color RGB e
unColorRGB
{-# INLINE fromBaseSpace #-}
luminance :: Color (CMYK (SRGB l)) e -> Color (Y D65) a
luminance = Color (SRGB l) e -> Color (Y D65) a
forall k cs (i :: k) e a.
(ColorSpace cs i e, Elevator a, RealFloat a) =>
Color cs e -> Color (Y i) a
luminance (Color (SRGB l) e -> Color (Y D65) a)
-> (Color (CMYK (SRGB l)) e -> Color (SRGB l) e)
-> Color (CMYK (SRGB l)) e
-> Color (Y D65) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (SRGB l)) e -> Color (SRGB l) e
forall k cs (i :: k) e.
(ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) =>
Color cs e -> Color (BaseSpace cs) e
toBaseSpace
{-# INLINE luminance #-}
instance ColorSpace (AdobeRGB l) D65 e => ColorSpace (CMYK (AdobeRGB l)) D65 e where
type BaseModel (CMYK (AdobeRGB l)) = CM.CMYK
type BaseSpace (CMYK (AdobeRGB l)) = AdobeRGB l
toBaseSpace :: Color (CMYK (AdobeRGB l)) e
-> Color (BaseSpace (CMYK (AdobeRGB l))) e
toBaseSpace = Color RGB e -> Color (AdobeRGB l) e
forall k (cs :: Linearity -> *) (i :: k) e (l :: Linearity).
RedGreenBlue cs i =>
Color RGB e -> Color (cs l) e
mkColorRGB (Color RGB e -> Color (AdobeRGB l) e)
-> (Color (CMYK (AdobeRGB l)) e -> Color RGB e)
-> Color (CMYK (AdobeRGB l)) e
-> Color (AdobeRGB l) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color RGB Double -> Color RGB e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color RGB Double -> Color RGB e)
-> (Color (CMYK (AdobeRGB l)) e -> Color RGB Double)
-> Color (CMYK (AdobeRGB l)) e
-> Color RGB e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color CMYK Double -> Color RGB Double
forall e. (RealFloat e, Elevator e) => Color CMYK e -> Color RGB e
CM.cmyk2rgb (Color CMYK Double -> Color RGB Double)
-> (Color (CMYK (AdobeRGB l)) e -> Color CMYK Double)
-> Color (CMYK (AdobeRGB l)) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color CMYK e -> Color CMYK Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color CMYK e -> Color CMYK Double)
-> (Color (CMYK (AdobeRGB l)) e -> Color CMYK e)
-> Color (CMYK (AdobeRGB l)) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (AdobeRGB l)) e -> Color CMYK e
coerce
{-# INLINE toBaseSpace #-}
fromBaseSpace :: Color (BaseSpace (CMYK (AdobeRGB l))) e
-> Color (CMYK (AdobeRGB l)) e
fromBaseSpace = Color CMYK e -> Color (CMYK (AdobeRGB l)) e
coerce (Color CMYK e -> Color (CMYK (AdobeRGB l)) e)
-> (Color (AdobeRGB l) e -> Color CMYK e)
-> Color (AdobeRGB l) e
-> Color (CMYK (AdobeRGB l)) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color CMYK Double -> Color CMYK e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color CMYK Double -> Color CMYK e)
-> (Color (AdobeRGB l) e -> Color CMYK Double)
-> Color (AdobeRGB l) e
-> Color CMYK e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color RGB Double -> Color CMYK Double
forall e. (RealFloat e, Elevator e) => Color RGB e -> Color CMYK e
CM.rgb2cmyk (Color RGB Double -> Color CMYK Double)
-> (Color (AdobeRGB l) e -> Color RGB Double)
-> Color (AdobeRGB l) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color RGB e -> Color RGB Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color RGB e -> Color RGB Double)
-> (Color (AdobeRGB l) e -> Color RGB e)
-> Color (AdobeRGB l) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (AdobeRGB l) e -> Color RGB e
forall k (cs :: Linearity -> *) (i :: k) (l :: Linearity) e.
RedGreenBlue cs i =>
Color (cs l) e -> Color RGB e
unColorRGB
{-# INLINE fromBaseSpace #-}
luminance :: Color (CMYK (AdobeRGB l)) e -> Color (Y D65) a
luminance = Color (AdobeRGB l) e -> Color (Y D65) a
forall k cs (i :: k) e a.
(ColorSpace cs i e, Elevator a, RealFloat a) =>
Color cs e -> Color (Y i) a
luminance (Color (AdobeRGB l) e -> Color (Y D65) a)
-> (Color (CMYK (AdobeRGB l)) e -> Color (AdobeRGB l) e)
-> Color (CMYK (AdobeRGB l)) e
-> Color (Y D65) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (AdobeRGB l)) e -> Color (AdobeRGB l) e
forall k cs (i :: k) e.
(ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) =>
Color cs e -> Color (BaseSpace cs) e
toBaseSpace
{-# INLINE luminance #-}
instance ColorSpace (Rec470.BT470_525 l) D65 e => ColorSpace (CMYK (Rec470.BT470_525 l)) D65 e where
type BaseModel (CMYK (Rec470.BT470_525 l)) = CM.CMYK
type BaseSpace (CMYK (Rec470.BT470_525 l)) = Rec470.BT470_525 l
toBaseSpace :: Color (CMYK (BT470_525 l)) e
-> Color (BaseSpace (CMYK (BT470_525 l))) e
toBaseSpace = Color RGB e -> Color (BT470_525 l) e
forall k (cs :: Linearity -> *) (i :: k) e (l :: Linearity).
RedGreenBlue cs i =>
Color RGB e -> Color (cs l) e
mkColorRGB (Color RGB e -> Color (BT470_525 l) e)
-> (Color (CMYK (BT470_525 l)) e -> Color RGB e)
-> Color (CMYK (BT470_525 l)) e
-> Color (BT470_525 l) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color RGB Double -> Color RGB e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color RGB Double -> Color RGB e)
-> (Color (CMYK (BT470_525 l)) e -> Color RGB Double)
-> Color (CMYK (BT470_525 l)) e
-> Color RGB e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color CMYK Double -> Color RGB Double
forall e. (RealFloat e, Elevator e) => Color CMYK e -> Color RGB e
CM.cmyk2rgb (Color CMYK Double -> Color RGB Double)
-> (Color (CMYK (BT470_525 l)) e -> Color CMYK Double)
-> Color (CMYK (BT470_525 l)) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color CMYK e -> Color CMYK Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color CMYK e -> Color CMYK Double)
-> (Color (CMYK (BT470_525 l)) e -> Color CMYK e)
-> Color (CMYK (BT470_525 l)) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT470_525 l)) e -> Color CMYK e
coerce
{-# INLINE toBaseSpace #-}
fromBaseSpace :: Color (BaseSpace (CMYK (BT470_525 l))) e
-> Color (CMYK (BT470_525 l)) e
fromBaseSpace = Color CMYK e -> Color (CMYK (BT470_525 l)) e
coerce (Color CMYK e -> Color (CMYK (BT470_525 l)) e)
-> (Color (BT470_525 l) e -> Color CMYK e)
-> Color (BT470_525 l) e
-> Color (CMYK (BT470_525 l)) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color CMYK Double -> Color CMYK e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color CMYK Double -> Color CMYK e)
-> (Color (BT470_525 l) e -> Color CMYK Double)
-> Color (BT470_525 l) e
-> Color CMYK e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color RGB Double -> Color CMYK Double
forall e. (RealFloat e, Elevator e) => Color RGB e -> Color CMYK e
CM.rgb2cmyk (Color RGB Double -> Color CMYK Double)
-> (Color (BT470_525 l) e -> Color RGB Double)
-> Color (BT470_525 l) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color RGB e -> Color RGB Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color RGB e -> Color RGB Double)
-> (Color (BT470_525 l) e -> Color RGB e)
-> Color (BT470_525 l) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (BT470_525 l) e -> Color RGB e
forall k (cs :: Linearity -> *) (i :: k) (l :: Linearity) e.
RedGreenBlue cs i =>
Color (cs l) e -> Color RGB e
unColorRGB
{-# INLINE fromBaseSpace #-}
luminance :: Color (CMYK (BT470_525 l)) e -> Color (Y D65) a
luminance = Color (BT470_525 l) e -> Color (Y D65) a
forall k cs (i :: k) e a.
(ColorSpace cs i e, Elevator a, RealFloat a) =>
Color cs e -> Color (Y i) a
luminance (Color (BT470_525 l) e -> Color (Y D65) a)
-> (Color (CMYK (BT470_525 l)) e -> Color (BT470_525 l) e)
-> Color (CMYK (BT470_525 l)) e
-> Color (Y D65) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT470_525 l)) e -> Color (BT470_525 l) e
forall k cs (i :: k) e.
(ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) =>
Color cs e -> Color (BaseSpace cs) e
toBaseSpace
{-# INLINE luminance #-}
instance ColorSpace (Rec470.BT470_625 l) D65 e => ColorSpace (CMYK (Rec470.BT470_625 l)) D65 e where
type BaseModel (CMYK (Rec470.BT470_625 l)) = CM.CMYK
type BaseSpace (CMYK (Rec470.BT470_625 l)) = Rec470.BT470_625 l
toBaseSpace :: Color (CMYK (BT470_625 l)) e
-> Color (BaseSpace (CMYK (BT470_625 l))) e
toBaseSpace = Color RGB e -> Color (BT470_625 l) e
forall k (cs :: Linearity -> *) (i :: k) e (l :: Linearity).
RedGreenBlue cs i =>
Color RGB e -> Color (cs l) e
mkColorRGB (Color RGB e -> Color (BT470_625 l) e)
-> (Color (CMYK (BT470_625 l)) e -> Color RGB e)
-> Color (CMYK (BT470_625 l)) e
-> Color (BT470_625 l) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color RGB Double -> Color RGB e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color RGB Double -> Color RGB e)
-> (Color (CMYK (BT470_625 l)) e -> Color RGB Double)
-> Color (CMYK (BT470_625 l)) e
-> Color RGB e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color CMYK Double -> Color RGB Double
forall e. (RealFloat e, Elevator e) => Color CMYK e -> Color RGB e
CM.cmyk2rgb (Color CMYK Double -> Color RGB Double)
-> (Color (CMYK (BT470_625 l)) e -> Color CMYK Double)
-> Color (CMYK (BT470_625 l)) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color CMYK e -> Color CMYK Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color CMYK e -> Color CMYK Double)
-> (Color (CMYK (BT470_625 l)) e -> Color CMYK e)
-> Color (CMYK (BT470_625 l)) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT470_625 l)) e -> Color CMYK e
coerce
{-# INLINE toBaseSpace #-}
fromBaseSpace :: Color (BaseSpace (CMYK (BT470_625 l))) e
-> Color (CMYK (BT470_625 l)) e
fromBaseSpace = Color CMYK e -> Color (CMYK (BT470_625 l)) e
coerce (Color CMYK e -> Color (CMYK (BT470_625 l)) e)
-> (Color (BT470_625 l) e -> Color CMYK e)
-> Color (BT470_625 l) e
-> Color (CMYK (BT470_625 l)) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color CMYK Double -> Color CMYK e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color CMYK Double -> Color CMYK e)
-> (Color (BT470_625 l) e -> Color CMYK Double)
-> Color (BT470_625 l) e
-> Color CMYK e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color RGB Double -> Color CMYK Double
forall e. (RealFloat e, Elevator e) => Color RGB e -> Color CMYK e
CM.rgb2cmyk (Color RGB Double -> Color CMYK Double)
-> (Color (BT470_625 l) e -> Color RGB Double)
-> Color (BT470_625 l) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color RGB e -> Color RGB Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color RGB e -> Color RGB Double)
-> (Color (BT470_625 l) e -> Color RGB e)
-> Color (BT470_625 l) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (BT470_625 l) e -> Color RGB e
forall k (cs :: Linearity -> *) (i :: k) (l :: Linearity) e.
RedGreenBlue cs i =>
Color (cs l) e -> Color RGB e
unColorRGB
{-# INLINE fromBaseSpace #-}
luminance :: Color (CMYK (BT470_625 l)) e -> Color (Y D65) a
luminance = Color (BT470_625 l) e -> Color (Y D65) a
forall k cs (i :: k) e a.
(ColorSpace cs i e, Elevator a, RealFloat a) =>
Color cs e -> Color (Y i) a
luminance (Color (BT470_625 l) e -> Color (Y D65) a)
-> (Color (CMYK (BT470_625 l)) e -> Color (BT470_625 l) e)
-> Color (CMYK (BT470_625 l)) e
-> Color (Y D65) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT470_625 l)) e -> Color (BT470_625 l) e
forall k cs (i :: k) e.
(ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) =>
Color cs e -> Color (BaseSpace cs) e
toBaseSpace
{-# INLINE luminance #-}
instance ColorSpace (BT601_525 l) D65 e => ColorSpace (CMYK (BT601_525 l)) D65 e where
type BaseModel (CMYK (BT601_525 l)) = CM.CMYK
type BaseSpace (CMYK (BT601_525 l)) = BT601_525 l
toBaseSpace :: Color (CMYK (BT601_525 l)) e
-> Color (BaseSpace (CMYK (BT601_525 l))) e
toBaseSpace = Color RGB e -> Color (BT601_525 l) e
forall k (cs :: Linearity -> *) (i :: k) e (l :: Linearity).
RedGreenBlue cs i =>
Color RGB e -> Color (cs l) e
mkColorRGB (Color RGB e -> Color (BT601_525 l) e)
-> (Color (CMYK (BT601_525 l)) e -> Color RGB e)
-> Color (CMYK (BT601_525 l)) e
-> Color (BT601_525 l) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color RGB Double -> Color RGB e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color RGB Double -> Color RGB e)
-> (Color (CMYK (BT601_525 l)) e -> Color RGB Double)
-> Color (CMYK (BT601_525 l)) e
-> Color RGB e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color CMYK Double -> Color RGB Double
forall e. (RealFloat e, Elevator e) => Color CMYK e -> Color RGB e
CM.cmyk2rgb (Color CMYK Double -> Color RGB Double)
-> (Color (CMYK (BT601_525 l)) e -> Color CMYK Double)
-> Color (CMYK (BT601_525 l)) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color CMYK e -> Color CMYK Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color CMYK e -> Color CMYK Double)
-> (Color (CMYK (BT601_525 l)) e -> Color CMYK e)
-> Color (CMYK (BT601_525 l)) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT601_525 l)) e -> Color CMYK e
coerce
{-# INLINE toBaseSpace #-}
fromBaseSpace :: Color (BaseSpace (CMYK (BT601_525 l))) e
-> Color (CMYK (BT601_525 l)) e
fromBaseSpace = Color CMYK e -> Color (CMYK (BT601_525 l)) e
coerce (Color CMYK e -> Color (CMYK (BT601_525 l)) e)
-> (Color (BT601_525 l) e -> Color CMYK e)
-> Color (BT601_525 l) e
-> Color (CMYK (BT601_525 l)) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color CMYK Double -> Color CMYK e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color CMYK Double -> Color CMYK e)
-> (Color (BT601_525 l) e -> Color CMYK Double)
-> Color (BT601_525 l) e
-> Color CMYK e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color RGB Double -> Color CMYK Double
forall e. (RealFloat e, Elevator e) => Color RGB e -> Color CMYK e
CM.rgb2cmyk (Color RGB Double -> Color CMYK Double)
-> (Color (BT601_525 l) e -> Color RGB Double)
-> Color (BT601_525 l) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color RGB e -> Color RGB Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color RGB e -> Color RGB Double)
-> (Color (BT601_525 l) e -> Color RGB e)
-> Color (BT601_525 l) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (BT601_525 l) e -> Color RGB e
forall k (cs :: Linearity -> *) (i :: k) (l :: Linearity) e.
RedGreenBlue cs i =>
Color (cs l) e -> Color RGB e
unColorRGB
{-# INLINE fromBaseSpace #-}
luminance :: Color (CMYK (BT601_525 l)) e -> Color (Y D65) a
luminance = Color (BT601_525 l) e -> Color (Y D65) a
forall k cs (i :: k) e a.
(ColorSpace cs i e, Elevator a, RealFloat a) =>
Color cs e -> Color (Y i) a
luminance (Color (BT601_525 l) e -> Color (Y D65) a)
-> (Color (CMYK (BT601_525 l)) e -> Color (BT601_525 l) e)
-> Color (CMYK (BT601_525 l)) e
-> Color (Y D65) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT601_525 l)) e -> Color (BT601_525 l) e
forall k cs (i :: k) e.
(ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) =>
Color cs e -> Color (BaseSpace cs) e
toBaseSpace
{-# INLINE luminance #-}
instance ColorSpace (BT601_625 l) D65 e => ColorSpace (CMYK (BT601_625 l)) D65 e where
type BaseModel (CMYK (BT601_625 l)) = CM.CMYK
type BaseSpace (CMYK (BT601_625 l)) = BT601_625 l
toBaseSpace :: Color (CMYK (BT601_625 l)) e
-> Color (BaseSpace (CMYK (BT601_625 l))) e
toBaseSpace = Color RGB e -> Color (BT601_625 l) e
forall k (cs :: Linearity -> *) (i :: k) e (l :: Linearity).
RedGreenBlue cs i =>
Color RGB e -> Color (cs l) e
mkColorRGB (Color RGB e -> Color (BT601_625 l) e)
-> (Color (CMYK (BT601_625 l)) e -> Color RGB e)
-> Color (CMYK (BT601_625 l)) e
-> Color (BT601_625 l) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color RGB Double -> Color RGB e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color RGB Double -> Color RGB e)
-> (Color (CMYK (BT601_625 l)) e -> Color RGB Double)
-> Color (CMYK (BT601_625 l)) e
-> Color RGB e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color CMYK Double -> Color RGB Double
forall e. (RealFloat e, Elevator e) => Color CMYK e -> Color RGB e
CM.cmyk2rgb (Color CMYK Double -> Color RGB Double)
-> (Color (CMYK (BT601_625 l)) e -> Color CMYK Double)
-> Color (CMYK (BT601_625 l)) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color CMYK e -> Color CMYK Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color CMYK e -> Color CMYK Double)
-> (Color (CMYK (BT601_625 l)) e -> Color CMYK e)
-> Color (CMYK (BT601_625 l)) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT601_625 l)) e -> Color CMYK e
coerce
{-# INLINE toBaseSpace #-}
fromBaseSpace :: Color (BaseSpace (CMYK (BT601_625 l))) e
-> Color (CMYK (BT601_625 l)) e
fromBaseSpace = Color CMYK e -> Color (CMYK (BT601_625 l)) e
coerce (Color CMYK e -> Color (CMYK (BT601_625 l)) e)
-> (Color (BT601_625 l) e -> Color CMYK e)
-> Color (BT601_625 l) e
-> Color (CMYK (BT601_625 l)) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color CMYK Double -> Color CMYK e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color CMYK Double -> Color CMYK e)
-> (Color (BT601_625 l) e -> Color CMYK Double)
-> Color (BT601_625 l) e
-> Color CMYK e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color RGB Double -> Color CMYK Double
forall e. (RealFloat e, Elevator e) => Color RGB e -> Color CMYK e
CM.rgb2cmyk (Color RGB Double -> Color CMYK Double)
-> (Color (BT601_625 l) e -> Color RGB Double)
-> Color (BT601_625 l) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color RGB e -> Color RGB Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color RGB e -> Color RGB Double)
-> (Color (BT601_625 l) e -> Color RGB e)
-> Color (BT601_625 l) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (BT601_625 l) e -> Color RGB e
forall k (cs :: Linearity -> *) (i :: k) (l :: Linearity) e.
RedGreenBlue cs i =>
Color (cs l) e -> Color RGB e
unColorRGB
{-# INLINE fromBaseSpace #-}
luminance :: Color (CMYK (BT601_625 l)) e -> Color (Y D65) a
luminance = Color (BT601_625 l) e -> Color (Y D65) a
forall k cs (i :: k) e a.
(ColorSpace cs i e, Elevator a, RealFloat a) =>
Color cs e -> Color (Y i) a
luminance (Color (BT601_625 l) e -> Color (Y D65) a)
-> (Color (CMYK (BT601_625 l)) e -> Color (BT601_625 l) e)
-> Color (CMYK (BT601_625 l)) e
-> Color (Y D65) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT601_625 l)) e -> Color (BT601_625 l) e
forall k cs (i :: k) e.
(ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) =>
Color cs e -> Color (BaseSpace cs) e
toBaseSpace
{-# INLINE luminance #-}
instance ColorSpace (BT709 l) D65 e => ColorSpace (CMYK (BT709 l)) D65 e where
type BaseModel (CMYK (BT709 l)) = CM.CMYK
type BaseSpace (CMYK (BT709 l)) = BT709 l
toBaseSpace :: Color (CMYK (BT709 l)) e -> Color (BaseSpace (CMYK (BT709 l))) e
toBaseSpace = Color RGB e -> Color (BT709 l) e
forall k (cs :: Linearity -> *) (i :: k) e (l :: Linearity).
RedGreenBlue cs i =>
Color RGB e -> Color (cs l) e
mkColorRGB (Color RGB e -> Color (BT709 l) e)
-> (Color (CMYK (BT709 l)) e -> Color RGB e)
-> Color (CMYK (BT709 l)) e
-> Color (BT709 l) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color RGB Double -> Color RGB e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color RGB Double -> Color RGB e)
-> (Color (CMYK (BT709 l)) e -> Color RGB Double)
-> Color (CMYK (BT709 l)) e
-> Color RGB e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color CMYK Double -> Color RGB Double
forall e. (RealFloat e, Elevator e) => Color CMYK e -> Color RGB e
CM.cmyk2rgb (Color CMYK Double -> Color RGB Double)
-> (Color (CMYK (BT709 l)) e -> Color CMYK Double)
-> Color (CMYK (BT709 l)) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color CMYK e -> Color CMYK Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color CMYK e -> Color CMYK Double)
-> (Color (CMYK (BT709 l)) e -> Color CMYK e)
-> Color (CMYK (BT709 l)) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT709 l)) e -> Color CMYK e
coerce
{-# INLINE toBaseSpace #-}
fromBaseSpace :: Color (BaseSpace (CMYK (BT709 l))) e -> Color (CMYK (BT709 l)) e
fromBaseSpace = Color CMYK e -> Color (CMYK (BT709 l)) e
coerce (Color CMYK e -> Color (CMYK (BT709 l)) e)
-> (Color (BT709 l) e -> Color CMYK e)
-> Color (BT709 l) e
-> Color (CMYK (BT709 l)) e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double -> e) -> Color CMYK Double -> Color CMYK e
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Double -> e
forall e. Elevator e => Double -> e
fromDouble (Color CMYK Double -> Color CMYK e)
-> (Color (BT709 l) e -> Color CMYK Double)
-> Color (BT709 l) e
-> Color CMYK e
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color RGB Double -> Color CMYK Double
forall e. (RealFloat e, Elevator e) => Color RGB e -> Color CMYK e
CM.rgb2cmyk (Color RGB Double -> Color CMYK Double)
-> (Color (BT709 l) e -> Color RGB Double)
-> Color (BT709 l) e
-> Color CMYK Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (e -> Double) -> Color RGB e -> Color RGB Double
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap e -> Double
forall e. Elevator e => e -> Double
toDouble (Color RGB e -> Color RGB Double)
-> (Color (BT709 l) e -> Color RGB e)
-> Color (BT709 l) e
-> Color RGB Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (BT709 l) e -> Color RGB e
forall k (cs :: Linearity -> *) (i :: k) (l :: Linearity) e.
RedGreenBlue cs i =>
Color (cs l) e -> Color RGB e
unColorRGB
{-# INLINE fromBaseSpace #-}
luminance :: Color (CMYK (BT709 l)) e -> Color (Y D65) a
luminance = Color (BT709 l) e -> Color (Y D65) a
forall k cs (i :: k) e a.
(ColorSpace cs i e, Elevator a, RealFloat a) =>
Color cs e -> Color (Y i) a
luminance (Color (BT709 l) e -> Color (Y D65) a)
-> (Color (CMYK (BT709 l)) e -> Color (BT709 l) e)
-> Color (CMYK (BT709 l)) e
-> Color (Y D65) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Color (CMYK (BT709 l)) e -> Color (BT709 l) e
forall k cs (i :: k) e.
(ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) =>
Color cs e -> Color (BaseSpace cs) e
toBaseSpace
{-# INLINE luminance #-}