PS/PDF API Change Proposal: (Re: [cairo] Semantics of transparent objects)

Bill Spitzak spitzak at
Fri Jan 20 14:40:59 PST 2006

Carl Worth wrote:
> On Fri, 20 Jan 2006 11:29:34 -0800, Bill Spitzak wrote:
>>If you make a COLOR window, and draw CLEAR into it, do you get
> Yes.
>>If you make a COLOR_ALPHA and draw CLEAR into it, and then copy it to a 
>>COLOR surface, do you get black?
> "Copy" meaning what?
> If you mean drawing with CAIRO_OPERATOR_SOURCE then, yes you will get
> black in that case.

Yes this is what I meant by "copy".

> But most of the time, people drawing one surface
> to another will be using CAIRO_OPERATOR_OVER, (which is the default)
> and the cleared portions will result in no change to the destination
> surface in this case.

Yes, but OVER produces the same output for all three of the current 
COLOR_ALPHA, COLOR, and my proposed "always over white" COLOR.

I thought the original problem was that "CLEAR" produced unexpected 
results on the PostScript output. It seems now there are three solutions:

1. From the above, it sounds like doing nothing (where PostScript uses a 
COLOR surface and CLEAR produces black) is a perfectly acceptable 
solution, in that it matches other COLOR surfaces perfectly.

2. Have PostScript use the COLOR_ALPHA model. This means CLEAR produces 
white, and also things using the destination alpha work. This appears to 
be the preferred solution, however I am wondering if the overhead of 
supporting the seperate alpha channel is worth it. If PostScript is 
defined to be a COLOR surface then a lot less possible composites need 
to be emulated. Also preview in a COLOR window is still broken and will 
show black where the PostScript output is white.

3. My proposal was to alter the COLOR model so that CLEAR produces 
white, but that other operations that use destination alpha continue to 
act as though the destination is 1 everywhere.

In any case all three of these do not require specifying the surface 
type when opening the printer. Just have the printer default to whatever 
it uses.

More information about the cairo mailing list