This module provides Colour
, which stores RGB (red, green, blue)
colour values where each channel is a Double
. It also provides
arithmetic over such colours, and a few predefined colours.
- data Colour = Colour {}
- cmap :: (Double -> Double) -> Colour -> Colour
- czip :: (Double -> Double -> Double) -> Colour -> Colour -> Colour
- cfold :: (Double -> Double -> Double) -> Colour -> Double
- grey :: Double -> Colour
- cscale :: Double -> Colour -> Colour
- clip :: Colour -> Colour
- cBlack :: Colour
- cRed :: Colour
- cYellow :: Colour
- cGreen :: Colour
- cCyan :: Colour
- cBlue :: Colour
- cMagenta :: Colour
- cWhite :: Colour
Documentation
The Colour
type. Stores a red, a green and a blue component as
strict, unboxed Double
values. (So it should be quite efficient
in time and space.) Also provides various class instances for
arithmetic, etc. It is generally assumed that each channel will
have a value somewhere between 0 and 1 at all times.
Note that (*)
acts channel-wise. This is usually what is wanted.
cmap :: (Double -> Double) -> Colour -> ColourSource
Apply a function to every channel in a colour. (Mostly used internally, but exposed here in case it may be useful.)
czip :: (Double -> Double -> Double) -> Colour -> Colour -> ColourSource
This is similar to Data.List.zipWith
. (Mostly used internally,
but exposed here in case it may be useful.)
cfold :: (Double -> Double -> Double) -> Colour -> DoubleSource
Use a function to collapse a Colour
into a Double
. No
particular order of application is promised.
cscale :: Double -> Colour -> ColourSource
Scale a Colour
by a specified amount. (That is, change the
brightness while not affecting the shade.)