home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vrexx_2.zip / TESTDRAW.CMD < prev    next >
OS/2 REXX Batch file  |  1993-10-28  |  4KB  |  207 lines

  1. /* TESTDRAW.CMD */
  2.  
  3. '@echo off'
  4. call RxFuncAdd 'VInit', 'VREXX', 'VINIT'
  5. initcode = VInit()
  6. if initcode = 'ERROR' then signal CLEANUP
  7.  
  8. signal on failure name CLEANUP
  9. signal on halt name CLEANUP
  10. signal on syntax name CLEANUP
  11.  
  12. /* set up marker types */
  13.  
  14. default      = 0
  15. cross        = 1
  16. plus         = 2
  17. diamond      = 3
  18. square       = 4
  19. star6        = 5
  20. star8        = 6
  21. soliddiamond = 7
  22. solidsquare  = 8
  23. soliddot     = 9
  24. circle       = 10
  25.  
  26. /* set up line types */
  27.  
  28. solid      = 0
  29. dot        = 1
  30. dash       = 2
  31. dashdot    = 3
  32. dotdot     = 4
  33. longdash   = 5
  34. dashdotdot = 6
  35.  
  36. /* set up fill types */
  37.  
  38. nofill    = 0
  39. solidfill = 1
  40. horz      = 2
  41. vert      = 3
  42. leftdiag  = 4
  43. rightdiag = 5
  44.  
  45. /* create 2 windows for drawing some graphics */
  46.  
  47. win1.left   = 15
  48. win1.bottom = 30
  49. win1.right  = 55
  50. win1.top    = 70
  51. id1 = VOpenWindow('TESTDRAW.CMD Graphics Window 1', 'WHITE', win1)
  52.  
  53. win2.left   = 60
  54. win2.bottom = 10
  55. win2.right  = 95
  56. win2.top    = 40
  57. id2 = VOpenWindow('TESTDRAW.CMD Graphics Window 2', 'BLACK', win2)
  58.  
  59. /* draw a line graph in window 1 */
  60.  
  61. call VForeColor id1, 'BLACK'
  62.  
  63. x.1 = 100
  64. y.1 = 600
  65. x.2 = 400
  66. y.2 = 600
  67. call VDraw id1, 'LINE', x, y, 2         /* x axis */
  68. x.1 = 100
  69. y.1 = 600
  70. x.2 = 100
  71. y.2 = 900
  72. call VDraw id1, 'LINE', x, y, 2         /* y axis */
  73.  
  74. a = -0.000222   /* construct a quadratic polynomial */
  75. b = 0.861       /* Y = a*X*X + b*X + c */
  76. c = 566
  77.  
  78. x.1 = 100
  79. y.1 = a*100*100 + b*100 + c
  80. do i = 2 to 5
  81.    j = i - 1
  82.    x.i = x.j + 75
  83.    y.i = a * x.i * x.i + b * x.i + c
  84. end
  85.  
  86. call VDrawParms id1, soliddiamond, dashdot, default
  87. call VDraw id1, 'MARKER', x, y, 5
  88. call VDraw id1, 'LINE', x, y, 5
  89.  
  90. /* draw a set of arcs in window 2 */
  91.  
  92. call VForeColor id2, 'YELLOW'
  93.  
  94. cx = 100
  95. cy = 200
  96. radius = 20
  97. angle1 = 0
  98. angle2 = 60
  99.  
  100. do i = 1 to 6
  101.    call VArc id2, cx, cy, radius, angle1, angle2
  102.    radius = radius + 20
  103.    cx = cx + 150
  104.    angle2 = angle2 + 60
  105. end
  106.  
  107. /* draw a bar graph in window 1 */
  108.  
  109. call VDrawParms id1, default, default, default
  110. x.1 = 550
  111. y.1 = 600
  112. x.2 = 950
  113. y.2 = 600
  114. call VDraw id1, 'LINE', x, y, 2         /* x axis */
  115. x.1 = 550
  116. y.1 = 600
  117. x.2 = 550
  118. y.2 = 900
  119. call VDraw id1, 'LINE', x, y, 2         /* y axis */
  120.  
  121. px.1 = 600
  122. py.1 = 600
  123. px.2 = 600
  124. py.2 = 650
  125. px.3 = 650
  126. py.3 = 650
  127. px.4 = 650
  128. py.4 = 600
  129.  
  130. call VForeColor id1, 'RED'
  131. do i = 1 to 6
  132.    /* draw bar with a new fill type */
  133.  
  134.    call VDrawParms id1, default, solid, i-1
  135.    call VDraw id1, 'POLYGON', px, py, 4
  136.    call VDraw id1, 'LINE', px, py, 4
  137.  
  138.    px.1 = px.1 + 50
  139.    px.2 = px.1
  140.    px.3 = px.3 + 50
  141.    px.4 = px.3
  142.  
  143.    py.2 = py.2 + 45
  144.    py.3 = py.2
  145. end
  146.  
  147. /* draw some lines of different types in window 2 */
  148.  
  149. color.1 = 'WHITE'               /* set up color array */
  150. color.2 = 'RED'
  151. color.3 = 'GREEN'
  152. color.4 = 'BLUE'
  153. color.5 = 'CYAN'
  154. color.6 = 'YELLOW'
  155. color.7 = 'PINK'
  156.  
  157. x.1 = 200
  158. y.1 = 950
  159. x.2 = 800
  160. y.2 = 950
  161.  
  162. do i = 1 to 7
  163.    call VForeColor id2, color.i
  164.    call VDrawParms id2, default, i-1, default
  165.    call VDraw id2, 'LINE', x, y, 2
  166.  
  167.    y.1 = y.1 - 100
  168.    y.2 = y.1
  169. end
  170.  
  171. /* set up a spline in window 1, drawing the control points */
  172. /* of the spline as markers, and labelling them with text  */
  173.  
  174. sx.1 = 350
  175. sy.1 = 450
  176. sx.2 = 700
  177. sy.2 = 200
  178. sx.3 = 200
  179. sy.3 = 125
  180. sx.4 = 650
  181. sy.4 = 425
  182.  
  183. call VForeColor id1, 'BLUE'
  184. call VDrawParms id1, soliddot, default, default
  185. call VDraw id1, 'MARKER', sx, sy, 4
  186. call VDraw id1, 'SPLINE', sx, sy, 4
  187.  
  188. call VForeColor id1, 'GREEN'
  189. call VSetFont id1, 'HELVB', 12
  190. call VSay id1, 300, 75, 'Spline Control Points'
  191.  
  192. /* put up a message box */
  193.  
  194. msg.0 = 1
  195. msg.1 = 'Press OK to close the windows'
  196. call VMsgBox 'TESTDRAW.CMD', msg, 1
  197.  
  198. call VCloseWindow id1
  199. call VCloseWindow id2
  200.  
  201. /* end of CMD file */
  202.  
  203. CLEANUP:
  204.    call VExit
  205.  
  206. exit
  207.