GESCAPESends device-specific information to a graphic device.
Description:
GESCAPE exchanges device-specific data with a graphic device. The code parameter determines what operation will be done. The param array sends information to the device. The return array receives information from the device. The type, size and shape of the arrays must be appropriate for the requested operation. Codes greater than 99 are extensions to HTBasic which are not present in HP BASIC. Codes in the range 30 to 41 apply to the Windows version only.
Code 1Return the number of color map entries. The return array must be a one dimensional INTEGER array and have at least one element. The first element is assigned the number of color map entries.
Code 2Return the color map values. The return array must be a two dimensional REAL array, must have at least one row, and must have three columns. The first row contains color information for pen 0, second row for pen 1, etc. If the array does not have enough rows or has too many rows, no error is reported. The first column contains the information for red, the second for green and the third for blue. The color information ranges in value from zero to one. Color values are multiples of 1/N, where N is the number of non-black shades available for each color.
Code 3Return the hard-clip values. The values are returned in plotter units or pixels. The return array must be a one dimensional INTEGER array and must contain at least four elements. The first four elements of the array are assigned the values, X min, Y min, X max, Y max, respectively. For a CRT, the fifth and sixth elements give the INTEGER array dimensions needed by the GSTORE command to store the screen image. For example:
10 INTEGER A(1:6)
20 GESCAPE CRT,3;A(*)
30 ALLOCATE INTEGER B(1:A(5),1:A(6))
40 GSTORE B(*)
Code 4Set normal drawing mode. Drawing in normal drawing mode with a positive pen number sets each pixel to the pen number. Drawing in normal mode with a negative pen number takes the value of each pixel and clears the bits associated with the pen value. On monochrome displays, the drawing mode is always normal so GESCAPE 4 and 5 are not supported.
Code 5Set alternate drawing mode. Drawing in alternate mode with positive pen numbers performs an inclusive OR on the pen value and the color-map entry number at each pixel. Drawing in alternate mode with negative pen numbers, performs an exclusive OR on the pen value and the color-map entry number at each pixel. On monochrome displays, the drawing mode is always normal so GESCAPE 4 and 5 are not supported.
Code 6Return the graphic display masks. The return array must be a one dimensional INTEGER array and must have at least one element. The first element is assigned the value of the graphics write-enable mask. The second element, if present, is assigned the value of the graphics display-enable mask. Each bit in the mask corresponds to one of the bit planes. Bit 0 corresponds to the first plane.
Code 7
Set the graphic display masks. The param array must be a one dimensional INTEGER array and must have at least one element. The first element is assigned to the graphics write-enable mask. The second element, if present, is assigned to the graphics display-enable mask. This code is not supported by HTBasic. Often, where operation code 7 is used, MERGE or SEPARATE ALPHA can be used instead.
Window ManipulationSeveral GESCAPE codes allow manipulation of the HTBasic windows.
The following GESCAPE CRT codes have been added for manipulation of the program window.
The following GESCAPE CRT codes have been added for manipulation of the program child window.
The following example shows the syntax for several of the GESCAPES. Note that codes that set information have a comma before the array name while codes that get information have a semicolon.
INTEGER Get4(1:4),Set4(1:4),Get2(1:2),Set1(1:1)
DATA 90,100,500,300 ! Position of upper left corner:
! 90,100), Width = 500, Height = 300
READ Set4(*)
GESCAPE CRT,30 ! Maximize the window
GESCAPE CRT,31 ! Hide the window
GESCAPE CRT,32 ! Restore the window
ESCAPE CRT,33,Set4(*) ! Set position and size: X,Y,W,H
GESCAPE CRT,34;Get4(*) ! Get position and size: X,Y,W,H
GESCAPE CRT,35 ! Bring the window to the top
GESCAPE CRT,36;Get2(*) ! Get the screen size: W,H
GESCAPE CRT,37;Get3(*) ! Get the title bar enable flag
PRINT Get(2) ! Print the Screen Size
PRINT Get(3) ! Print the title bar enable flag
Set1(1)=50 ! Set the DUMP size to 50%
GESCAPE CRT,38 ! Hide window Title Bar
GESCAPE CRT,38 ! Restore window Title Bar
Set (1)=50 ! Set the DUMP size to 50%
GESCAPE CRT,39,Set1(*) ! Set the DUMP size (default is 100%)
GESCAPE CRT,41 ! Minimize the window
GESCAPE CRT,32 ! Restore the window
END
Code 103Returns the current PEN and AREA PEN assignments. The return array should be a one dimensional INTEGER array with two elements. The first element is assigned the current PEN assignment. The second element is assigned the current AREA PEN assignment. The following program demonstrates this capability:
10 INTEGER P(1)
20 GESCAPE CRT,103;P(*)
30 PRINT "The current PEN is";P(0)
40 PRINT "The current AREA PEN is";P(1)
50 END
Code 104Sets device-specific information in the PLOTTER IS device. The param array must be a one dimensional INTEGER array. The number of elements required depends on the device driver. The first element is the operation number and the subsequent elements are the values associated with that operation.
For the HPGL plotter driver, code 104, operation 1 is used to enable HPGL/2 capabilities. When HPGL/2 is used, polygons are sent to the plotter for rendering. With many plotting devices, this allows the polygons to be filled. When generating an HPGL file for import into other programs, it is often more desirable for the polygon to import as a single unit, rather than a series of lines. To enable HPGL/2, use the following code. Substitute the ISC for the HPGL plotter in place of Isc in line 40.
10 INTEGER Param(1)
20 Param(0)=1 ! HPGL Operation Number: 1 = HPGL/2 Flag
30 Param(1)=1 ! Value: 1=enable, 0=disable
40 GESCAPE Isc,104,Param(*)
Code 105Sets device-specific information in the GRAPHICS INPUT IS device. The param array must be a one dimensional INTEGER array. The number of elements required depends on the device driver. The first element is the operation number and the subsequent elements are the values associated with that operation.
Code 106Sets device-specific information in the DUMP DEVICE IS device. The param array must be a one dimensional INTEGER array. The number of elements required depends on the device driver. The first element is the operation number and the subsequent elements are the values associated with that operation.
For the dump drivers, code 106, operation 1 is used to specify a portion of the screen to dump when DUMP GRAPHICS is executed. The syntax is:
GESCAPE PRT,106,param(*)
The param array must be a one dimensional INTEGER array of five elements. The first element is the operation number. The remaining elements specify the boundary for the DUMP. The boundary is specified in screen units:
param(1) - 1
param(2) - Beginning row
param(3) - Ending row
param(4) - Must be 0
param(5) - Must be 0
The CONFIGURE DUMP, PLOTTER IS CRT,"INTERNAL", and GRAPHICS INPUT ISKBD,"KBD" statements reset the row parameters back to the defaults, full screen. The CONFIGURE DUMP statement must be executed before the GESCAPE statement. The following program demonstrates this capability:
10 INTEGER A(1:5)
20 DUMP DEVICE IS PRT
30 CONFIGURE DUMP TO "HP-PCL"
40 A(1)=1 ! operation code, always 1
50 A(2)=100 ! begin row, screen units
60 A(3)=300 ! end row, screen units
70 A(4)=0 ! reserved, must be 0
80 A(5)=0 ! reserved, must be 0
90 GESCAPE PRT,106,A(*)
100 FRAME
110 MOVE 0,0
120 DRAW 100,100
130 DUMP GRAPHICS
140 END
See Also:
|