AC-Colour-1.1.3: Efficient RGB colour types.

Data.Colour.Double

Description

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.

Synopsis

Documentation

data Colour Source

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.

Constructors

Colour 

Fields

red :: !Double
 
green :: !Double
 
blue :: !Double
 

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.

grey :: Double -> ColourSource

Turn a Double into a shade of grey.

cscale :: Double -> Colour -> ColourSource

Scale a Colour by a specified amount. (That is, change the brightness while not affecting the shade.)

clip :: Colour -> ColourSource

Take a Colour and clip all channels to the range 0--1 inclusive. Any value outside that range will be replaced with the nearest endpoint (i.e., 0 for negative numbers, 1 for positive numbers higher than 1). Values inside the range are unaffected.

cBlack :: ColourSource

Constant: Black.

cRed :: ColourSource

Constant: Red.

cYellow :: ColourSource

Constant: Yellow.

cGreen :: ColourSource

Constant: Green.

cCyan :: ColourSource

Constant: Cyan.

cBlue :: ColourSource

Constant: Blue.

cMagenta :: ColourSource

Constant: Magenta.

cWhite :: ColourSource

Constant: White.