[Xr] API questions

Bill Spitzak spitzak at d2.com
Mon Jun 9 10:43:27 PDT 2003

On Sunday 08 June 2003 07:32 am, Damien Genet wrote:

> Do you also intend to offer non RGB color spaces ?

I would recommend that Xr offer only sRGB. (see www.srgb.org for details) As 
soon as you introduce other color spaces you end up with useless complexity 
as any such conversion can be done by a program before calling Xr. You also 
confuse programmers, who will then waste lots of time trying to figure out 
which of the color spaces is "best" or "fastest". Just offer one interface 
and avoid all this mess.

The reason for sRGB is that it is extremely easy to simulate it with 
reasonable accuracy on all current hardware, as storing it in 8 bits into a 
frame buffer is pretty accurate on everything made today, and all new 
hardware (ie lcd screens, digital cameras) is forced to conform to these 
standards so that it displays images correctly on existing systems. It also 
means that virtually all images are stored in sRGB and thus makes the 
conversion of an image to display in Xr trivial.

To allow devices to support any color space Xr does have to offer an 
interface that allows sRGB to be specified with values outside the 0-1 range. 
Not all interfaces need to, just for instance a floating-point one.

*maybe* the floating point interface should be in "linear sRGB". This is the 
same whitepoint and viewing conditions as sRGB, but does not include the 
gamma lookup function and thus luminance is in a linear relationship to the 
value. However I would not offer more than one floating-point interface, so 
whether it is better to do this or offer the consistency of sRGB for all 
interfaces is debatable.

I would like to see an interface that allows a color+alpha to be specified by 
a single 32-bit number, with 8 bits of each channel in sRGB. This would cover 
about 90% of the needs of programs to specify colors.

                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com

More information about the cairo mailing list