<chapter id="colorspaces">
<title>Colorspaces</title>

<para>
This chapter gives information on what colorspaces are, which colorspaces
&chalk; offers, and what you should keep in mind when using them.
</para>

<sect1 id="colorspaces-intro">
<title>Introduction to colorspaces</title>

<sect2 id="colorspaces-intro-whatis">
<title>What is a colorspace?</title>

<para>
In short, a colorspace is a way to represent colors by specifying a number of
parameters. As parameters, one can choose for example the amounts of red,
green and blue light needed for the color. This results in the commonly known
RGB colorspace. One can visualize this as a three-dimensional space, with each
of the red, green, and blue light components being an axis in the colorspace.
A color then corresponds to a certain point in this colorspace, defined by its
coordinates on the three axes.
</para>
<note><para>
To be more precise, a colorspace is a combination of a color model (indicating
which axes are present) and a mapping function (indicating which values
correspond to which colors).
</para></note>
<para>
Not every color can be represented in every colorspace. Some colorspaces
define more, or different, colors than others. The set of colors that can be
represented in a certain colorspace is called its gamut. Because gamuts
can differ widely, it is not guaranteed that images in a certain colorspace
can be converted to another colorspace without having to substitute certain
colors for others, even if they are based on the same color model.
</para>

</sect2>

</sect1>

<sect1 id="colorspaces-list">
<title>Available colorspaces</title>

<para>
&chalk; offers colorspaces based on RGB, CMYK, Lab, LMS, YCbCr, and Gray
color models. These are shortly discussed in this section.
</para>

<sect2 id="colorspaces-list-rgb">
<title>The RGB color models</title>

<para>
The abbreviation RGB stands for Red, Green, Blue, and the color model with
this name refers to the three light components that are emitted in displays
(televisions, computer monitors, etcetera) to create a certain color. This
color model is used by default in virtually any standard painting application.
</para><para>
When defining a color in the RGB model, its red, green and blue components are
specified. If all components are absent (each component is emitted at 0
percent intensity, so no light at all), the color is pure black.  If all
components are fully present (100 percent intensity), the color is pure white.
If one component is present at full intensity and the other two are absent,
the pure respective color is obtained.
</para><para>
Two more examples: if both red and green are emitted at 100 percent and blue
is not emitted, pure yellow is obtained. A color with all three components at
the same intensity is a shade of gray.
</para><para>
There are various colorspaces that implement the RGB model. For example, the
so-called RGB8 colorspace represents each color with 8 bits per component.
Since 8 bits allow for 256 distinct values, the total number of different
colors that can be specified in this colorspace is 256 (red) * 256 (green) *
256 (blue), or about 16.7 million colors. In &chalk;, a couple of RGB
colorspaces are available, for example RGB32, which is able to distinguish
between 4.2 billion values per component.
</para>

</sect2>

<sect2 id="colorspaces-list-cmyk">
<title>The CMYK color model</title>

<para>
CMYK is the abbreviation for Cyan, Magenta, Yellow, blacK (although officially
the K stands for Key, black is much more commonly used). This color model is
based on ink: a color is specified by the amount of ink needed for a point
to be perceived as having that color.
</para><para>
Since CMYK colors are used by printers while RGB colors are used on-screen,
one often wants to convert RGB colors to CMYK colors. As this cannot always be
done correctly, printed images may turn out to look quite different than what
is perceived on-screen.
</para>

</sect2>

<sect2 id="colorspaces-list-lab">
<title>The L*a*b* color model</title>

<para>
This color model uses three parameters for a color: its
luminance or lightness (L*, which lies between 0 for black and
100 for white), its position between absolute red and absolute green (a*,
which is negative for colors closer to green and positive for colors closer to
red), and its position between yellow and blue (b*, which is negative for
colors closer to blue and positive for colors closer to yellow).
</para>

</sect2>

<sect2 id="colorspaces-list-LMS">
<title>The LMS color model</title>

<para>
This model is based on the contribution of actual light wave lengths to the
color. The human eye is sensitive to three types of light waves, distinguished
by their wave lengths: long (L), middle (M) and short (S) waves. The eye's
sensitivity for a certain color on these three wavelengths can be expressed in
L, M and S coordinates.
</para>

</sect2>

<sect2 id="colorspaces-list-YCbCr">
<title>The YCbCr color model</title>

<para>
The YCbCr model is often used for video systems. The Y parameter indicates the
luminance or lightness of the color (which can be seen as a gray-tone), the Cb
and Cr parameters indicate the chrominance (color tone): Cb places the color
on a scale between blue and yellow, Cr indicates the place of the color
between red and green.
</para>

</sect2>

<sect2 id="colorspaces-list-Gray"><title>The Gray color model</title>

<para>
The Gray color model simply represents colors as shades of gray (with black
and white being the extremes).
</para>

</sect2>

</sect1>

</chapter>
