Color-0.3.3: Color spaces and conversions between them
Copyright(c) Alexey Kuleshevich 2019-2020
LicenseBSD3
MaintainerAlexey Kuleshevich <lehins@yandex.ru>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Graphics.Color.Space.RGB.SRGB

Description

 
Synopsis

Constructors for a sRGB color space.

pattern SRGB :: Color RGB e -> Color (SRGB l) e Source #

pattern ColorSRGB :: e -> e -> e -> Color (SRGB l) e Source #

Constructor for a color in sRGB color space

Since: 0.1.0

pattern ColorSRGBA :: e -> e -> e -> e -> Color (Alpha (SRGB l)) e Source #

Constructor for a color in sRGB color space with alphs channel

Since: 0.1.0

data SRGB (l :: Linearity) Source #

The most common sRGB color space, which is defined with:

  • D65 illuminant
  • Transfer function:

\[ \gamma(u) = \begin{cases} 12.92 u & u \leq 0.0031308 \\ 1.055 u^{1/2.4} - 0.055 & \text{otherwise} \end{cases} \]

  • Inverse transfer function

\[ \gamma^{-1}(u) = \begin{cases} u / 12.92 & u \leq 0.04045 \\ \left(\tfrac{u + 0.055}{1.055}\right)^{2.4} & \text{otherwise} \end{cases} \]

  • Normalized primary matrix:
>>> :set -XDataKinds
>>> import Graphics.Color.Space.RGB
>>> npm :: NPM SRGB Float
[ [ 0.41240000, 0.35760000, 0.18050000 ]
, [ 0.21260000, 0.71520000, 0.07220000 ]
, [ 0.01930000, 0.11920000, 0.95050000 ] ]
  • Inverse normalized primary matrix:
>>> :set -XDataKinds
>>> import Graphics.Color.Space.RGB
>>> inpm :: INPM SRGB Float
[ [ 3.24060000,-1.53720000,-0.49860000 ]
, [-0.96890000, 1.87580000, 0.04150000 ]
, [ 0.05570000,-0.20400000, 1.05700000 ] ]

Instances

Instances details
Luma SRGB Source # 
Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Functor (Color (SRGB l)) Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

fmap :: (a -> b) -> Color (SRGB l) a -> Color (SRGB l) b #

(<$) :: a -> Color (SRGB l) b -> Color (SRGB l) a #

Applicative (Color (SRGB l)) Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

pure :: a -> Color (SRGB l) a #

(<*>) :: Color (SRGB l) (a -> b) -> Color (SRGB l) a -> Color (SRGB l) b #

liftA2 :: (a -> b -> c) -> Color (SRGB l) a -> Color (SRGB l) b -> Color (SRGB l) c #

(*>) :: Color (SRGB l) a -> Color (SRGB l) b -> Color (SRGB l) b #

(<*) :: Color (SRGB l) a -> Color (SRGB l) b -> Color (SRGB l) a #

Foldable (Color (SRGB l)) Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

fold :: Monoid m => Color (SRGB l) m -> m #

foldMap :: Monoid m => (a -> m) -> Color (SRGB l) a -> m #

foldMap' :: Monoid m => (a -> m) -> Color (SRGB l) a -> m #

foldr :: (a -> b -> b) -> b -> Color (SRGB l) a -> b #

foldr' :: (a -> b -> b) -> b -> Color (SRGB l) a -> b #

foldl :: (b -> a -> b) -> b -> Color (SRGB l) a -> b #

foldl' :: (b -> a -> b) -> b -> Color (SRGB l) a -> b #

foldr1 :: (a -> a -> a) -> Color (SRGB l) a -> a #

foldl1 :: (a -> a -> a) -> Color (SRGB l) a -> a #

toList :: Color (SRGB l) a -> [a] #

null :: Color (SRGB l) a -> Bool #

length :: Color (SRGB l) a -> Int #

elem :: Eq a => a -> Color (SRGB l) a -> Bool #

maximum :: Ord a => Color (SRGB l) a -> a #

minimum :: Ord a => Color (SRGB l) a -> a #

sum :: Num a => Color (SRGB l) a -> a #

product :: Num a => Color (SRGB l) a -> a #

Traversable (Color (SRGB l)) Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

traverse :: Applicative f => (a -> f b) -> Color (SRGB l) a -> f (Color (SRGB l) b) #

sequenceA :: Applicative f => Color (SRGB l) (f a) -> f (Color (SRGB l) a) #

mapM :: Monad m => (a -> m b) -> Color (SRGB l) a -> m (Color (SRGB l) b) #

sequence :: Monad m => Color (SRGB l) (m a) -> m (Color (SRGB l) a) #

(Typeable l, Elevator e) => ColorModel (SRGB l) e Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Associated Types

type Components (SRGB l) e Source #

RedGreenBlue SRGB D65 Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

gamut :: RealFloat e => Gamut SRGB D65 e Source #

transfer :: RealFloat e => e -> e Source #

itransfer :: RealFloat e => e -> e Source #

npm :: (ColorSpace (SRGB 'Linear) D65 e, RealFloat e) => NPM SRGB e Source #

inpm :: (ColorSpace (SRGB 'Linear) D65 e, RealFloat e) => INPM SRGB e Source #

mkColorRGB :: forall e (l :: Linearity). Color RGB e -> Color (SRGB l) e Source #

unColorRGB :: forall (l :: Linearity) e. Color (SRGB l) e -> Color RGB e Source #

Elevator e => ColorSpace (SRGB 'Linear) D65 e Source #

SRGB linear color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Associated Types

type BaseModel (SRGB 'Linear) Source #

type BaseSpace (SRGB 'Linear) Source #

Elevator e => ColorSpace (SRGB 'NonLinear) D65 e Source #

SRGB linear color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Associated Types

type BaseModel (SRGB 'NonLinear) Source #

type BaseSpace (SRGB 'NonLinear) Source #

Elevator e => ColorSpace (Y'CbCr SRGB) D65 e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.YCbCr

Associated Types

type BaseModel (Y'CbCr SRGB) Source #

type BaseSpace (Y'CbCr SRGB) Source #

ColorSpace (SRGB l) D65 e => ColorSpace (CMYK (SRGB l)) D65 e Source #

CMYK representation for SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

Associated Types

type BaseModel (CMYK (SRGB l)) Source #

type BaseSpace (CMYK (SRGB l)) Source #

Eq e => Eq (Color (SRGB l) e) Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

(==) :: Color (SRGB l) e -> Color (SRGB l) e -> Bool #

(/=) :: Color (SRGB l) e -> Color (SRGB l) e -> Bool #

Ord e => Ord (Color (SRGB l) e) Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

compare :: Color (SRGB l) e -> Color (SRGB l) e -> Ordering #

(<) :: Color (SRGB l) e -> Color (SRGB l) e -> Bool #

(<=) :: Color (SRGB l) e -> Color (SRGB l) e -> Bool #

(>) :: Color (SRGB l) e -> Color (SRGB l) e -> Bool #

(>=) :: Color (SRGB l) e -> Color (SRGB l) e -> Bool #

max :: Color (SRGB l) e -> Color (SRGB l) e -> Color (SRGB l) e #

min :: Color (SRGB l) e -> Color (SRGB l) e -> Color (SRGB l) e #

(Typeable l, Elevator e) => Show (Color (SRGB l) e) Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

showsPrec :: Int -> Color (SRGB l) e -> ShowS #

show :: Color (SRGB l) e -> String #

showList :: [Color (SRGB l) e] -> ShowS #

Storable e => Storable (Color (SRGB l) e) Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

sizeOf :: Color (SRGB l) e -> Int #

alignment :: Color (SRGB l) e -> Int #

peekElemOff :: Ptr (Color (SRGB l) e) -> Int -> IO (Color (SRGB l) e) #

pokeElemOff :: Ptr (Color (SRGB l) e) -> Int -> Color (SRGB l) e -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Color (SRGB l) e) #

pokeByteOff :: Ptr b -> Int -> Color (SRGB l) e -> IO () #

peek :: Ptr (Color (SRGB l) e) -> IO (Color (SRGB l) e) #

poke :: Ptr (Color (SRGB l) e) -> Color (SRGB l) e -> IO () #

newtype Color (SRGB l) e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.SRGB

newtype Color (SRGB l) e = SRGB (Color RGB e)
type BaseModel (SRGB 'Linear) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.SRGB

type BaseModel (SRGB 'NonLinear) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.SRGB

type BaseModel (Y'CbCr SRGB) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.YCbCr

type BaseSpace (SRGB 'Linear) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.SRGB

type BaseSpace (SRGB 'NonLinear) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.SRGB

type BaseSpace (Y'CbCr SRGB) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.YCbCr

type Components (SRGB l) e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.SRGB

type Components (SRGB l) e = (e, e, e)
type BaseModel (CMYK (SRGB l)) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

type BaseModel (CMYK (SRGB l)) = CMYK
type BaseSpace (CMYK (SRGB l)) Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

type BaseSpace (CMYK (SRGB l)) = SRGB l

data D50 Source #

This is an approximation of CIE1931 D50 white point defined in ICC PCS. Useful for chromatic adaptation.

>>> whitePoint :: WhitePoint D50 Double
WhitePoint (Chromaticity {chromaticityCIExyY = <CIExyY * D50:( 0.3457029149190000, 0.3585385966800000)>})
>>> whitePointTristimulus :: Color (XYZ D50) Float
<XYZ * D50:( 0.96420000, 1.00000000, 0.82490010)>
>>> colorTemperature :: CCT D50
CCT {unCCT = 5003.0}

Since: 0.1.0

Instances

Instances details
Illuminant D50 Source #

Tristimulus [X=0.9642, Y=1.0000, Z=0.8249] - IEC 61966-2-1:1999, ICC PCS

Instance details

Defined in Graphics.Color.Illuminant.ICC.PCS

Associated Types

type Temperature D50 :: n Source #

type Temperature D50 Source # 
Instance details

Defined in Graphics.Color.Illuminant.ICC.PCS

type Temperature D50 = 5003

data D65 Source #

Whitepoint D65 that is so commonly used for sRGB and other color spaces defined by ITU: Rec.601 (525 and 625) and Rec.709 standards. It is slightly different than D65 that is defined by CIE1931 and D65 specified in Rec.470.

>>> whitePoint :: WhitePoint D65 Float
WhitePoint (Chromaticity {chromaticityCIExyY = <CIExyY * D65:( 0.31270000, 0.32900000)>})
>>> whitePointTristimulus :: Color (XYZ D65) Float
<XYZ * D65:( 0.95045596, 1.00000000, 1.08905770)>
>>> colorTemperature :: CCT D65
CCT {unCCT = 6504.0}

Since: 0.1.0

Instances

Instances details
Illuminant D65 Source #

[x=0.3127, y=0.3290] - Rec. ITU-R BT.601-7, Rec. ITU-R BT.709-6, IEC 61966-2-1:1999

Instance details

Defined in Graphics.Color.Illuminant.ITU.Rec601

Associated Types

type Temperature D65 :: n Source #

RedGreenBlue BT601_625 D65 Source #

ITU-R BT.601 (625) color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec601

RedGreenBlue BT601_525 D65 Source #

ITU-R BT.601 (525) color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec601

RedGreenBlue BT709 D65 Source #

ITU-R BT.709 color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec709

Methods

gamut :: RealFloat e => Gamut BT709 D65 e Source #

transfer :: RealFloat e => e -> e Source #

itransfer :: RealFloat e => e -> e Source #

npm :: (ColorSpace (BT709 'Linear) D65 e, RealFloat e) => NPM BT709 e Source #

inpm :: (ColorSpace (BT709 'Linear) D65 e, RealFloat e) => INPM BT709 e Source #

mkColorRGB :: forall e (l :: Linearity). Color RGB e -> Color (BT709 l) e Source #

unColorRGB :: forall (l :: Linearity) e. Color (BT709 l) e -> Color RGB e Source #

RedGreenBlue AdobeRGB D65 Source #

AdobeRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.AdobeRGB

RedGreenBlue SRGB D65 Source #

SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Methods

gamut :: RealFloat e => Gamut SRGB D65 e Source #

transfer :: RealFloat e => e -> e Source #

itransfer :: RealFloat e => e -> e Source #

npm :: (ColorSpace (SRGB 'Linear) D65 e, RealFloat e) => NPM SRGB e Source #

inpm :: (ColorSpace (SRGB 'Linear) D65 e, RealFloat e) => INPM SRGB e Source #

mkColorRGB :: forall e (l :: Linearity). Color RGB e -> Color (SRGB l) e Source #

unColorRGB :: forall (l :: Linearity) e. Color (SRGB l) e -> Color RGB e Source #

Elevator e => ColorSpace (BT601_625 'Linear) D65 e Source #

ITU-R BT.601 (625) linear color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec601

Elevator e => ColorSpace (BT601_625 'NonLinear) D65 e Source #

ITU-R BT.601 (625) color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec601

Elevator e => ColorSpace (BT601_525 'Linear) D65 e Source #

ITU-R BT.601 (525) linear color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec601

Elevator e => ColorSpace (BT601_525 'NonLinear) D65 e Source #

ITU-R BT.601 (525) linear color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec601

Elevator e => ColorSpace (BT709 'Linear) D65 e Source #

ITU-R BT.709 linear color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec709

Associated Types

type BaseModel (BT709 'Linear) Source #

type BaseSpace (BT709 'Linear) Source #

Elevator e => ColorSpace (BT709 'NonLinear) D65 e Source #

ITU-R BT.709 color space

Instance details

Defined in Graphics.Color.Space.RGB.ITU.Rec709

Associated Types

type BaseModel (BT709 'NonLinear) Source #

type BaseSpace (BT709 'NonLinear) Source #

Elevator e => ColorSpace (AdobeRGB 'Linear) D65 e Source #

AdobeRGB linear color space

Instance details

Defined in Graphics.Color.Space.RGB.AdobeRGB

Associated Types

type BaseModel (AdobeRGB 'Linear) Source #

type BaseSpace (AdobeRGB 'Linear) Source #

Elevator e => ColorSpace (AdobeRGB 'NonLinear) D65 e Source #

AdobeRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.AdobeRGB

Elevator e => ColorSpace (SRGB 'Linear) D65 e Source #

SRGB linear color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Associated Types

type BaseModel (SRGB 'Linear) Source #

type BaseSpace (SRGB 'Linear) Source #

Elevator e => ColorSpace (SRGB 'NonLinear) D65 e Source #

SRGB linear color space

Instance details

Defined in Graphics.Color.Space.RGB.SRGB

Associated Types

type BaseModel (SRGB 'NonLinear) Source #

type BaseSpace (SRGB 'NonLinear) Source #

Elevator e => ColorSpace (Y'CbCr BT601_625) D65 e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.YCbCr

Elevator e => ColorSpace (Y'CbCr BT601_525) D65 e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.YCbCr

Elevator e => ColorSpace (Y'CbCr BT709) D65 e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.YCbCr

Associated Types

type BaseModel (Y'CbCr BT709) Source #

type BaseSpace (Y'CbCr BT709) Source #

Elevator e => ColorSpace (Y'CbCr SRGB) D65 e Source # 
Instance details

Defined in Graphics.Color.Space.RGB.Alternative.YCbCr

Associated Types

type BaseModel (Y'CbCr SRGB) Source #

type BaseSpace (Y'CbCr SRGB) Source #

ColorSpace (BT470_625 l) D65 e => ColorSpace (CMYK (BT470_625 l)) D65 e Source #

CMYK representation for BT470_625 color space

Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

Associated Types

type BaseModel (CMYK (BT470_625 l)) Source #

type BaseSpace (CMYK (BT470_625 l)) Source #

ColorSpace (BT470_525 l) D65 e => ColorSpace (CMYK (BT470_525 l)) D65 e Source #

CMYK representation for BT470_525 color space

Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

Associated Types

type BaseModel (CMYK (BT470_525 l)) Source #

type BaseSpace (CMYK (BT470_525 l)) Source #

ColorSpace (BT601_625 l) D65 e => ColorSpace (CMYK (BT601_625 l)) D65 e Source #

CMYK representation for BT601_625 color space

Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

Associated Types

type BaseModel (CMYK (BT601_625 l)) Source #

type BaseSpace (CMYK (BT601_625 l)) Source #

ColorSpace (BT601_525 l) D65 e => ColorSpace (CMYK (BT601_525 l)) D65 e Source #

CMYK representation for BT601_525 color space

Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

Associated Types

type BaseModel (CMYK (BT601_525 l)) Source #

type BaseSpace (CMYK (BT601_525 l)) Source #

ColorSpace (BT709 l) D65 e => ColorSpace (CMYK (BT709 l)) D65 e Source #

CMYK representation for BT709 color space

Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

Associated Types

type BaseModel (CMYK (BT709 l)) Source #

type BaseSpace (CMYK (BT709 l)) Source #

ColorSpace (AdobeRGB l) D65 e => ColorSpace (CMYK (AdobeRGB l)) D65 e Source #

CMYK representation for AdobeRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

Associated Types

type BaseModel (CMYK (AdobeRGB l)) Source #

type BaseSpace (CMYK (AdobeRGB l)) Source #

ColorSpace (SRGB l) D65 e => ColorSpace (CMYK (SRGB l)) D65 e Source #

CMYK representation for SRGB color space

Instance details

Defined in Graphics.Color.Space.RGB.Alternative.CMYK

Associated Types

type BaseModel (CMYK (SRGB l)) Source #

type BaseSpace (CMYK (SRGB l)) Source #

type Temperature D65 Source # 
Instance details

Defined in Graphics.Color.Illuminant.ITU.Rec601

type Temperature D65 = 6504