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

Graphics.Color.Adaptation.VonKries

Description

 
Synopsis

Color conversion

convert :: (ColorSpace cs' i' e', ColorSpace cs i e) => Color cs' e' -> Color cs e Source #

This function allows conversion of a color between any two color spaces. It uses a very common VonKries chromatic adaptation transform with Bradford matrix. One of more general functions convertWith or convertElevatedWith can be used for selecting another chromatic adaptation algorithm.

Since: 0.1.0

Von Kries adaptation

data VonKries Source #

Constructors

VonKries

VonKries chromatic adaptation transform

>>> cat :: CAT 'VonKries Float
CAT VonKries 'VonKries Float
[ [ 0.40024000, 0.70760000,-0.08081000 ]
, [-0.22630000, 1.16532000, 0.04570000 ]
, [ 0.00000000, 0.00000000, 0.91822000 ] ]
>>> icat :: ICAT 'VonKries Float
ICAT VonKries 'VonKries Float
[ [ 1.85993650,-1.12938170, 0.21989742 ]
, [ 0.36119142, 0.63881250,-0.00000637 ]
, [-0.00000000,-0.00000000, 1.08906360 ] ]

Since: 0.1.0

Bradford

Bradford chromatic adaptation transform

>>> cat :: CAT 'Bradford Float
CAT VonKries 'Bradford Float
[ [ 0.89510000, 0.26640000,-0.16140000 ]
, [-0.75020000, 1.71350000, 0.03670000 ]
, [ 0.03890000,-0.06850000, 1.02960000 ] ]
>>> icat :: ICAT 'Bradford Float
ICAT VonKries 'Bradford Float
[ [ 0.98699290,-0.14705427, 0.15996265 ]
, [ 0.43230528, 0.51836026, 0.04929122 ]
, [-0.00852867, 0.04004282, 0.96848667 ] ]

Since: 0.1.0

Fairchild

Fairchild chromatic adaptation transform

>>> cat :: CAT 'Fairchild Float
CAT VonKries 'Fairchild Float
[ [ 0.85620000, 0.33720000,-0.19340000 ]
, [-0.83600000, 1.83270000, 0.00330000 ]
, [ 0.03570000,-0.04690000, 1.01120000 ] ]
>>> icat :: ICAT 'Fairchild Float
ICAT VonKries 'Fairchild Float
[ [ 0.98739994,-0.17682500, 0.18942511 ]
, [ 0.45043513, 0.46493286, 0.08463200 ]
, [-0.01396833, 0.02780657, 0.98616177 ] ]

Since: 0.1.0

CIECAT02

CIECAT02 chromatic adaptation transform

>>> cat :: CAT 'CIECAT02 Float
CAT VonKries 'CIECAT02 Float
[ [ 0.73280000, 0.42960000,-0.16240000 ]
, [-0.70360000, 1.69750000, 0.00610000 ]
, [ 0.00300000, 0.01360000, 0.98340000 ] ]
>>> icat :: ICAT 'CIECAT02 Float
ICAT VonKries 'CIECAT02 Float
[ [ 1.09612380,-0.27886900, 0.18274519 ]
, [ 0.45436904, 0.47353318, 0.07209781 ]
, [-0.00962761,-0.00569803, 1.01532570 ] ]

Since: 0.1.3

CMCCAT2000

CMCCAT2000 chromatic adaptation transform

>>> cat :: CAT 'CMCCAT2000 Float
CAT VonKries 'CMCCAT2000 Float
[ [ 0.79820000, 0.33890000,-0.13710000 ]
, [-0.59180000, 1.55120000, 0.04060000 ]
, [ 0.00080000, 0.02390000, 0.97530000 ] ]
>>> icat :: ICAT 'CMCCAT2000 Float
ICAT VonKries 'CMCCAT2000 Float
[ [ 1.07645010,-0.23766239, 0.16121234 ]
, [ 0.41096430, 0.55434180, 0.03469386 ]
, [-0.01095376,-0.01338936, 1.02434310 ] ]

Since: 0.1.3

Instances

Instances details
(Illuminant it, Illuminant ir, Elevator e, RealFloat e) => ChromaticAdaptation (t :: VonKries) (it :: kt) (ir :: kr) e Source # 
Instance details

Defined in Graphics.Color.Adaptation.VonKries

Associated Types

data Adaptation t it ir e Source #

Methods

adaptColorXYZ :: Adaptation t it ir e -> Color (XYZ it) e -> Color (XYZ ir) e Source #

Eq e => Eq (Adaptation t it ir e) Source # 
Instance details

Defined in Graphics.Color.Adaptation.VonKries

Methods

(==) :: Adaptation t it ir e -> Adaptation t it ir e -> Bool #

(/=) :: Adaptation t it ir e -> Adaptation t it ir e -> Bool #

(Illuminant it, Illuminant ir, Elevator e) => Show (Adaptation t it ir e) Source # 
Instance details

Defined in Graphics.Color.Adaptation.VonKries

Methods

showsPrec :: Int -> Adaptation t it ir e -> ShowS #

show :: Adaptation t it ir e -> String #

showList :: [Adaptation t it ir e] -> ShowS #

newtype Adaptation (t :: VonKries) (it :: kt) (ir :: kr) e Source # 
Instance details

Defined in Graphics.Color.Adaptation.VonKries

newtype Adaptation (t :: VonKries) (it :: kt) (ir :: kr) e = AdaptationMatrix (M3x3 e)

newtype CAT (t :: k) e Source #

Chromatic adaptation transformation matrix

Constructors

CAT (M3x3 e) 

Instances

Instances details
Eq e => Eq (CAT t e) Source # 
Instance details

Defined in Graphics.Color.Adaptation.VonKries

Methods

(==) :: CAT t e -> CAT t e -> Bool #

(/=) :: CAT t e -> CAT t e -> Bool #

(Typeable t, Typeable k, Elevator e) => Show (CAT t e) Source # 
Instance details

Defined in Graphics.Color.Adaptation.VonKries

Methods

showsPrec :: Int -> CAT t e -> ShowS #

show :: CAT t e -> String #

showList :: [CAT t e] -> ShowS #

newtype ICAT (t :: k) e Source #

Inverse of chromatic adaptation transformation matrix

Constructors

ICAT (M3x3 e) 

Instances

Instances details
Eq e => Eq (ICAT t e) Source # 
Instance details

Defined in Graphics.Color.Adaptation.VonKries

Methods

(==) :: ICAT t e -> ICAT t e -> Bool #

(/=) :: ICAT t e -> ICAT t e -> Bool #

(Typeable t, Typeable k, Elevator e) => Show (ICAT t e) Source # 
Instance details

Defined in Graphics.Color.Adaptation.VonKries

Methods

showsPrec :: Int -> ICAT t e -> ShowS #

show :: ICAT t e -> String #

showList :: [ICAT t e] -> ShowS #

vonKriesAdaptation :: ChromaticAdaptation 'VonKries it ir e => Adaptation 'VonKries it ir e Source #

VonKries chromatic adaptation transform.

Since: 0.1.2

bradfordAdaptation :: ChromaticAdaptation 'Bradford it ir e => Adaptation 'Bradford it ir e Source #

Bradford chromatic adaptation transform, as defined in the CIECAM97s color appearance model.

Since: 0.1.2

fairchildAdaptation :: ChromaticAdaptation 'Fairchild it ir e => Adaptation 'Fairchild it ir e Source #

Fairchild chromatic adaptation transform.

Since: 0.1.2

ciecat02Adaptation :: ChromaticAdaptation 'CIECAT02 it ir e => Adaptation 'CIECAT02 it ir e Source #

CIECAT02 chromatic adaptation as defined it CIECAM02 color appearance model

Since: 0.1.3

cmccat2000Adaptation :: ChromaticAdaptation 'CMCCAT2000 it ir e => Adaptation 'CIECAT02 it ir e Source #

CMCCAT2000 chromatic adaptation. Predecessor of CIECAT02. as defined it CIECAM02 color appearance model

Since: 0.1.3

adaptationMatrix :: forall t it ir e. (ChromaticAdaptationTransform t, ChromaticAdaptation t it ir e) => Adaptation (t :: VonKries) it ir e Source #