[cairo] Linear colorspace not a good idea
Bill Spitzak
spitzak at d2.com
Mon Mar 13 14:13:28 PST 2006
Although I wrote a lot of arguments in favor of using linear space (see
http://mysite.verizon.net/spitzak/conversion/index.html), there are
serious problems with using this for GUI. I think Cairo has to do all
compositing in the device space (ie sRGB for most of the devices we are
interested in, but allow the backend to decide).
First is that there is a huge supply of icons that have been designed to
be composited in sRGB space and will have bad edges otherwise when put
atop the background they are designed for.
Premultiplied images are almost impossible to correct and then composite
in linear space. Many programs will produce very noisy or incorrect
color values when the alpha is small, dividing by alpha to convert to
linear will amplify this noise to unacceptable levels.
Large areas of partial transparency, such as tinting, or hand-painted
Photoshop corrections, will composite to totally different colors than
expected.
Another serious problem is that sometimes people want the perceptual
result of the composite rather than the true result. The most obvious
example is text and thin lines, drawn in different colors on different
backgrounds. People expect the same image drawn in different colors
(such as white on black verses the inverse) will look the same thickness
and weight. Unfortunately this is not true at all in linear space: the
black lines look much thinner than white lines. But in sRGB it does
appear to work, because it is much closer to perceptually linear. Every
line graphics and work processor program in the world relies on this.
Also an obvious problem is that using anything other than device space
will slow down Cairo a huge amount and probably make hardware
compositing impossible.
Russell Shaw wrote:
> For mathematical operations to work right, gamma correction should be done
> on RGB data so that any nonlinear light-input vs voltage-output on input
> devices
> such as cameras are linearized. After the data is transformed in various
> ways, it should gamma "nonlinearized" to compensate for nonlinear
> intensity vs
> voltage of output devices such as CRTs.
More information about the cairo
mailing list