Safe Haskell | Safe |
---|---|
Language | Haskell98 |
An RGBSpace
is characterized by Chromaticity
for red, green, and
blue, the Chromaticity
of the white point, and it's
TransferFunction
.
- 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
RGB Tuple
An RGB triple for an unspecified colour space.
RGB | |
|
uncurryRGB :: (a -> a -> a -> b) -> RGB a -> b #
Uncurries a function expecting three r, g, b parameters.
RGB Gamut
:: RGB (Chromaticity Rational) | The three primaries |
-> Chromaticity Rational | The white point |
-> RGBGamut |
An RGB gamut is specified by three primary colours (red, green, and
blue) and a white point (often d65
).
whitePoint :: RGBGamut -> Chromaticity Rational #
inGamut :: (Ord a, Fractional a) => RGBGamut -> Colour a -> Bool #
Returns True
if the given colour lies inside the given gamut.
RGB Space
data TransferFunction a #
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.
TransferFunction | |
|
Num a => Monoid (TransferFunction a) # | |
linearTransferFunction :: Num a => TransferFunction a #
This is the identity TransferFunction
.
powerTransferFunction :: Floating a => a -> TransferFunction a #
This is the (**gamma)
TransferFunction
.
inverseTransferFunction :: Fractional a => TransferFunction a -> TransferFunction a #
This reverses a TransferFunction
.
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 a #
An RGBSpace is specified by an RGBGamut
and a TransferFunction
.
transferFunction :: RGBSpace a -> TransferFunction a #
rgbUsingSpace :: Fractional a => RGBSpace a -> a -> a -> a -> Colour a #
toRGBUsingSpace :: Fractional a => RGBSpace a -> Colour a -> RGB a #