[comp.lang.postscript] Imageable Region

dudkl@dcatla.UUCP (Danny K. Llewallyn) (08/08/88)

Dear PostScript Experts,

  I am looking for a PostScript procedure that determines the imageable
  region of the printer.  I seem to remember that there is a method of
  determining this as there is one for determining the printer's resolution.


  Thanks in Advance,

  Danny.

cyosta@taux02.UUCP ( Yossie Silverman ) (08/10/88)

In article <7761@dcatla.UUCP> dudkl@dcatla.UUCP (Danny K. Llewallyn) writes:
.Dear PostScript Experts,
.
.  I am looking for a PostScript procedure that determines the imageable
.  region of the printer.  I seem to remember that there is a method of
.  determining this as there is one for determining the printer's resolution.
.
Try:

     newpath clippath pathbbox % stack = xlow ylow xhigh yhigh
.
.  Thanks in Advance,
.
.  Danny.
-- 
Yossie Silverman                                   What did the Caspian sea?
National Semiconductor Ltd. (Israel)				- Saki
UUCP: taux01!yossie@nsc.UUCP
NSA LSD FBI KGB PCP CIA MOSAD NUCLEAR MI5 SPY ASSASSINATE SDI -- OOCLAY ITAY

richk@pogo.GPID.TEK.COM (Richard G. Knowles) (08/11/88)

In article <7761@dcatla.UUCP> dudkl@dcatla.UUCP (Danny K. Llewallyn) writes:
>  I am looking for a PostScript procedure that determines the imageable
>  region of the printer.  I seem to remember that there is a method of
>  determining this as there is one for determining the printer's resolution.

The only clean way I have found is to do the following:

	initgraphics % make sure CTM and clippath are at defaults
	clippath     % surrounds the imageable area
	pathbbox

and the stack will contain the lower left and upper right boundaries of the
imageable area in user space terms.  Replacing "initgraphics" with "initclip
matrix identmatrix setmatrix" will produce numbers in terms of pixels.

One way of determining the device resolution is to look at the default CTM
scaling factors and multiply by 72.0 (72 points to the inch) (DPI / 72 ==
default scale).  The only real bother here is that X and Y scale factors may
be different (DPI might be different in X and Y directions) and that the X
and Y scale factors might be in the c and b matrix positions, respectively, 
instead of the more common a and d positions, respectively.  This happens
when the paper is fed in in the landscape orientation (rotated) rather than
the usual portrait orientation.

Another way to determine DPI is to use the user space and device space
"clippath pathbbox" values.
    X DPI = USERurx / DEVICEurx * 72
    Y DPI = USERury / DEVICEury * 72

Note that these depend on Adobe's definition of default user space units
being points (although 72.0 is not exactly a point).

geof@imagen.UUCP (Geoffrey Cooper) (08/12/88)

The following PostScript procedure returns the printer's resolution in
DPI X & Y on the stack:

/DetermineResolution
{
    gsave
	initmatrix	% force current matrix to default matrix.
	72 0 dtransform dup mul exch dup mul add sqrt % x resolution
	0 72 dtransform dup mul exch dup mul add sqrt % y resolution
    grestore
}
bind def

The procedure works by putting inch vectors parallel to the axes
through the default transformation and measuring the magnitude of the
resultant vectors.  Since the transformation might entail a rotation,
the measurement uses pythagorus' theorem to compute the magnitude.

- Geof
-- 
UUCP: {decwrl,sun}!imagen!geof ARPA: imagen!geof@decwrl.dec.com