On Tuesday, 23 June 2015 at 14:58:35 UTC, Manu wrote:
https://github.com/D-Programming-Language/phobos/pull/2845
I'm getting quite happy with it.
I think it's a good and fairly minimal but useful starting
point.
It'd be great to get some reviews from here.
My experience (my previous job involved designing a GPU based
color grading machine) is that the more you study colors, the
more you realize how rich this domain is.
To me there are different features corresponding to different
domains :
- spectral/multispectral colors (Satellite imagery, Medical
imagery, Spectrometry), also useful for monitor calibration.
- vfx industry will want
- sRGB, Adobe RGB with non linear gradation law (piecewise
linear+gamma for sRGB)
- camera colorspaces (Alexa, PanaLog, Gamma)
- film colorspaces (density encoded, cineon / kodak log)
- broadcast colorspaces YUV, YCbCr, YPbPr, DCI P3
- physical color space XYZ (CGI rendering)
- print industry will want CMYK
- game industry will want alpha support with or without
premultiplication, HSL
- academic will want perceptual colorspace (Lab, L*a*b*),
distance expresses how different colors are perceived.
...
So to me there are several things to consider :
- the number of channels, their semantics, the type they use
(8/10/16/32/64 bits, int, unsigned, float...)
- some format packs channels, most common form of DPX is RGB10A2
bits packed in a 32 bit word (10bits red, 10bits green, 10 bits
blue, 2 bits alpha) the word might be little/bigendian
- the gradation law for those channels (linear, sRGB, log,
semilog, lookup table, ...)
- alpha is a special beast when composing colors
- when the signal is captured/displayed the gamut comes into play
(space of colors the device can handle) the color value can be
correlated with the characteristics of the light : white balance,
signal quantification, white point, black point, channel
characteristics (spectrum)
- moving between colorspaces is not necessary reversible (HSL <->
RGB). It involves non trivial logic (1D LUT, 3D LUT, matrix,
piecewise functions, log/pow) that also makes the transformation
lossy.
Manu, I understand that you don't want this library to handle
very possible cases what is your rationale for what's useful /
not necessary ? I suppose most users will simply manipulate sRGB
jpeg/png.