colour-2.3.1: A model for human colour/color perceptionSource codeContentsIndex
Data.Colour.RGBSpace
Contents
RGB Tuple
RGB Gamut
RGB Space
Description
An RGBSpace is characterized by Chromaticity for red, green, and blue, the Chromaticity of the white point, and it's TransferFunction.
Synopsis
data Colour a
data RGB a = RGB {
channelRed :: !a
channelGreen :: !a
channelBlue :: !a
}
uncurryRGB :: (a -> a -> a -> b) -> RGB a -> b
curryRGB :: (RGB a -> b) -> a -> a -> a -> b
data RGBGamut
mkRGBGamut :: RGB (Chromaticity Rational) -> Chromaticity Rational -> RGBGamut
primaries :: RGBGamut -> RGB (Chromaticity Rational)
whitePoint :: RGBGamut -> Chromaticity Rational
inGamut :: (Ord a, Fractional a) => RGBGamut -> Colour a -> Bool
data TransferFunction a = TransferFunction {
transfer :: a -> a
transferInverse :: a -> a
transferGamma :: a
}
linearTransferFunction :: Num a => TransferFunction a
powerTransferFunction :: Floating a => a -> TransferFunction a
inverseTransferFunction :: Fractional a => TransferFunction a -> TransferFunction a
data RGBSpace a
mkRGBSpace :: RGBGamut -> TransferFunction a -> RGBSpace a
gamut :: RGBSpace a -> RGBGamut
transferFunction :: RGBSpace a -> TransferFunction a
linearRGBSpace :: Num a => RGBGamut -> RGBSpace a
rgbUsingSpace :: Fractional a => RGBSpace a -> a -> a -> a -> Colour a
toRGBUsingSpace :: Fractional a => RGBSpace a -> Colour a -> RGB a
Documentation
data Colour a Source

This type represents the human preception of colour. The a parameter is a numeric type used internally for the representation.

The Monoid instance allows one to add colours, but beware that adding colours can take you out of gamut. Consider using blend whenever possible.

show/hide Instances
RGB Tuple
data RGB a Source
An RGB triple for an unspecified colour space.
Constructors
RGB
channelRed :: !a
channelGreen :: !a
channelBlue :: !a
show/hide Instances
uncurryRGB :: (a -> a -> a -> b) -> RGB a -> bSource
Uncurries a function expecting three r, g, b parameters.
curryRGB :: (RGB a -> b) -> a -> a -> a -> bSource
Curries a function expecting one RGB parameter.
RGB Gamut
data RGBGamut Source
An RGBGamut is a 3-D colour “cube” that contains all the colours that can be displayed by a RGB device. The “cube” is normalized so that white has Data.Colour.CIE.luminance 1.
show/hide Instances
mkRGBGamutSource
:: RGB (Chromaticity Rational)The three primaries
-> Chromaticity RationalThe white point
-> RGBGamut
An RGB gamut is specified by three primary colours (red, green, and blue) and a white point (often Data.Colour.CIE.Illuminant.d65).
primaries :: RGBGamut -> RGB (Chromaticity Rational)Source
whitePoint :: RGBGamut -> Chromaticity RationalSource
inGamut :: (Ord a, Fractional a) => RGBGamut -> Colour a -> BoolSource
Returns True if the given colour lies inside the given gamut.
RGB Space
data TransferFunction a Source

A transfer function is a function that typically translates linear colour space coordinates into non-linear coordinates. The transferInverse function reverses this by translating non-linear colour space coordinates into linear coordinates. It is required that

 transfer . transferInverse === id === transferInverse . inverse

(or that this law holds up to floating point rounding errors).

We also require that transfer is approximately (**transferGamma) (and hence transferInverse is approximately (**(recip transferGamma))). The value transferGamma is for informational purposes only, so there is no bound on how good this approximation needs to be.

Constructors
TransferFunction
transfer :: a -> a
transferInverse :: a -> a
transferGamma :: a
show/hide Instances
linearTransferFunction :: Num a => TransferFunction aSource
This is the identity TransferFunction.
powerTransferFunction :: Floating a => a -> TransferFunction aSource
This is the (**gamma) TransferFunction.
inverseTransferFunction :: Fractional a => TransferFunction a -> TransferFunction aSource
This reverses a TransferFunction.
data RGBSpace a Source
An RGBSpace is a colour coordinate system for colours laying inGamut of gamut. Linear coordinates are passed through a transferFunction to produce non-linear RGB values.
mkRGBSpace :: RGBGamut -> TransferFunction a -> RGBSpace aSource
An RGBSpace is specified by an RGBGamut and a TransferFunction.
gamut :: RGBSpace a -> RGBGamutSource
transferFunction :: RGBSpace a -> TransferFunction aSource
linearRGBSpace :: Num a => RGBGamut -> RGBSpace aSource
Produce a linear colour space from an RGBGamut.
rgbUsingSpace :: Fractional a => RGBSpace a -> a -> a -> a -> Colour aSource
Create a Colour from red, green, and blue coordinates given in a general RGBSpace.
toRGBUsingSpace :: Fractional a => RGBSpace a -> Colour a -> RGB aSource
Return the coordinates of a given Colour for a general RGBSpace.
Produced by Haddock version 2.6.0