[GRASS-dev] PSDriver

Glynn Clements glynn at gclements.plus.com
Mon Nov 14 08:10:23 PST 2022


Brad ReDacted wrote:

> Can someone tell me what spec the (enhanced) postscript driver 
> (lib/psdriver) adheres to? I am having difficulty looking up one of the 
> parameters (box erase, in particular - erase.c).
> 
> I found references to PostScript levels, but no mention of EPS, which is 
> clearly being used in this case. AFAICT, there is no such box erase in EPS.

If the output filename ends in ".eps", then the "ps.encapsulated" flag is
set. This does two things: PS_Set_window() writes "EPSWINDOW" instead
of "WINDOW", and PS_Erase() writes "ERASE" instead of a "BOX" command.

All commands are defined in psdriver.ps.

The PS driver doesn't attempt to generate true Encapsulated
PostScript, it just tries to be slightly more useful if you're going
to something other than send the file straight to a printer. 
Essentially, if ps.encapsulated is set, the driver avoids issuing
"destructive" commands.

BOX just draws a filled rectangle, while ERASE executes an "erasepage"
command.

EPSWINDOW is identical to WINDOW except the former doesn't execute
"initclip".

I have no idea how much use (if any) the PS driver has. Its main
advantage over using the cairo driver is that the PS driver doesn't
rasterise vector commands, whereas cairo will do this for features
which can't otherwise be implemented (e.g. alpha blending). This can
result in PS files generated by the cairo driver being much larger
than those generated by the PS driver while having worse image
quality.


More information about the grass-dev mailing list