rsagl- The RogueStar Animation and Graphics Library




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.

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.

data AffineColorSpace Source

An affine transformation from the default RGB color space to the specified color space.

data ColorWheel Source

A rotatable color space.

data ColorChannel Source

A specific component of a 3-channel color space.

data ChannelIndex Source

channel_u, channel_v, channel_w, of a 3-channel color space.

data LinearMetric Source

A view of a specific color channel, such as red, or luminance.




linear_gamut_bounds :: Maybe (RSdouble, RSdouble)

The range of a color channel that is within gamut. This range depends on the channel and the particular color being observed, and may not exist if the color itself is out of gamut.

linear_color_function :: RSdouble -> Color

A function to modify a color channel independantly from the other color channels in the same color space.

linear_value :: RSdouble

The value of the particular color channel for the particular color.

linear_original :: Color

The original color.


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

Construct a new color space. 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. The three primarys color correspond to the channel_u, channel_v, and channel_w respectively.

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.