[Cairo] Preliminary PostScript output support in cairo-0.1.11
Gustavo J. A. M. Carneiro
gjc at inescporto.pt
Tue Nov 4 07:54:38 PST 2003
A Ter, 2003-11-04 às 15:32, Carl Worth escreveu:
> On Nov 4, Gustavo J. A. M. Carneiro wrote:
> > Please tell me this is just experimental code!
> That's the idea I was trying to get across with the big list of
> disclaimers about the current implementation. ;-)
> > Sending images to the printer is _not_ at all what I had in mind as
> > postscript backend. 8-|
> In some cases there will be no choice but to generate images. As soon
> as any drawing is performed with alpha != 1, PostScript will not be
> able to represent the desired output, so cairo must compute the result
> The tricky bit is that we don't know a priori which portions of the
> image can be handled directly by PostScript.
> So we have a couple of options:
> 1) Generate a vector-based PostScript file while simultaneously
> computing the full image (ie. as in the current implementation).
> Also keep track of the region affected by objects with translucence
> (alpha != 1). Then, at the end, emit the appropriate region of the
> image on top of the rest of the PostScript output.
> 2) Instead of immediately computing results from cairo drawing
> operations, instead store everything into a metafile format (not
> visible to the user --- could be PDF or SVG perhaps). Then, when a
> page is complete, go back through the metafile generating
> PostScript with images only where necessary.
> However, in either case, portions of the resulting PostScript
> document, (in the worst case the entire document), may still be images
> computed by cairo. So the user will still have to be prepared to deal
> with that. That makes me feel there won't be a huge payoff to doing
> the work to get from where we are to the plans described above.
Well, it might be worth looking at the libgnomeprint code, which
already addresses the same problem.
I once generated a PS file with gnomeprint containing a a background
(grid lines), a translucent rectangle rectangle, and on top of the
translucent rectangle some opaque lines and text. The great thing about
the generated postscript is that it created, in the area of the
translucent rectangle, an image that renders only the translucent
rectangle and the grid lines behind. The text+lines on top of the
rectangle, however, are drawn normally as vectorial postscript
operators. See here for an example of this (increase the zoom of
ghostview to 10x to notice the pixelization in the area of the plot
> On the other hand, PDF 1.4 should be capable of directly rendering
> everything from cairo, (in light of the fact that Render's custom
> disjoint/conjoint operators have now been dropped from the cairo
> interface). So it should be quite feasible to generate "real" PDF
> output without resorting to page-size images everywhere.
Gustavo João Alves Marques Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
More information about the cairo