Section 8: GRAPHICS

What hardcopy output devices are supported with the distributed system?

 UNIX IRAF distributions include these SGI translators:
    sgi2uapl.c  - PostScript for Apple LaserWriters and many more PS plotters
    sgi2uhpgl.c - HP Graphics Language for HP 7550A and other pen plotters
    sgi2uimp.c  - Impress language for Imagen printers
    sgi2uqms.c  - QMS Vector Graphics (Talaris Lasergrafix, QUIC Command Mode)
    sgi2ueps.c  - Encapsulated PostScript, PS-Adobe-3.0, EPSF-3.0
    sgi2uhplj.c - HP Printer Command Language (HP LaserJet Series)
    sgi2uptx.c  - Printronix plotter
    sgi2gif.c   - Read an IRAF SGI bitmap file on standard input and convert
		  to a GIF format image on standard outout. (See also
		  iraf$unix/gdev/sgidev/README.gif).
    sgi2xbm.c   - Read an IRAF SGI bitmap file on standard input and convert
		  to an XBM format image on standard outout.
In addition, Versatec plotters are supported (no SGI translator needed).
VMS IRAF distributions include these SGI translators:
    sgi2vapl.f  - PostScript for Apple LaserWriters and many more PS plotters
    sgi2vhpl.f  - HP Printer Command Language (HP LaserJet Series)
    sgi2vln03.c - for LN03 Plus, in Tek mode
    sgi2vtri.f  - Trilog plotter
    sgi2vccp.f  - translates to Calcomp or Versaplot calls
    sgi2vhpp.f  - HP Graphics Language for HP 7550A and other pen plotters
    sgi2vptx.f  - Printronix plotter
    sgi2vver.f  - Versatec
    sgi2veps.f  - Encapsulated PostScript, PS-Adobe-3.0, EPSF-3.0
    sgi2vimp.f  - Impress language for Imagen printers
    sgi2vqms.f  - QMS Vector Graphics (Talaris Lasergrafix, QUIC Command Mode)

What additional SGI translators are available; how do I get them?

 We ask that sites who write additional SGI translators send the code to
http://iraf.net for possible inclusion in future IRAF releases.  At this time,
all translators we know about are distributed with IRAF, but contact us for
the latest information about any additional plotters or printers not mentioned
above.

What VMS/IRAF files do I edit to get my output device interfaced?

 There are two sources of hardcopies from an IRAF session.  One is from
CL tasks such as those in the plot package and elsewhere, the other is
from the printing capability of the display server, e.g., the etc.print
selection of SAOimage.
        Hardcopy of images displayed with SAOimage is controlled with a
VMS logical R_DISPOSE.  This is described in the V2.10 saosetup.com file, in
host$x11/run.  You define R_DISPOSE to be the host command that prints a
PostScript file to the intended device, such as
        $! R_DISPOSE :== print/queue=postscript/delete "%s"
        Plots made from CL tasks, such as CONTOUR, get disposed to a
printer based on information in the dev$graphcap file.  The best documentation
on how all this works is the SGI manual, available from the anonftp archive.
[Get the (binary) compressed, PostScript file sgi.ps.Z containing "The IRAF
Simple Graphics Interface (SGI)", Doug Tody, August 1986, 9 pages, from the
iraf/docs subdirectory of the anonftp archive on iraf.noao.edu.]  As an
example, the CL device "lw" or "rps1" is defined like this in graphcap:
    lw|rps1|                :tc=vapl:
    vapl|VMS generic interface to 300dpi Apple Laserwriter (Postscript):\
        :DD=vapl,tmp$sgk,submit/que=fast/noprint/nolog \
        /para=\050"vapl","$F","$(XO) $(XW) $(YO) $(YW) $(PW) 7 1 RPS1" \
        \051 irafhlib\072sgiqueue.com:tc=sgi_apl:
The DD string contains a host command to submit the hlib$sgiqueue.com
procedure file to the IRAF "fast" queue (as defined in hlib$irafuser.com).
In the DD string, replace "nolog" with "keep" to generate a sgiqueue.log
file in your sys$login directory for debugging if necessary.  Optionally,
replace RPS1 with the name of your PostScript device queue.  You can put
this information in hlib$sgiqueue.com if you prefer, in which case you'd
replace RPS1 from the above DD string with the word "none".  This means
to leave the output file in the tmp$ area to be disposed of as directed
in sgiqueue.com.  If no queue specification is mentioned at all, the default
queue is sys$print.  In any case, these statements in sgiqueue.com are
executed:
    $! Apple LaserWriter (Postscript)
    $ vapl:
    $  sgi2vapl     := $irafhlib:sgi2vapl
    $  sgi2vapl     'p2' 'p3'
    $!  print/passall/noform/delete 'p2'.apl
    $  delete       'p2'.;0
    $  exit
If you gave a queue name in the graphcap DD string, no changes are
necessary.  If you specified "none", modify the (commented out) print
command to be the proper host command at your site for disposing a file of
PostScript to the intended device.  Refer to the PS file as 'p2'.apl.
Execute the CL command "gflush" after making any change to graphcap.
You should also execute "gflush" (or submit another plot or log out
of the CL) to flush the graphics buffer and start the sgiqueue.com process.
To print text with the LPRINT task, information in dev$termcap is used.
CL device "vmsprint" is set up to send output to the sys$print queue.

What UNIX/IRAF files do I edit to get my output device interfaced?

 There are two sources of hardcopies from an IRAF session.  One is
from CL tasks such as those in the PLOT and other packages, the other is
from the printing capability of the display server, e.g., the etc.print
selection of SAOimage or the XImtool Print panel.
	Hardcopy of images display with SAOimage is controlled with a
UNIX shell variable R_DISPOSE.  It can be defined as the host command
used to dispose a PostScript file to the desired printer, such as:
	% setenv R_DISPOSE "lpr -Plw5 %s"
        Plots made from CL tasks, such as CONTOUR, get disposed to a printer
based on information in the dev$graphcap file.  The best documentation on
how all this works is the SGI manual, available from the anonftp archive.
[Get the (binary) compressed, PostScript file sgi.ps.Z containing "The IRAF
Simple Graphics Interface (SGI)", Doug Tody, August 1986, 9 pages, from the
iraf/docs subdirectory of the anonftp archive on iraf.noao.edu.]  Basically,
an IRAF graphics task produces "GKI metacode", which is converted to "SGI
metacode" by the SGI graphics kernel.  An SGI translator is then used to
convert the SGI metacode into PostScript, HPGL, or some other graphics
language before sending the result to the printer in question.  There are
sample entries for most supported devices in graphcap, and a few defaults
you can use for any Postscript printer.
	To interface your graphics device, you may have to edit the host
command found in the 3rd field of the "DD string" to be correct for your site.
Looking at the graphcap entry for lw5, a PostScript laserwriter in use at
NOAO as an example:
nlw|lw5|                :tc=uapl5:
uapl5|UNIX generic interface to 300dpi Apple Laserwriter NT on Orion:\
        :xs#0.269:ys#0.210:ar#0.781:\
        :DD=apl,tmp$sgk,!{ sgidispatch sgi2uapl $F -l$(XO) -w$(XW) -b$(YO) \
        -h$(YW) -p$(PW) | lpr -Plw5; rm $F; }&:tc=sgi_apl:
sgi_apl|Apple Laserwriter (Postscript) 300dpi:\
        :kf=bin$x_sgikern.e:tn=sgikern:cw#.0125:ch#.0294:\
        :ar#0.762:xs#0.267:ys#0.203:xr#3180:yr#2380:\
        :MF#1:XO#55:XW#3180:YO#90:YW#2380:PW#2.4:
Note how the 3 parts of the entry are linked together with the tc= field.
Device lw5 (aliased to nlw) is a PostScript device, so it uses the sgi2uapl
SGI translator.  The output from the translator is piped to the Unix command
        lpr -Plw5
It is this site specific part of the DD command that you are most likely
to have to edit, probably just by specifying another device name instead of
lw5.  You can also add an alias that makes more sense to your site than
"lw5" if you like.  The sgi_apl entry should not have to be changed.
Without making any changes at all to graphcap, you can send output to
device lpr, lp, or lw.  This uses a "generic" graphcap entry which
generates PostScript and sends it to the default Unix printer with
the command "lpr" (no device specified with -P).  This entry should
work for you "out of the box", assuming you want to access the Unix
default printer and it is a PostScript device.  If you want to access
a non-default printer from IRAF, you will most likely have to edit (at
least) the site specific portion of the DD command in graphcap as
illustrated above.
If you don't append a device name to the :.snap command, the output goes
to your stdplot device as defined in the cl:
        cl> show stdplot
        lw5
If this isn't enough information to get things working, write to http://iraf.net
and tell us what sort of printer you're trying to access and what Unix command
you use to print to it.  If you happen to have an HP LaserJet, there was an
article on interfacing this sort of device to IRAF in Newsletter #12,
July 1992.  Newsletter are also available from our anonftp archive, in
the iraf/docs subdirectory on iraf.noao.edu.

Can I generate color PostScript of an IRAF plot or displayed image?

 At this time, there's no way in the IRAF core system to produce color
PostScript of graphics.  But the PostScript graphics kernel in STSDAS
can produce both publication quality graphics (when used with their IGI
package) and color PostScript.  You can generate a color hardcopy of an
image displayed with SAOimage using tasks in V1.2.2 or later
of STSDAS.  You would display the image and write out its color map with
SAOimage.  Then the displayed image is saved as gki metacode and input, along
with the color map, to the PSIKERN.  The PostScript kernel will eventually be
part of the IRAF core system and is described in the Summer 1992 STSDAS
Newsletter.  The Newsletters, and STSDAS itself, are available from the anonftp
archive on stsci.edu.  Their site support group (help@stsci.edu) can give you
more information about PSIKERN.
	Direct color PostScript conversion of images is included in V2.11
as part of the new EXPORT task, or available from the XImtool display server
directly.
It is also possible to use host utilities that generate color PostScript.
For example, the "screendump" command that comes standard with Sun
writes the contents of the screen as a Sun rasterfile to the STDOUT.  You
can capture this to a file and then all that's left is to convert it to
color PostScript.  If you are running X windows (i.e. OpenWindows) then
try using the XV utility (available from most X ftp sites, try ftp.x.org
(198.112.44.100)) to read in the rasterfile, crop out whatever you don't
want, and then save the result as a color PS file you can then send to the
printer.  For a less interactive approach, and one that can be used from
SunView, the "San Diego IMAGE Tools" are also very good.  These are available
as binary-only from ftp.sdsc.edu in the pub/sdsc/graphics/imtools directory.
There are utilities to crop an image, and the conversion command you're
looking for (once these are installed) is
        % screendump | imconv -ras - -ps dump.ps -outclt -outindex
to convert the screendump to a color PS equivalent.

Does IRAF support Encapsulated PostScript?

 Yes, IRAF includes an SGI translator to generate Encapsulated
PostScript.  The following EPS logical devices are available:
	eps or epsf	- portrait orientation
	epsl or epsfl   - landscape orientation
	epsh or epshalf - half page, portrait orientation
These options can be invoked with an interactive graphics command such as
	:.snap eps
by specifying the graphics output device via a hidden task parameter
	cl> contour dev$pix dev=eps
or by setting the stdplot environment variable before running the task.
	cl> reset stdplot = eps
In addition, the PostScript generated by the XImtool or SAOimage display
servers is encapsulated, EPSF-2.0.