SUBROUTINE VECTOR (X,Y,IMODE) C C============================================================================== C C C C ************************************************************** C *** SUBROUTINE VECTOR (X,Y,IMODE) *** C *** *** C *** SUBROUTINE TO ALLOW VECTORED GRAPHICS ON VARIOUS *** C *** GRAPHICS I/O DEVICES USING ADDED BLOCKS OF FORTRAN *** C *** CODE FOR EACH DEVICE. *** C *** *** C ************************************************************** C C C C AUTHOR: R A YOST C T V ATKINSON C T G KELLY C Kluges compliments of the MOOSE C H GREGG C CHEMISTRY DEPARTMENT C MICHIGAN STATE UNIVERSITY C EAST LANSING, MI 48824 C C DATE: 25-NOV-81,2/83,4/83 C C C VECTOR CALLING MODES: C C -5: return X == 1 if device exists C -4: inititalize the device C -3: return screen size C -2: return alpha cursor position C -1: return graphics cursor position C 0: clear the screen C 1: move the graphics cursor (unwritten vector) C 2: draw a vector from the current position to new X,Y C 3: plot a point at the given X,Y C 4: complete the plot and flush the buffer C 5: set nibs (X) and line pattern (Y) C 6: print device ID to logical unit INT(X) C 7: device specific parameters (speed on HP plotter) C C============================================================================== C COMMON /VECTOR/ LUNGRP,XSCALE,YSCALE,IDEV,TRNFRM(6), 1 XOFF,YOFF,NIBS,LINPAT COMMON /GRPHDV/ GDDEV0 ! file for IDEV=0 output BYTE GDDEV0(32) BYTE BUFFER(40) ! temp buffer for each device INTEGER*2 ESCAPE DATA ESCAPE/"33/ ! looks ASCIZ to me ... C C----------------------------------------------------------------------- C C ************************************************************** C **************** TRANSFORM THE CORDINATES **************** C ************************************************************** C C----------------------------------------------------------------------- C XT = X YT = Y JDEV = IDEV + 1 C 101 IF (IMODE .EQ. -5) X = 0.0 ! assume the device doesn't exist IF ((IMODE .LT. 1) .OR. (IMODE .GT. 3)) GO TO 110 XS = X/XSCALE + XOFF YS = Y/YSCALE + YOFF XT = XS*TRNFRM(1) + YS*TRNFRM(2) + TRNFRM(3) YT = XS*TRNFRM(4) + YS*TRNFRM(5) + TRNFRM(6) 110 IF (IMODE .NE. 6) GOTO 120 LUN = INT(X) IF (LUN .LE. 0) GOTO 90 ! illegal call - ignore 120 CONTINUE C C============================================================================= C C This 'device' writes a binary vector file to be used with C raster printers, along with program RASTER. C C A binary file is written (to logical unit LUNGRP) with one integer C and two reals (IMODE,X,Y) per record. C C============================================================================= C JDEV = JDEV - 1 IF (JDEV .NE. 0) GOTO 89 C IF ((IMODE .LT. -5) .OR. (IMODE .GT. 7)) RETURN GOTO (10,20,30,90,90,50,50,50,50,50,50,60,50) IMODE + 6 C C mode -5: do this device exist? C 10 X = 1.0 GOTO 90 C C mode -4: initialize - open the output file C 20 CALL ASSIGN(LUNGRP,'SY0:') ! make sure we're looking good CALL CLOSE(LUNGRP) OPEN (UNIT=LUNGRP,NAME=GDDEV0,TYPE='NEW',FORM='UNFORMATTED', 1 ACCESS='SEQUENTIAL') GOTO 90 C C mode -3: return 'screen' size C 30 X = 160. ! make up a number Y = 11.2 GOTO 90 C C modes -4,0,1,2,3,4,5,7: pass all into the file C 50 WRITE (LUNGRP) IMODE,XT,YT IF (IMODE .EQ. 4) CALL CLOSE (LUNGRP) ! finish, if done IF (IMODE .NE. 5) GOTO 90 NIBS = X LINPAT = Y GOTO 90 C C mode 6: identify yourself C 60 WRITE (LUN,70) 70 FORMAT('+ Binary Vector List') GOTO 90 C C all done with this device - send us on to the next C 89 CONTINUE