[Xr] API questions

Bill Spitzak spitzak at d2.com
Thu Jul 3 18:07:27 PDT 2003


On Thursday 03 July 2003 02:42 pm, David Forster wrote:
> On Thu, Jul 03, 2003 at 10:44:52AM -0700, Bill Spitzak wrote:
> > My suggestion is that the exact results for out-of-gamut colors is
> > implementation-dependent. This will allow Xr or Xrender to turn the
> > colors into internal representation without breaking the spec.
>
> I think this would be a mistake.
>
> If Xr is to be a serious API for rendering to both CRT/LCDs and
> printers, then Xr is going to have to get color management right.
> There's no way around it.  If it doesn't, then it'll just get replaced
> by someone who's willing to do it right.
>
> The point of abstracting away the hardware is so that developers can
> write their rendering code _once_.  The same code used to render a
> document (like say a vector/raster image) to the screen can be reused
> to print that document out.

I fully understand that, but since the device cannot display out-of-gamut 
colors then it is impossible to produce the same output on two different 
devices anyway, so it really does not matter what it does with such colors 
(though I recommend that the device choose reasonable values).

What I meant is that a compositing operation of two out-of-gamut colors could 
mathematically produce in-gamut colors. However I recommend that this not be 
supported, even though it makes in-gamut output different on different 
devices.

I hope everybody can see that unless this is defined this way, Xr cannot use 
hardware for compositing, and must store full-floating point for every pixel 
in it's display.

> If you don't define what the out-of-bounds sRGB values mean, then the
> developer is going to have to take over color management, and that
> means hardware dependence.  And with Xr already correcting values for
> sRGB it will be nothing short of a mess.  One might just as well use
> Xr for screen output and PostScript for printer output..

I do define exactly what out-of-bounds sRGB means: sRGB defines the exact 
luminosities of all values in the range 0-1, and I recommend this be extended 
with a straight line less than zero and a continued gamma curve above 1:

if X is the sRGB value,
luminosity = (x < .04045) ? x*1/12.92 : pow((x+.055)/1.055, 2.4)

sRGB also defines the exact CIE XYZ coordinates of 1,0,0 and 0,1,0 and 0,0,1.



More information about the cairo mailing list