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

Michael Sweet mike at
Thu Jan 19 05:06:01 PST 2006

Owen Taylor wrote:
> I can't really object too strongly to this change, since the the model
> where a PS/PDF surface matches a CAIRO_CONTENT_COLOR surface is still
> available.
> But I'm really not very comfortable with the with the idea of a 
> CAIRO_CONTENT_COLOR_ALPHA PS/PDF surface; I have concerns about 
> efficiency, concerns about consistency with the rest of cairo,
> and concerns about utility.
> What is destination alpha good for?
>  A) It's good if you want to end up with an object with 
>     destination alpha. You want to draw a transparent
>     clock that you'll combine with the rest of your 
>     desktop. This doesn't really seem relevant to printing
>     to me. In the end, you are going to end up with an 
>     opaque piece of paper.

Discussion of "transparency" media aside, printers can and do
print on colored media, and while rare several commercially-
available printers offer "white" ink for printing, too.

> ...
> In the end, the reason why people want to use the PS/PDF model
> is not to produce printouts of the Cairo test cases, but
> to create and print documents; word processor documents, photos 
> of their kids, and so forth.


> We're going to have enough trouble producing good high-quality
> output for the normal case where they do that by simply drawing
> objects with OVER, that introducing a whole other code path
> of questionable utility that probably will never be optimized
> seems dubious to me.

IMHO, the use cases for PS output with alpha is such that
inefficient (large) PS output is not unusual today, so it
would be OK to just spit out an image + mask and not do any
optimization for that path.

If you don't support it, then graphics arts applications will
need to bypass Cairo when printing, which is something I'd
like to avoid...  Apple made this mistake (plus a few others)
in early versions of MacOS X, and it is only recently that
Adobe and co. have enough functionality in the new Quartz +
Print Manager APIs to utilize the standard print paths.

> And especially without such optimization, the extra parameter
> to cairo_ps/pdf_surface_create() just becomes a FAQ trap. 
> will give exactly the same result, but CAIRO_CONTENT_COLOR_ALPHA
> will likely be considerably less efficient.

Then it becomes very important to note this in the API

 > ...
> The final result of drawing to a PS/PDF surface does *not* 
> have alpha, no matter what your best intention. (Even you print
> to overhead slides, the alpha there is just the color white,
> and has no relation to the alpha of your surface.) What would

That depends entirely on the output device.  For printers with
white ink/toner/whatever, drawing white actually draws white
(it isn't blank).

Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software

More information about the cairo mailing list