home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / mbug / mbug120.arc / PASCAL.LBR / TURGRAF.DOC < prev    next >
Text File  |  1979-12-31  |  4KB  |  113 lines

  1.  
  2.               Turbo Pacsal Simple Graphics Package
  3.               ====================================
  4.  
  5.                                    By Phil Parton, 1985.
  6.  
  7. Description
  8. -----------
  9.      Thi≤ i≤ ß simplσ graphic≤ package¼á containinτ ß barσ miniuφ ì
  10. oµá routine≤ requireΣ t∩ producσ graphics¼á fo≥ Turb∩ Pascal«á I⌠ ì
  11. currentl∙á support≤ onl∙ onσ device¼á TURGRAF¼á whicΦ drive≤á thσ ì
  12. Microbeσá 24x8░ screen«á I⌠ i≤ no⌠ Microbeσ dependen⌠á anΣá othe≥ ì
  13. devicσ drive≥ caε easil∙ bσ added¼ althougΦ tha⌠ depend≤ somewha⌠ ì
  14. on the device. If you want more information please contact me.
  15.  
  16.      TURGRA╞á i≤á designeΣ t∩ bσ INCLUDEΣ iε thσ user'≤á program¼ ì
  17. thσá codσ i≤ no⌠ wel∞ documented¼á I'φ laz∙ bu⌠ wil∞ bσ happ∙á t∩ ì
  18. supply any information.
  19.  
  20. Using TurboPcg with TurGraf
  21. ---------------------------
  22.      Turgraµá make≤á call≤ t∩ thσ TurboPcτ procedurσá SetPixel()¼ ì
  23. botΦ file≤ arσ designeΣ a≤ Includσ files¼á bu⌠ Turb∩ onl∙á allow≤ ì
  24. includσá directive≤ t∩ bσ nesteΣ t∩ onσ level«á Hencσ reaΣá (^kr⌐ ì
  25. Turbopcτá int∩ Turgraµ betweeε thσ declaratioε statement≤ anΣ thσ ì
  26. first procedure then include the whole lot in you program.
  27.  
  28. The Routines
  29. ------------
  30.      Thσ packagσ work≤ witΦ ß sor⌠ oµ imaginar∙ pen¼á meaninτ thσ ì
  31. packagσá keep≤ ß tracδ oµ you≥ curren⌠ peε locatioε anΣá yo⌡á caε ì
  32. eithe≥á cal∞á MoveTo(x,y⌐á t∩ changσ thi≤ t∩ positioεá (x,y⌐á or¼ ì
  33. DrawTo(X,Y⌐ t∩ dra≈ ß linσ froφ thσ curren⌠ positioε t∩ (x,y⌐ anΣ ì
  34. set (x,y) as your current position.
  35.  
  36. Thi≤ i≤ ß shor⌠ lis⌠ oµ thσ function≤ provided¼á followeΣ b∙ somσ ì
  37. examples.
  38.  
  39. 1) OPENGRAF(Device,Wx1,Wy1,Wx2,Wy2);
  40.  
  41. Thi≤á initilize≤á thσ graphic≤ anΣ thσ selecteΣá devicσá anΣ ì
  42. sets the window coordinates.
  43. Arguments:
  44.      Device: Type DeviceType
  45.      Wx1,Wx2,Wy1,Wy2: Real.
  46. All arguments are passed by value so constants are allowed.
  47.  
  48. 2) SetViewPort(Vx1,Vy1,Vx2,Vy2); 
  49.  
  50. Thi≤ select≤ wherσ oε thσ devicσ yo⌡ wan⌠ thσ picturσ t∩á appear¼ ì
  51. wherσá (Vx1,Vy1⌐á i≤ thσ lowe≥ lef⌠ hanΣ corne≥ oµá thσá selecteΣ ì
  52. areß anΣ (Vx2,Vy2⌐ i≤ thσ uppe≥ righ⌠ hanΣ corner«á Al∞ line≤ arσ ì
  53. clippeΣá s∩ tha⌠ onl∙ section≤ withiε thi≤ areß arσ plotted«á Thσ ì
  54. vie≈ por⌠ default≤ t∩ thσ maxiuφ possiblσ areß oε thσ device« Thσ ì
  55. arguments must be in device coordinates.
  56.  
  57. Argument≤á arσá al∞ intege≥ passeΣ b∙á value¼á s∩á constant≤á arσ ìèallowed. Note the values must be such that Vx1<Vx2 and Vy1<Vy2.
  58.  
  59. 3) SetWindow(Wx1,Wy1,Wx2,Wy2);
  60.  
  61. Thi≤á map≤á ß use≥ coordinatσ systeφ ove≥ thσ devicσá vie≈á port« ì
  62. (Wx1,Wy1⌐á map≤ oε t∩ thσ lowe≥ lef⌠ hanΣ corne≥ oµ thσá viewpor⌠ ì
  63. anΣá (Wx2,Wy2⌐ oε thσ uppe≥ right«á Yo⌡ mus⌠ specif∙ ß windo≈á iε ì
  64. thσá OpenGraµ routinσ bu⌠ thi≤ caε bσ changeΣ durinτ graphic≤á iµ ì
  65. you like. 
  66.  
  67. Arguments: All real and passed by value hence constants allowed.
  68.  
  69. 4) MoveTo(x,y); 
  70.  
  71. Thi≤ change≤ thσ curren⌠ peε locatioε t∩ (x,y)«á (x,y⌐ arσ iε thσ ì
  72. user coordinate system.
  73.  
  74. Arguments: All real, constants allowed.
  75.  
  76. 5) DrawTo(x,y);
  77.  
  78. Draw≤á ßá linσá froφ thσ curren⌠ peε positioε t∩ (x,y⌐á anΣá set≤ ì
  79. (x,y⌐á a≤á thσá curren⌠á peε location«á (x,y⌐á arσá iεá thσá use≥ ì
  80. coordinate system.
  81.  
  82. Arguments: All real, constants allowed.
  83.  
  84. Example:
  85. --------
  86.  
  87. {Ini⌠ graphics¼á selectinτ thσ TURBOPC╟ microbeσ screeε drive≥ a≤ ì
  88. thσáá outpu⌠áá anΣáá se⌠á use≥á coordinate≤á t∩á aεáá areßáá witΦ ì
  89. (10..20,10..20⌐ }
  90. OpenGraf(Microbee,10,10,20,20);
  91.  
  92. {Set the viewport the upper half of the screen, on the microbee}
  93. SetViewPort(0,132,639,263);
  94.  
  95. MoveTo(10,10); {set pen position}
  96.  
  97. {now draw a box around the viewport}
  98. DrawTo(10,20);
  99. DrawTo(20,20);
  100. DrawTo(20,10);
  101. DrawTo(10,10);
  102.  
  103.  
  104. Good Luck!
  105. ----------
  106.  
  107.      Therσá arσá heap≤á oµá routine≤ tha⌠ caε bσá addeΣá t∩á thi≤ ì
  108. package¼ hopefull∙ yo⌡ wil∞ writσ somσ anΣ pu⌠ theφ oε thσ RCPMs.
  109.      ╔ founΣ onσ booδ ver∙ helpfu∞ oε graphic≤ theory¼ Principle≤ ì
  110. of Interactive Computer Graphics by W.M. Newman and R.F Sproull,
  111. McGraw-Hill International Book Company.
  112.  
  113.                               Phil Parton.