- class ColorSpace cs where
- affineColorSpaceOf :: cs -> AffineColorSpace
- class ImportColorCoordinates c where
- importColorCoordinates :: (AffineColorSpace -> Point3D) -> c
- class ExportColorCoordinates c where
- exportColorCoordinates :: c -> AffineColorSpace -> Point3D
- data AffineColorSpace
- data ColorWheel
- data ColorChannel
- data ChannelIndex
- data LinearMetric = LinearMetric {
- linear_gamut_bounds :: Maybe (RSdouble, RSdouble)
- linear_color_function :: RSdouble -> Color
- linear_value :: RSdouble
- linear_original :: Color
- newChannel :: ColorSpace cs => ChannelIndex -> cs -> ColorChannel
- newAngularChannel :: ColorWheel -> Angle -> ColorChannel
- newRadialChannel :: ColorWheel -> ColorChannel
- newMaximalChannel :: AffineColorSpace -> ColorChannel
- viewChannel :: ExportColorCoordinates c => ColorChannel -> c -> LinearMetric
- channel_u :: ChannelIndex
- channel_v :: ChannelIndex
- channel_w :: ChannelIndex
- newColorSpace :: ExportColorCoordinates c => c -> c -> c -> c -> AffineColorSpace
- newColorWheel :: ExportColorCoordinates c => c -> (c, Angle, RSdouble) -> (c, Angle, RSdouble) -> (c, Angle, RSdouble) -> ColorWheel
- color_space_rgb :: AffineColorSpace
- color_wheel_rgbl :: ColorWheel
- transformColorFromTo :: AffineColorSpace -> Point3D -> AffineColorSpace -> Point3D
- transformColor :: (ExportColorCoordinates source, ImportColorCoordinates dest) => source -> dest
Documentation
class ColorSpace cs whereSource
A color space specification or color type that has an associated color space.
If a type implements both ImportColorCoordinates
and
ColorSpace
, then it must ensure that:
importColorCoordinates f = (let c = importColorCoordinates (const $ f $ affineColorSpaceOf c) in c)
This is not hard -- all that is required is that
affineColorSpaceOf undefined
is defined.
affineColorSpaceOf :: cs -> AffineColorSpaceSource
class ImportColorCoordinates c whereSource
A color type that can import its color coordinates.
importColorCoordinates :: (AffineColorSpace -> Point3D) -> cSource
class ExportColorCoordinates c whereSource
A color type that can export its color coordinates. An easy implementation is
transformColorFromTo your_color_space your_color_coordinates
If a type implements both ExportColorCoordinates
and
ImportColorCoordinates
, then it must ensure that
importColorCoordinates . exportColorCoordinates = id
.
exportColorCoordinates :: c -> AffineColorSpace -> Point3DSource
data AffineColorSpace Source
An affine transformation from the default RGB color space to the specified color space.
data ColorChannel Source
A specific component of a 3-channel color space.
data ChannelIndex Source
data LinearMetric Source
A view of a specific color channel, such as red, or luminance.
LinearMetric | |
|
newChannel :: ColorSpace cs => ChannelIndex -> cs -> ColorChannelSource
Pick a channel from a color space.
newAngularChannel :: ColorWheel -> Angle -> ColorChannelSource
Construct an isotropic ColorChannel
that runs along a
hue angle. The meaning of the hue angle depends on the
primary colors used in the construction of the color wheel.
newRadialChannel :: ColorWheel -> ColorChannelSource
Construct an isotropic ColorChannel
along the radii
of a color wheel. This is exactly like calling
newAngularChannel
knowing in advance the specific
hue of the color in question.
newMaximalChannel :: AffineColorSpace -> ColorChannelSource
Construct a ColorChannel
representing the maximum
of the three color components. For example, the
maximum of RGB 0.25 0.5 0.4
is 0.5.
viewChannel :: ExportColorCoordinates c => ColorChannel -> c -> LinearMetricSource
Read a specific channel of a color.
channel_u :: ChannelIndexSource
The first channel of a color space represented by the ordered tripple,
(u,v,w)
.
channel_v :: ChannelIndexSource
The second channel of a color space represented by the ordered tripple,
(u,v,w)
.
channel_w :: ChannelIndexSource
The third channel of a color space represented by the ordered tripple,
(u,v,w)
.
newColorSpace :: ExportColorCoordinates c => c -> c -> c -> c -> AffineColorSpaceSource
newColorWheel :: ExportColorCoordinates c => c -> (c, Angle, RSdouble) -> (c, Angle, RSdouble) -> (c, Angle, RSdouble) -> ColorWheelSource
Construct a new color wheel. This requires a minimal point,
(the black point in an additive color space, or the white point
in a subtractive color space), and three primary colors with
assigned hue angles and value parameters.
The hue angle maps onto channel_u
and channel_v
, while
the value parameter maps directly and additively onto
channel_w
.
color_space_rgb :: AffineColorSpaceSource
The red-green-blue device color space.
color_wheel_rgbl :: ColorWheelSource
A color wheel constructed with red, green and blue device primaries and a luminance component. This is the basis of the HCL color system.
transformColorFromTo :: AffineColorSpace -> Point3D -> AffineColorSpace -> Point3DSource
Transform ordered triples between color spaces.
transformColor :: (ExportColorCoordinates source, ImportColorCoordinates dest) => source -> destSource
Transform colors between color spaces.