Graphics-Toolkit-Color
view release on metacpan or search on metacpan
lib/Graphics/Toolkit/Color/Manual/Space.pod view on Meta::CPAN
which lends its name as family name. The other members of the family need
to provide a way to map their axes to the axes of the representative.
This is achieved either by having the same long axis names (like I<HSL>
and I<OKHSL>) or by assigning a role name to each axis. For instance
the I<chroma> axis of the I<LCH> space has the role name I<saturation>
so GTC can treat the I<chroma> the same way as an I<HSL> I<saturation> value.
The spaces on this page are grouped by family (for better orientation),
but not every color space belongs to a family, hence the chapter L</Other>.
=head1 ORDER
Please note the ordering of spaces within each family. That corresponds
to the internal search order. That means if you define a color with values
in L<hash format|Graphics::Toolkit::Color::Manual::Format/hash>,
a HASH reference with values under the keys of I<red>, I<green> and I<blue>,
they will be understood as standard L</RGB> values. I<RGB> is also the
first entry here for the I<RGB family>. This is especially noteworthy
since many operations default to OK-type spaces like L<OKLAB> or L<OKHSL>,
but L<CIELAB> and L<HSL> are higher in search order.
=head1 SYNTAX
Whenever a color space name is used within a
L<color definition|Graphics::Toolkit::Color::Manual::Format>, it has to
be written as shown here in the chapter headings. But there is a rather
great degree of freedom to write the name in various ways. First of all
the name and its alias can be used synonymously by the user. Only when
GTC writes a color definition, it never uses alias names. Secondly,
upper and lower case are acceptable. Although some formats will force
the output to be in a certain casing style. Thirdly, there is a list of
acceptable, special characters as: underscore I<'_'>, dash I<'-'>,
whitespace I<' '> and dot I<'.'>. They might be inserted into names to
write them like I<'BT.2020'>, but that's optional.
=head1 TERMS
The L</SYNTAX> section already explained the relation between a B<name>
and B<alias name> and the section before laid out what a space
L</FAMILY> is and why there is the concept of an B<axis role>.
The L</INTRODUCTION> told about long and short B<axes names>,
axis B<ranges>, I<normal> ranges and B<gamut>.
Large gamut just means a space encompasses more colors than other spaces.
The B<whitepoint> is the set of values that represent pure white in a certain space.
The conversion between spaces is always a mathematical algorithm, but
some conversions are simpler than others. Some are fulfilled by just one
operation. There the values of the color are taken as vector that gets
multiplied with a B<conversion matrix> to obtain the values in the target
space. And sometimes conversions consist just of scaling, where a gamma
value gets applied to every color value: C<$value = $value ** $gamma>.
In some cases there are some additional operations to smooth out the edges of
the curve. But in any case this procedure is called B<transfer function>.
=head1 RGB family
=head2 RGB
(alias name is B<SRGB> - standard RGB) is the default color space of this
module internally and for input and output.
It is used by most computer hardware like monitors and follows the logic of
additive color mixing as produced by an overlay of three colored light beams.
The sum of all colors will be white, as opposed to subtractive mixing.
I<RGB> is a completely Cartesian (Euclidean) 3D space and thus an I<RGB>
tuple consists of three integer values:
B<red> (short B<r>) range: 0 .. 255, B<green> (short B<g>) range: 0 .. 255
and B<blue> (short B<b>) range: 0 .. 255.
A higher value means that a stronger amount of that base color flows into
the mix that is displayed on a black background. Therefore black is (0, 0, 0),
white (255, 255, 255) and a pure red (fully saturated color) is (255, 0, 0).
RGB has a gamma of 2.4, but a piecewise transfer function, which is
clipped at the corners (around the normalized values of zero and one).
=head2 LinearRGB
(alias name is B<LinRGB>)
Same as L</RGB> but with normal value ranges (0 .. 1) and removed piecewise
gamma correction. That means there is a linear correlation between the
shown values and the RGB brightness of the pixel on the screen without
any adaptation to human sensibilities. Its alias name is B<LinRGB>.
=head2 CIEXYZ
this space (alias B<XYZ>) has the axis B<X>, B<Y> and B<Z> (long and short
axis names are this time the same), that refer to the red, green and blue
receptors (cones) in the retina (on the back side of the eye). Because
those cones measure a lot more left and right than just exactly those colors,
they got these technical names. The values in that space tell you about
the amount of chemical and neurological activity a color produces inside
the eye. The values ranges are always from zero and reach 95.047 on the
C<X> - axis, 100 on C<Y> and 108.883 on C<Z>, due to the used white
point of I<D65> which has these values divided by 100. The illuminant
I<D65> is standard for all CIE spaces except I<CIERGB>.
=head2 CIERGB
1931 standardized, normal valued (0 .. 1) space with same axis as L</RGB>:
I<red> (I<r>), I<green> (I<g>) and I<blue> (I<b>).
It has the illuminant E and no gamma (linear RGB).
=head2 AdobeRGB
(alias name B<opRGB>) is a normalized L</RGB> variant with the
CIE white point D65 a gamma of about 2.2.
=head2 AppleRGB
normal L</RGB> variant with white point of D65 and gamma is 1.8.
It is the legacy color space Apple used in the 90ies.
=head2 ProPhotoRGB
(alias name B<ROMMRGB>) normal L</RGB> variant with a white point of
D50, gamma = 1.8 and a wide gamut.
=head2 WideGamutRGB
Even greater gamut then previous spaces with white point D50 and gamma of ~2.2.
=head2 Display P3
( run in 1.127 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )