

	SUBROUTINE GD????(IFXN,XA,YA)
	DIMENSION XA(8), YA(3)
C
C	SKELETON DIGLIB GRAPHICS DEVICE DRIVER
C
C-----------------------------------------------------------------------
C
C ARGUMENTS:
C
   INPUT

	IFXN		* TYPE: INTEGER CONSTANT OR VARIABLE.
			* THE GRAPHICS FUNCTION TO PERFORM:
			    1 ==> INITIALIZE THE GRAPHICS DEVICE TO PREPARE IT
				   FOR GRAPHICS (AND ON MULTI-USER SYSTEMS, TAKE

				   EXCLUSIVE CONTROL OF THE DEVICE.)
			    2 ==> OBTAIN A FRESH PLOTTING SURFACE ON THE
				   GRAPHICS DEVICE.
			    3 ==> MOVE TO A NEW POSITION (X,Y), WHERE THE UNITS
				   OF BOTH X AND Y ARE IN CENTIMETERS.
			    4 ==> DRAW A LINE TO THE POSITION (X,Y), WHERE THE
				   UNITS OF X AND Y ARE IN CENTIMETERS.
			    5 ==> TRANSMIT ANY BUFFERED GRAPHICS COMMANDS THAT
				   HAVE NOT YET BEEN TRANSMITTED TO THE
				   GRAPHICS DEVICE.
			    6 ==> RELEASE CONTROL OF THE GRAPHICS DEVICE.
			    7 ==> RETURN TO THE CALLER THE DEVICE
				   CHARACTERISTICS OF THIS DEVICE.
			    8 ==> SET THE CURRENT DRAWING COLOR.
			    9 ==> PERFORM A GRAPHICS INPUT WITH PICK CHARACTER
				   OPERATION, RETURNING THE USER SELECTED
				   LOCATION (X,Y) WITH X AND Y SPECIFIED IN
				   CENTIMETERS.
			   10 ==> SET THE VISUAL COLOR ASSOCIATED WITH A
				   SPECIFIED COLOR NUMBER TO THE RGB VALUE
				   PROVIDED.
			   11 ==> SET THE VISUAL COLOR ASSOCIATED WITH A
				   SPECIFIED COLOR NUMBER TO THE HLS VALUE
				   PROVIDED.
			1024+N==> DRAW FILLED POLYGON HAVING N SIDES.

	XA		* TYPE: REAL ARRAY.
			* DEPENDANT OF THE GRAPHICS FUNCTION GIVEN BY "IFXN".
			    1 ==> XA(1) IS RT-11 CHANNAL NUMBER ON WHICH
				   TO PERFORM I/O, OR RSX-11M LOGICAL UNIT
				   NUMBER ON WHICH TO PERFORM I/O.
				  XA(2) --> XA(7) UNUSED.
			    2 ==> XA(1) --> XA(7) UNUSED.
			    3 ==> XA(1) IS THE X COORDINATE IN CM. FOR THE
				   MOVE OPERATION.
				  XA(2) --> XA(7) UNUSED.
			    4 ==> XA(1) IS THE X COORDINATE IN CM. FOR THE
				   DRAW OPERATION.
				  XA(2) --> XA(7) UNUSED.
			    5 ==> XA(1) --> XA(7) UNUSED.
			    6 ==> XA(1) --> XA(7) UNUSED.
			    7 ==> XA(1) --> XA(7) UNUSED.
			    8 ==> XA(1) IS COLOR FOR SUBSEQUENT LINES.
				  XA(2) --> XA(7) UNUSED.
			    9 ==> XA(1) --> XA(7) UNUSED.
			   10 ==> XA(1) IS THE COLOR TO DEFINE.
			   11 ==> XA(1) IS THE COLOR TO DEFINE.
			   12 ==> XA(1) --> XA(7) UNUSED.
		       1024+N ==> XA(1) --> XA(N) X VERTICES OF POLYGON.

	YA		* TYPE: REAL ARRAY
			* DEPENDANT OF THE GRAPHICS FUNCTION GIVEN BY "IFXN".
			    1 ==> YA(1) IS THE ERROR FLAG FOR DEVICE SELECTION:
					 0 ==> NO ERRORS
					>0 ==> ERROR (DEVICE SPECIFIC)
				  YA(2) --> YA(3) UNUSED.
			    2 ==> YA(1) --> YA(3) UNUSED.
			    3 ==> YA(1) IS THE Y COORDINATE IN CM. FOR THE
				   MOVE OPERATION.
				  YA(2) --> YA(3) UNUSED.
			    4 ==> YA(1) IS THE Y COORDINATE IN CM. FOR THE
				   DRAW OPERATION.
				  YA(2) --> YA(3) UNUSED.
			    5 ==> YA(1) --> YA(3) UNUSED.
			    6 ==> YA(1) --> YA(3) UNUSED.
			    7 ==> YA(1) --> YA(3) UNUSED.
			    8 ==> YA(1) --> YA(3) UNUSED.
			    9 ==> YA(1) --> YA(3) UNUSED.
			   10 ==> YA(1) IS % RED COMPONENT OF COLOR.
				  YA(2) IS % GREEN COMPONENT OF COLOR.
				  YA(3) IS % BLUE COMPONENT OF COLOR.
			   11 ==> YA(1) IS THE HUE (0-360).
				  YA(2) IS THE LIGHTNESS (0-100).
				  YA(3) IS THE SATURATION (0-100).
			   12 ==> YA(1) --> YA(3) UNUSED.
		       1024+N ==> YA(1) --> YA(N) Y VERTICES OF POLYGON.

   OUTPUT

	XA		* TYPE: REAL ARRAY.
			* DEPENDANT OF THE GRAPHICS FUNCTION GIVEN BY "IFXN".
			    1 ==> XA(1) --> XA(7) UNUSED.
			    2 ==> XA(1) --> XA(7) UNUSED.
			    3 ==> XA(1) --> XA(7) UNUSED.
			    4 ==> XA(1) --> XA(7) UNUSED.
			    5 ==> XA(1) --> XA(7) UNUSED.
			    6 ==> XA(1) --> XA(7) UNUSED.
			    7 ==> XA(1) --> XA(7) ARE SET TO THIS DEVICES
				   CHARACTERISTIC WORDS:
				   XA(1) = DEVICE ID. (A UNIQUE DEVICE NUMBER
					   OBTAINED FROM HAL BRAND X26312.
				   XA(2) = X AXIS LENGTH OF THIS DEVICE IN CM.
				   XA(3) = Y AXIS LENGTH IN CM.
				   XA(4) = X AXIS RESOLUTION IN GRAPHICS UNITS
					   (GU) PER CENTIMETER.
				   XA(5) = Y AXIS RESOLUTION IN GU/CM.
				   XA(6) = NUMBER OF AVAILABLE FOREGROUND
					   COLORS ON THIS DEVICE.
				   XA(7) = DEVICE CHARACTERISTICS BITS.
					   THE SUM OF:
					      0 IF STROKE (PLOTTER) DEVICE.
					      1 IF RASTER DEVICE.
					      2 IF DVST (STORAGE TUBE)
					      3 PRINTER/PLOTTER
					      4 IF DRAWING IN THE BACKGROUND
						 COLOR (COLOR 0) IS AVAILABLE.
					      8	IF DEVICE IS A HARDCOPY DEVICE.
					     16	IF DEVICE IS A SHAREABLE
						 DEVICE.
					     32	DEVICE'S COLORS ARE HLS
						 SELECTABLE.
					     64	DEVICE'S COLORS ARE RGB
						 SELECTABLE.
					    128	GRAPHICS INPUT WITH "PICK
						 CHARACTER" IS AVAILABLE.
					    256 DEVICE DRAWS FILLED POLYGONS.
					    512 DEVICE REQUIRES CONVEX
						 POLYGONS.
					   1024	GRAPHICS INPUT WITH BUTTONS
						 IS AVAILABLE.
				  XA(8) = 1 + THE NUMBER OF SCAN LINES TO SKIP
					   WHILE DOING A SOFTWARE POLYGON FILL.
					   THIS VALUE IS USED TO TAKE ACCOUNT
					   OF THE FACT THAT PLOTTERS HAVE PENS
					   THAT ARE TYPICALLY MANY TIMES
					   THICKER THAN THE PLOTTER STEP SIZE.
					   THIS PARAMETER SHOULD BE ONE FOR
					   ALL RASTER DEVICES.   NOTE: FOR
					   BACKWARDS COMPATIBILITY,  THIS
					   VALUE IS DEFAULTED TO ONE, SO ANY
					   DRIVER THAT RETURNS ON THE FIRST 7
					   ARRAY ELEMENTS WILL GET THIS VALUE
					   SET TO 1.
			    8 ==> XA(1) = PICK CHARACTER FROM GRAPHICS DEVICE
					   OR FROM TERMINAL.
				  XA(2) = X COORDINATE SELECTED IN CM.
				  XA(3) = Y COORDINATE SELECTED IN CM.
				  XA(4) --> XA(7) UNUSED.
			    9 ==> XA(1) --> XA(7) UNUSED.
			   10 ==> XA(1) --> XA(7) UNUSED.
			   11 ==> XA(1) --> XA(7) UNUSED.
			   12 ==> XA(1) = BUTTON BITS FROM GRAPHICS DEVICE
				  XA(2) = X COORDINATE SELECTED IN CM.
				  XA(3) = Y COORDINATE SELECTED IN CM.
				  XA(4) --> XA(7) UNUSED.
		       1024+N ==> XA(1) --> XA(N) UNUSED.
.END LITERAL

C---------------------------------------------------------------------------
C
	DIMENSION DCHAR(8)
C
C	MAKE NICE NAMES FOR THE DEVICES RESOLUTION IN X AND Y
C	 ("XGUPCM" IS X GRAPHICS UNITS PER CENTIMETER)
C
	EQUIVALENCE (DCHAR(4),XGUPCM), (DCHAR(5),YGUPCM)
	DATA DCHAR /?,?,?,?,?,?,?,?/
C
C	FIRST VERIFY WE GOT A GRAPHICS FUNCTION WE CAN HANDLE
C
	IF (IFXN .LE. 0 .OR. IFXN .GT. 11) RETURN
C
C	NOW DISPATCH TO THE PROPER CODE TO HANDLE THAT FUNCTION
C
	GO TO (100,200,300,400,500,600,700,800,900,1000,1100) IFXN
C
C	*********************
C	INITIALIZE THE DEVICE
C	*********************
C
100	CONTINUE
	LUN = XA(1)	!RSX-11M
	ICHAN = XA(1)	!RT-11 USING RT-11 DRIVER
	.
	.
	.
	RETURN
C
C	**************************
C	GET FRESH PLOTTING SURFACE
C	**************************
C
200	CONTINUE
	.
	.
	.
	RETURN
C
C	****
C	MOVE
C	****
C
300	CONTINUE
	IX = XGUPCM*XA(1)+0.5	!CONVERT CM. TO GRAPHICS UNITS ROUNDED
	IY = YGUPCM*YA(1)+0.5
	.
	.
	.
	RETURN
C
C	****
C	DRAW
C	****
C
400	CONTINUE
	IX = XGUPCM*XA(1)+0.5	!CONVERT CM. TO GRAPHICS UNITS ROUNDED
	IY = YGUPCM*YA(1)+0.5
	.
	.
	.
	RETURN
C
C	*****************************
C	FLUSH GRAPHICS COMMAND BUFFER
C	*****************************
C
500	CONTINUE
	.
	.
	.
	RETURN
C
C	******************
C	RELEASE THE DEVICE
C	******************
C
600	CONTINUE
	.
	.
	.
	RETURN
C
C	*****************************
C	RETURN DEVICE CHARACTERISTICS
C	*****************************
C
700	CONTINUE
	DO 720 I=1,8
	XA(I) = DCHAR(I)
720	CONTINUE
	RETURN
C
C	****************************
C	SELECT CURRENT DRAWING COLOR
C	****************************
C
800	CONTINUE
	ICOLOR = XA(1)
	.
	.
	.
	RETURN
C
C	**********************
C	PERFORM GRAPHICS INPUT
C	**********************
C
900	CONTINUE
	.
	.
	.
	XA(1) = ICHAR	!PICK CHARACTER
	XA(2) = FLOAT(IX)/XGUPCM	!X IN CENTIMETERS.
	XA(3) = FLOAT(IY)/YGUPCM	!Y IN CM.
	RETURN
C
C	**********************
C	DEFINE COLOR USING RGB
C	**********************
C
1000	CONTINUE
	ICOLOR = XA(1)
C
C	ASSUME 8 BIT DACS ON ALL THREE COLOR GUNS WHERE:
C	   0 ==> NO INTENSITY
C	 255 ==> FULL INTENSITY
C
	IRED = 2.55*YA(1) + 0.5
	IGREEN = 2.55*YA(2) + 0.5
	IBLUE = 2.55*YA(3) + 0.5
	.
	.
	.
	RETURN
C
C	************************
C	DEFINE A COLOR USING HLS
C	************************
C
1100	CONTINUE
	ICOLOR = XA(1)
	IHUE = YA(1)
	ILIGHT = YA(2)
	ISATR = YA(3)
	.
	.
	.
	RETURN
	END

NESD2$ 