;$Author: kovalick $ ;$Date: 1996/08/09 15:39:10 $ ;$Header: /home/rumba/cdaweb/dev/control/RCS/DeviceClose.pro,v 1.2 1996/08/09 15:39:10 kovalick Exp baldwin $ ;$Locker: baldwin $ ;$Revision: 1.2 $ Pro DeviceClose,command=command ; 25 Aug 1993 Bobby Candey, Code 632 ; Robert.M.Candey.1@gsfc.nasa.gov; 1995 June 22; added GIF ; 1997 Jan 3 RMC; added EPS=7 file ; This procedure closes the print file and submits it to the printer common deviceTypeC, deviceType, file ; '(X=0, PS color=1, PS gray=2, PS BW=3, Tek=4, Zbuf=5, GIF=6)? ',deviceType if n_elements(deviceType) le 0 then message,'No deviceType defined' Case deviceType of 0: begin ; X windows End 5: begin ; Z buffer xscale = !x.s yscale = !y.s device,/close ;RTB added 11/96 End 6: begin ; GIF image file output xscale = !x.s yscale = !y.s bytemap = tvrd() ; get bitmap from Z device ; save,xscale,yscale,bytemap,file='bytemap.dat' tvlct, r,g,b, /get ; get colortable actually used write_gif, file, bytemap, r,g,b ; print,' byte map stored in file: ', file ; 'bytemap.dat' ;If you transfer the GIF image to a Macintosh, use Fetch and set its Suffix ;Mapping Custom option to assign the filetype 'GIFf' and use binary transfer. End 7: begin ; color Encapsulated Postscript (EPS) device,/close ; if keyword_set(command) then spawn, command ; spawn, 'print/queue=NCFCP2_PS idl.ps/del' print, 'IDL.EPS is available for enclosure in another document' End 1: begin ; color Postscript device,/close if keyword_set(command) then spawn, command ; spawn, 'print/queue=NCFCP2_PS idl.ps/del' print, 'IDL.PS is available for printing to a color Postscript printer' End 2: begin ; grayscale Postscript device,/close if keyword_set(command) then spawn, command ; spawn, 'print/queue=NCFLP1_PS idl.ps/del/notify' print, 'IDL.PS is available for printing to a Postscript printer' End 3: begin ; Black and white Postscript device,/close if keyword_set(command) then spawn, command ; spawn, 'print/queue=NCFLP1_PS idl.ps/del/notify' ; print, 'IDL.PS is available for printing to a Postscript printer' End 4: begin ; Tektronix 4105 End Else: MESSAGE,'INCORRECT OUTPUT DEVICE!!!' endcase return END ; deviceClose Pro DeviceOpen, device, portrait=portrait, fileOutput=fileOutput, $ sizeWindow=sizeWindow, COLORTAB=COLORTAB ;Terri Martin and Robert Candey, 26 July 1993 ; added more devices 25 Aug 1993 BC ; change to white on bottom, black on top 27 Aug 1993 BC ; Robert.M.Candey.1@gsfc.nasa.gov; 1995 June 22; added GIF ; R. Burley 04/19/96 added COLORTAB Keyword for use with GIF ; 1997 Jan 3 RMC; added EPS=7 file ; This procedure sets the desired output device and parameters. common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr common deviceTypeC, deviceType, file top = 255 bottom = 0 if (n_elements(device) le 0) then begin deviceType = 0 ; print, 'Choose an output device:' ; print, '0 X windows (color)' ; print, '1 Postscript file (color)' ; print, '2 Postscript file (grayscale)' ; print, '3 Postscript file (black&white)' ; print, '4 Tektronix 4105 terminal (16 colors)' ; print, '5 Z buffer (color)' ; print, '6 GIF image (color)' ; print, '7 Encapsulated Postscript file (color)' ; read, 'Output device number? ', deviceType Read, $ 'Output (X=0, PS color=1, PS gray=2, PS BW=3, Tek=4, Zbuf=5, GIF=6, EPS=7)? ',$ deviceType endif else begin deviceType = device endelse Case deviceType of 0: begin ; X windows set_plot,'x' !p.background = !d.n_colors-1 ; !p.color = !d.n_colors-2 !p.color = 0 loadct,13 ; restore,'goodcolor.xdr' ; tvlct,red1,green1,blue1 !p.thick = 1.0 & !x.thick = 1.0 & !y.thick = 1.0 ; !x.style = 1 & !y.style = 1 !p.charthick = 1.0 & !p.charsize = 1.0 !p.font = -1 ; 0 ; hardware font, -1 for Hershey character set ; ### ; erase ; to clear screen first time End 5: begin ; Z buffered output if (n_elements(sizeWindow) le 0) then sizeWindow=[640,512] set_plot,'z' device,set_resolution=sizeWindow,set_colors=240,set_char=[6,11], $ z_buffering=0 !p.background = !d.n_colors-1 ; !p.color = !d.n_colors-2 !p.color = 0 loadct,13 ; restore,'goodcolor.xdr' ; tvlct,red1,green1,blue1 !p.thick = 1.0 & !x.thick = 1.0 & !y.thick = 1.0 ; !x.style = 1 & !y.style = 1 !p.charthick = 1.0 & !p.charsize = 1.0 !p.font = -1 ; 0 ; hardware font, -1 for Hershey character set ; erase ; to clear screen first time End 6: begin ; GIF image file output if (n_elements(sizeWindow) le 0) then sizeWindow=[640,512] if (n_elements(fileOutput) le 0) then file='idl.gif' else file=fileOutput set_plot,'z' device,set_resolution=sizeWindow,set_colors=240,set_char=[6,11], $ z_buffering=0 !p.background = !d.n_colors-1 ; !p.color = !d.n_colors-2 !p.color = 0 if keyword_set(COLORTAB) then loadct,COLORTAB else loadct,13 ; restore,'goodcolor.xdr' ; tvlct,red1,green1,blue1 !p.thick = 1.0 & !x.thick = 1.0 & !y.thick = 1.0 ; !x.style = 1 & !y.style = 1 !p.charthick = 1.0 & !p.charsize = 1.0 !p.font = -1 ; 0 ; hardware font, -1 for Hershey character set ; erase ; to clear screen first time End 7: begin ; color Encapsulated Postscript (EPS) if (n_elements(fileOutput) le 0) then file='idl.eps' else file=fileOutput set_plot, 'ps' if keyword_set(portrait) then begin device,/portrait,bits=8,font_size=12,/color,/INCHES,$ YOFFSET=1.2,XSIZE=8,ysize=8.6,xoffset=0.25, file=file,/encap endif else begin device,/landscape,bits=8,font_size=12,/color,/INCHES,$ YOFFSET=9.8,XSIZE=8.6,ysize=8.1,xoffset=0.2, file=file,/encap ; device,/landscape,bits=8,font_size=12,/color,/INCHES,$ ; YOFFSET=10.25,XSIZE=10,ysize=7.5,xoffset=0.5, file=file,/encap ; device,/landscape,bits=8,font_size=12,/color,/INCHES,$ ; YOFFSET=9.50,xsize=8,ysize=8,xoffset=.75, file=file,/encap endelse !p.background = !d.n_colors-1 ; !p.color = !d.n_colors-2 !p.color = 0 loadct,13 ; restore,'goodcolor.xdr' ; tvlct,red1,green1,blue1 !p.thick = 3.0 & !x.thick = 3.0 & !y.thick = 3.0 ; !x.style = 1 & !y.style = 1 !p.charthick = 3.0 & !p.charsize = 1.0 !p.font = -1 ; hardware font, -1 for Hershey character set End 1: begin ; color Postscript if (n_elements(fileOutput) le 0) then file='idl.ps' else file=fileOutput set_plot, 'ps' if keyword_set(portrait) then begin device,/portrait,bits=8,font_size=12,/color,/INCHES,$ YOFFSET=1.2,XSIZE=8,ysize=8.6,xoffset=0.25, file=file endif else begin device,/landscape,bits=8,font_size=12,/color,/INCHES,$ YOFFSET=9.8,XSIZE=8.6,ysize=8.1,xoffset=0.2, file=file ; device,/landscape,bits=8,font_size=12,/color,/INCHES,$ ; YOFFSET=10.25,XSIZE=10,ysize=7.5,xoffset=0.5, file=file ; device,/landscape,bits=8,font_size=12,/color,/INCHES,$ ; YOFFSET=9.50,xsize=8,ysize=8,xoffset=.75, file=file endelse !p.background = !d.n_colors-1 ; !p.color = !d.n_colors-2 !p.color = 0 loadct,13 ; restore,'goodcolor.xdr' ; tvlct,red1,green1,blue1 !p.thick = 3.0 & !x.thick = 3.0 & !y.thick = 3.0 ; !x.style = 1 & !y.style = 1 !p.charthick = 3.0 & !p.charsize = 1.0 !p.font = -1 ; hardware font, -1 for Hershey character set End 2: begin ; grayscale Postscript if (n_elements(fileOutput) le 0) then file='idl.ps' else file=fileOutput set_plot, 'ps' if keyword_set(portrait) then begin device,/portrait,bits=4,font_size=12,/INCHES,$ YOFFSET=1.2,XSIZE=8,ysize=8.6,xoffset=0.25, file=file ; device,/portrait,bits=4,font_size=12,/INCHES,$ ; YOFFSET=0.25,XSIZE=8,ysize=10.5,xoffset=0.25, file=file endif else begin device,/landscape,bits=4,font_size=12,/INCHES,$ YOFFSET=10.75,XSIZE=10.5,ysize=8,xoffset=0.25, file=file endelse !p.background = !d.n_colors-1 !p.color = 0 ; !p.background = 0 ; !p.color = !d.n_colors-1 ; loadct,0 ; r_curr = (!d.n_colors-1) - bindgen(!d.n_colors) ; inverted gray scale ;; r_curr = bindgen(!d.n_colors) ; gray scale ;; g_curr = r_curr & b_curr = r_curr ;; tvlct, r_curr, g_curr, b_curr print, "Don't forget to invert your data (!d.n_colors-1-bytscl(data)) for grayscale" !p.thick = 3.0 & !x.thick = 3.0 & !y.thick = 3.0 ; !x.style = 1 & !y.style = 1 !p.charthick = 3.0 & !p.charsize = 1.0 !p.font = -1 ; hardware font, -1 for Hershey character set End 3: begin ; Black and white Postscript if (n_elements(fileOutput) le 0) then file='idl.ps' else file=fileOutput set_plot, 'ps' if keyword_set(portrait) then begin device,/portrait,font_size=12,/INCHES,$ YOFFSET=1.2,XSIZE=8,ysize=8.6,xoffset=0.25, file=file endif else begin device,/landscape,font_size=12,/INCHES,$ YOFFSET=10.5,XSIZE=10,ysize=7.5,xoffset=0.5, file=file endelse ; !p.background = 1 ; !p.color = 0 !p.thick = 3.0 & !x.thick = 3.0 & !y.thick = 3.0 ; !x.style = 1 & !y.style = 1 !p.charthick = 3.0 & !p.charsize = 1.0 !p.font = -1 ; hardware font, -1 for Hershey character set End 4: begin ; Tektronix 4105 set_plot, 'tek' device,color=16, /tek4100 !p.background = 0 !p.color = 1 ;?### loadct,12 ; 16 color table !p.thick = 1.0 & !x.thick = 1.0 & !y.thick = 1.0 ; !x.style = 1 & !y.style = 1 !p.charthick = 1.0 & !p.charsize = 1.0 !p.font = -1 ; 0 ; hardware font, -1 for Hershey character set End Else: MESSAGE,'INCORRECT OUTPUT DEVICE!!!' endcase ; '(X=0, PS color=1, PS gray=2, PS BW=3, Tek=4, Zbuf=5, GIF=6)? ',deviceType w = where([0, 1, 2, 5, 6, 7] eq deviceType, wc) if (wc gt 0) then begin ; munge color table to ensure black and white color ; r_curr(!d.n_colors-2) = bottom & g_curr(!d.n_colors-2) = bottom ; b_curr(!d.n_colors-2) = bottom r_curr(0) = bottom & g_curr(0) = bottom & b_curr(0) = bottom ; background r_curr(!d.n_colors-1) = top & g_curr(!d.n_colors-1) = top b_curr(!d.n_colors-1) = top tvlct, r_curr, g_curr, b_curr endif return END ; deviceOpen