HTBasic Help
×
Menu
Index

GESCAPE Example

10    CALL Code1
20    CALL Code2
30    CALL Code3
40    CALL Code4_5
50    CALL Code6
60    CALL Code102
70    CALL Code103
80  ! CALL Code104
90    CALL Code106
100   CALL Code130
110   CALL Code131
120   CALL Code132
130   CALL Code135
140   CALL Code138
150   CALL Code137
160   CALL Code141
170   CALL Code30
180   CALL Code31
190   CALL Code32
200   CALL Code33
210   CALL Code34
220   CALL Code35
230   CALL Code36
240   CALL Code37
250   CALL Code38
260   CALL Code39
270   CALL Code41
280   END
290   !
300   ! Gescape code 1 returns the number of color map entries.
310   ! A typical computer will return 256 as the answer.
320   !
330   SUB Code1
340     INTEGER A_return(0)
350     GESCAPE CRT,1;A_return(*)
360     PRINT "There are";A_return(0);"color map entries."
370     WAIT 2
380     CLEAR SCREEN
390   SUBEND
400   !
410   ! Gescape code 2 returns color map values. For example, the first
420   ! row of the array contains information for pen 0, the second
430   ! for pen 1, and so on. The first column of the array is the
440   ! red value, the second green, and the third blue.
450   !
460   SUB Code2
470     REAL B_return(15,2)
480     GESCAPE CRT,2;B_return(*)
490     PRINT "PEN","RED","GREEN","BLUE"
500     FOR I=0 TO 15
510       PRINT I,DROUND(B_return(I,0),1),DROUND(B_return(I,1),1),DROUND(B_return(I,2),1)
520     NEXT I
530     WAIT 2
540     CLEAR SCREEN
550   SUBEND
560   !
570   ! Gescape code 3 returns the hard-clip values and GSTORE array size.
580   ! The return array must be a one dimensional INTEGER array and must
590   ! contain at least four elements. The first four elements of the array
600   ! are assigned the values Xmin, Ymin, Xmax, and Ymax. For a CRT, the fifth
610   ! and sixth elements give the INTEGER array dimensions needed by the GSTORE
620   ! command to store the screen image.
630   !
640   SUB Code3
650     INTEGER C_return(5)
660     GESCAPE CRT,3;C_return(*)
670     PRINT "Xmin","Ymin","Xmax","Ymax","Rows","Columns"
680     PRINT C_return(0),C_return(1),C_return(2),C_return(3),C_return(4),C_return(5)
690     WAIT 2
700     CLEAR SCREEN
710   SUBEND
720   !
730   ! Gescape codes 4 and 5 change the graphics writing mode. If the code is 4,
740   ! the drawing mode is set to normal. If the code is 5, the drawing mode
750   ! is set to alternate. See the Users Guide for specific information.
760   !
770   SUB Code4_5
780     GESCAPE CRT,5  !Set to alternate drawing mode.
790     GESCAPE CRT,4  !Set to normal drawing mode.
800   SUBEND
810   !
820   ! Gescape code 6 returns the graphics display mask. The return array must be a
830   ! one dimensional INTEGER array, and must have at least one element. The first
840   ! element is assigned the value of the graphics write-enable mask. The second
850   ! element, if present, is assigned the value of the graphics display enable mask.
860   !
870   SUB Code6
880     INTEGER D_return(1)
890     GESCAPE CRT,6;D_return(*)
900     PRINT "Graphics write enable mask :";D_return(0)
910     PRINT "Graphics display enable mask :";D_return(1)
920     WAIT 2
930     CLEAR SCREEN
940   SUBEND
950   !
960   ! Gescape code 102 returns the current VIEWPORT and WINDOW values. The return
970   ! array should be a two dimensional REAL array with two rows and four columns.
980   !
990   SUB Code102
1000    REAL W(1,3)
1010    GESCAPE CRT,102;W(*)
1020    PRINT "The current window is  ";W(0,0),W(0,1),W(0,2),W(0,3)
1030    PRINT "The current viewport is";W(1,0),W(1,1),W(1,2),W(1,3)
1040    WAIT 2
1050    CLEAR SCREEN
1060  SUBEND
1070  !
1080  ! Gescape code 103 returns the current PEN and AREA PEN assignments. The return
1090  ! array should be a one dimensional INTEGER array with two elements. The first
1100  ! element is assigned the current PEN assignment. The second element is assigned the
1110  ! current AREA PEN assignment.
1120  !
1130  SUB Code103
1140    INTEGER P(1)
1150    GESCAPE CRT,103;P(*)
1160    PRINT "The current      PEN is";P(0)
1170    PRINT "The current AREA PEN is";P(1)
1180    WAIT 2
1190    CLEAR SCREEN
1200  SUBEND
1210  !
1220  ! Gescape code 104 sets device-specific information. The param array must be a one
1230  ! dimensional INTEGER array. The number of elements required depends on the device
1240  ! driver. Conventionally, it contains two elements. The first element is the operation
1250  ! number and the second element is the value associated with that operation.
1260  !
1270  SUB Code104
1280    INTEGER Param(1)
1290    Param(0)=1     !HPGL Operation Number: 1 = HPGL/2 Flag
1300    Param(1)=1     !Value: 1=enable, 0=disable
1310    GESCAPE 7,104,Param(*) !7 is the ISC. You can use any ISC.
1320  SUBEND
1330  !
1340  ! Gescape code 105 sets device-specific information in the GRAPHICS INPUT IS device.
1350  ! It is the same as the gescape code 104 shown above. The only difference is that you
1360  ! are sending codes specific for the GRAPHICS INPUT IS device you are using.
1370  !
1380  !
1390  ! Gescape code 106 sets device-specific information in the DUMP DEVICE IS device.
1400  ! The param array must be a one dimensional INTEGER array. The number of elements
1410  ! required depends on the device driver. The first element is the operation
1420  ! number and the subsequent elements are the values associated with that
1430  ! operation.
1440  !
1450  SUB Code106
1460  PAUSE
1470    INTEGER A(1:5)
1480    CONTROL 26,102;2
1490    CONFIGURE DUMP TO "PCL"
1500    DUMP DEVICE IS 26
1510    A(1)=1   ! operation code, always 1
1520    A(2)=100 ! begin row, screen units
1530    A(3)=300 ! end row, screen units
1540    A(4)=0   ! reserved, must be 0
1550    A(5)=0   ! reserved, must be 0
1560    GESCAPE 26,106,A(*)
1570    FRAME
1580    MOVE 0,0
1590    DRAW 100,100
1600    DUMP GRAPHICS
1610  SUBEND
1620  !
1630  ! Gescape code 130 maximizes the Basic child window.
1640  !
1650  SUB Code130
1660    GESCAPE CRT,130
1670    WAIT 2
1680  SUBEND
1690  !
1700  ! Gescape code 131 hides the Basic child window.
1710  !
1720  SUB Code131
1730    PRINT "The Basic child window will now be hidden."
1740    WAIT 2
1750    GESCAPE CRT,131
1760    WAIT 2
1770  SUBEND
1780  !
1790  ! Gescape code 132 restores the Basic child window once it has been hidden.
1800  !
1810  SUB Code132
1820    GESCAPE CRT,132
1830    PRINT "The Basic child window has been restored."
1840    WAIT 2
1850  SUBEND
1860  !
1870  ! Gescape code 135 brings the Basic child window to the top.
1880  !
1890  SUB Code135
1900    GESCAPE CRT,135
1910    WAIT 2
1920  SUBEND
1930  !
1940  ! Gescape code 138 Hides/Restores the title bar of the child window.
1950  !
1960  SUB Code138
1970    GESCAPE CRT,138
1980    PRINT "The title bar has been hidden."
1990    WAIT 2
2000    GESCAPE CRT,138
2010    PRINT "The title bar has been restored."
2020    CLEAR SCREEN
2030  SUBEND
2040  !
2050  ! Gescape 137 returns the Title Bar enable flag of the child window.
2060  !
2070  SUB Code137
2080    INTEGER X(0)
2090    GESCAPE CRT,138
2100    GESCAPE CRT,137;X(*)
2110    DISP "The Title Bar enable flag is";X(*);"with the Title Bar hidden."
2120    GESCAPE CRT,138
2130    WAIT 2
2140    GESCAPE CRT,137;X(*)
2150    PRINT "The Title Bar enable flag is";X(*);"with the Title Bar restored."
2160    WAIT 2
2170    CLEAR SCREEN
2180  SUBEND
2190  !
2200  ! Gescape code 141 minimizes the Basic child window.
2210  !
2220  SUB Code141
2230    GESCAPE CRT,141
2240    WAIT 2
2250    GESCAPE CRT,130
2260  SUBEND
2270  !
2280  ! Gescape code 30 maximizes the Basic parent window.
2290  !
2300  SUB Code30
2310    GESCAPE CRT,30
2320    PRINT "The parent window is maximized."
2330    WAIT 2
2340    CLEAR SCREEN
2350  SUBEND
2360  !
2370  ! Gescape code 31 hides the Basic parent window.
2380  !
2390  SUB Code31
2400    PRINT "The parent window will now be hidden."
2410    WAIT 2
2420    GESCAPE CRT,31
2430    WAIT 2
2440  SUBEND
2450  !
2460  ! Gescape code 32 restores the Basic parent window once it has been hidden.
2470  !
2480  SUB Code32
2490    GESCAPE CRT,32
2500    PRINT "The parent window has been restored."
2510    WAIT 2
2520    CLEAR SCREEN
2530  SUBEND
2540  !
2550  ! Gescape code 33 is used to set the parent window position and size.
2560  !
2570  SUB Code33
2580    INTEGER Set(1:4)
2590    DATA 90,100,500,300
2600    READ Set(*)
2610    GESCAPE CRT,33,Set(*)
2620    PRINT "The parent window is now at position";Set(1);",";Set(2)
2630    PRINT "Its width is";Set(3);"and its height is";Set(4)
2640    WAIT 2
2650    GESCAPE CRT,41
2660    GESCAPE CRT,30
2670    WAIT 2
2680    CLEAR SCREEN
2690  SUBEND
2700  !
2710  ! Gescape code 34 gets the parent window position and size.
2720  !
2730  SUB Code34
2740    INTEGER Get(1:4)
2750    GESCAPE CRT,34;Get(*)
2760    PRINT "The parent window is located at";Get(1);",";Get(2)
2770    PRINT "Its width is";Get(3);"and its height is";Get(4)
2780    WAIT 2
2790    CLEAR SCREEN
2800  SUBEND
2810  !
2820  ! Gescape code 35 brings the parent window back to the top of the screen.
2830  !
2840  SUB Code35
2850    GESCAPE CRT,35
2860    WAIT 2
2870  SUBEND
2880  !
2890  ! Gescape code 36 gets the screen size.
2900  !
2910  SUB Code36
2920    INTEGER G(1:2)
2930    GESCAPE CRT,36;G(*)
2940    PRINT "The screen dimensions are";G(1);"by";G(2)
2950    WAIT 2
2960    CLEAR SCREEN
2970  SUBEND
2980  !
2990  ! Gescape code 37 returns the Title Bar enable flag of the parent window.
3000  !
3010  SUB Code37
3020    INTEGER X(0)
3030    GESCAPE CRT,38
3040    GESCAPE CRT,37;X(*)
3050    PRINT "The Title Bar enable flag is";X(*);"with the Title Bar hidden."
3060    WAIT 2
3070    GESCAPE CRT,38
3080    GESCAPE CRT,37;X(*)
3090    PRINT "The Title Bar enable flag is";X(*);"with the Title Bar restored."
3100    WAIT 2
3110    CLEAR SCREEN
3120  SUBEND
3130  !
3140  ! Gescape code 38 Hides/Restores the Title Bar of the parent window.
3150  !
3160  SUB Code38
3170    GESCAPE CRT,38
3180    PRINT "The title bar has been hidden."
3190    WAIT 2
3200    GESCAPE CRT,38
3210    PRINT "The title bar has been restored."
3220    WAIT 2
3230    CLEAR SCREEN
3240  SUBEND
3250  !
3260  ! Gescape code 39 sets the DUMP size (% of paper width).
3270  !
3280  SUB Code39
3290    INTEGER S(1:1)
3300    S(1)=50
3310    GESCAPE CRT,39,S(*)
3320    DUMP DEVICE IS 10
3330    CONFIGURE DUMP TO "WIN-DUMP"
3340    DUMP GRAPHICS
3350  SUBEND
3360  !
3370  ! Gescape code 41 minimizes the parent window.
3380  !
3390  SUB Code41
3400    GESCAPE CRT,41
3410    WAIT 2
3420    GESCAPE CRT,32
3430  SUBEND