AC-Colour-1.1.1: Efficient RGB colour types.Source codeContentsIndex
Data.Colour.Word8
Description

This module provides Colour8, which stores RGB (red, green, blue) colour values where each channel is a Word8. It also provides arithmetic over such colours, and a few predefined colours.

It is the general intention that "most" work will be done with Data.Colour.Double, with values converted to Colour8 only as a final step. However, full arithmetic is supported anyway, in case anybody wants to work that way. It is slightly less efficient and flexible, however.

Synopsis
data Colour8 = Colour8 {
red8 :: !Word8
green8 :: !Word8
blue8 :: !Word8
}
c8map :: (Word8 -> Word8) -> Colour8 -> Colour8
c8zip :: (Word8 -> Word8 -> Word8) -> Colour8 -> Colour8 -> Colour8
c8fold :: (Word8 -> Word8 -> Word8) -> Colour8 -> Word8
grey8 :: Word8 -> Colour8
c8scale :: Word8 -> Colour8 -> Colour8
c8Black :: Colour8
c8Red :: Colour8
c8Yellow :: Colour8
c8Green :: Colour8
c8Cyan :: Colour8
c8Blue :: Colour8
c8Magenta :: Colour8
c8White :: Colour8
Documentation
data Colour8 Source

The Colour type. Stores a red, a green and a blue component as strict, unboxed Word8 values. (So it should be quite efficient in time and space.) Also provides various class instances for arithmetic, etc.

Note that 0x00 is assumed to mean zero, and 0xFF to mean one. That means that (*) is slightly slower than you might expect due to the extra steps required for renormalisation; (+) and (-) are still efficient, however.

Constructors
Colour8
red8 :: !Word8
green8 :: !Word8
blue8 :: !Word8
show/hide Instances
c8map :: (Word8 -> Word8) -> Colour8 -> Colour8Source
Apply a function to every channel of a Colour8. (Mostly used internally; exposed here in case it might be useful.)
c8zip :: (Word8 -> Word8 -> Word8) -> Colour8 -> Colour8 -> Colour8Source
The colour equivilent of Data.List.zipWith. (Mostly used internally; exposed here in case it might be useful.)
c8fold :: (Word8 -> Word8 -> Word8) -> Colour8 -> Word8Source
Use a function to fold the three values in a Colour8 into a single value. No particular order of application is promised.
grey8 :: Word8 -> Colour8Source
Convert a Word8 into a shade of grey.
c8scale :: Word8 -> Colour8 -> Colour8Source
Scale a Colour8 by the specified amount. Recall that 0x00 means zero, and 0xFF means one. This means that it is impossible to make a colour brighter, only darker. It also means this operation is modestly inefficient due to the renormalisation steps.
c8Black :: Colour8Source
Constant: Black.
c8Red :: Colour8Source
Constant: Red.
c8Yellow :: Colour8Source
Constant: Yellow.
c8Green :: Colour8Source
Constant: Green.
c8Cyan :: Colour8Source
Constant: Cyan.
c8Blue :: Colour8Source
Constant: Blue.
c8Magenta :: Colour8Source
Constant: Magenta.
c8White :: Colour8Source
Constant: White.
Produced by Haddock version 2.4.2