|
|
|
Description |
This module exports all the main interesting parts of the various
colour modules. It also provides functions for converting between
Colour and Colour8.
It is the general intention that "most" work will be done with
Colour, with values converted to Colour8 only as a final step.
However, full arithmetic on Colour8 is supported anyway,
in case anybody wants to work that way. It is slightly less
efficient and flexible, however.
|
|
Synopsis |
|
|
|
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.
| Constructors | | Instances | |
|
|
|
Turn a Double into a shade of grey.
|
|
|
Scale a Colour by a specified amount. (That is, change the
brightness while not affecting the shade.)
|
|
|
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.
|
|
|
Constant: Black.
|
|
|
Constant: White.
|
|
|
Constant: Red.
|
|
|
Constant: Yellow.
|
|
|
Constant: Green.
|
|
|
Constant: Cyan.
|
|
|
Constant: Blue.
|
|
|
Constant: Magenta.
|
|
|
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 | | Instances | |
|
|
|
Convert a Word8 into a shade of grey.
|
|
|
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.
|
|
|
Constant: Black.
|
|
|
Constant: White.
|
|
|
Constant: Red.
|
|
|
Constant: Yellow.
|
|
|
Constant: Green.
|
|
|
Constant: Cyan.
|
|
|
Constant: Blue.
|
|
|
Constant: Magenta.
|
|
|
Convert a Colour8 into a Colour. Recall that
0x00 means zero and 0xFF means one; this function will
remap such values appropriately.
|
|
|
Convert a Colour into a Colour8. Any values outside
the range 0--1 will be wrapped to that range. You may
want to run clip before calling this function to
prevent this behaviour (unless you know the values can't
be outside the permitted range). This function is the
exact inverse of cpromote; 0 is mapped to 0x00 and
1 is mapped to 0xFF.
|
|
Produced by Haddock version 2.4.2 |