home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug120.arc
/
PASCAL.LBR
/
TURGRAF.DOC
< prev
next >
Wrap
Text File
|
1979-12-31
|
4KB
|
113 lines
Turbo Pacsal Simple Graphics Package
====================================
By Phil Parton, 1985.
Description
-----------
Thi≤ i≤ ß simplσ graphic≤ package¼á containinτ ß barσ miniuφ ì
oµá routine≤ requireΣ t∩ producσ graphics¼á fo≥ Turb∩ Pascal«á I⌠ ì
currentl∙á support≤ onl∙ onσ device¼á TURGRAF¼á whicΦ drive≤á thσ ì
Microbeσá 24x8░ screen«á I⌠ i≤ no⌠ Microbeσ dependen⌠á anΣá othe≥ ì
devicσ drive≥ caε easil∙ bσ added¼ althougΦ tha⌠ depend≤ somewha⌠ ì
on the device. If you want more information please contact me.
TURGRA╞á i≤á designeΣ t∩ bσ INCLUDEΣ iε thσ user'≤á program¼ ì
thσá codσ i≤ no⌠ wel∞ documented¼á I'φ laz∙ bu⌠ wil∞ bσ happ∙á t∩ ì
supply any information.
Using TurboPcg with TurGraf
---------------------------
Turgraµá make≤á call≤ t∩ thσ TurboPcτ procedurσá SetPixel()¼ ì
botΦ file≤ arσ designeΣ a≤ Includσ files¼á bu⌠ Turb∩ onl∙á allow≤ ì
includσá directive≤ t∩ bσ nesteΣ t∩ onσ level«á Hencσ reaΣá (^kr⌐ ì
Turbopcτá int∩ Turgraµ betweeε thσ declaratioε statement≤ anΣ thσ ì
first procedure then include the whole lot in you program.
The Routines
------------
Thσ packagσ work≤ witΦ ß sor⌠ oµ imaginar∙ pen¼á meaninτ thσ ì
packagσá keep≤ ß tracδ oµ you≥ curren⌠ peε locatioε anΣá yo⌡á caε ì
eithe≥á cal∞á MoveTo(x,y⌐á t∩ changσ thi≤ t∩ positioεá (x,y⌐á or¼ ì
DrawTo(X,Y⌐ t∩ dra≈ ß linσ froφ thσ curren⌠ positioε t∩ (x,y⌐ anΣ ì
set (x,y) as your current position.
Thi≤ i≤ ß shor⌠ lis⌠ oµ thσ function≤ provided¼á followeΣ b∙ somσ ì
examples.
1) OPENGRAF(Device,Wx1,Wy1,Wx2,Wy2);
Thi≤á initilize≤á thσ graphic≤ anΣ thσ selecteΣá devicσá anΣ ì
sets the window coordinates.
Arguments:
Device: Type DeviceType
Wx1,Wx2,Wy1,Wy2: Real.
All arguments are passed by value so constants are allowed.
2) SetViewPort(Vx1,Vy1,Vx2,Vy2);
Thi≤ select≤ wherσ oε thσ devicσ yo⌡ wan⌠ thσ picturσ t∩á appear¼ ì
wherσá (Vx1,Vy1⌐á i≤ thσ lowe≥ lef⌠ hanΣ corne≥ oµá thσá selecteΣ ì
areß anΣ (Vx2,Vy2⌐ i≤ thσ uppe≥ righ⌠ hanΣ corner«á Al∞ line≤ arσ ì
clippeΣá s∩ tha⌠ onl∙ section≤ withiε thi≤ areß arσ plotted«á Thσ ì
vie≈ por⌠ default≤ t∩ thσ maxiuφ possiblσ areß oε thσ device« Thσ ì
arguments must be in device coordinates.
Argument≤á arσá al∞ intege≥ passeΣ b∙á value¼á s∩á constant≤á arσ ìèallowed. Note the values must be such that Vx1<Vx2 and Vy1<Vy2.
3) SetWindow(Wx1,Wy1,Wx2,Wy2);
Thi≤á map≤á ß use≥ coordinatσ systeφ ove≥ thσ devicσá vie≈á port« ì
(Wx1,Wy1⌐á map≤ oε t∩ thσ lowe≥ lef⌠ hanΣ corne≥ oµ thσá viewpor⌠ ì
anΣá (Wx2,Wy2⌐ oε thσ uppe≥ right«á Yo⌡ mus⌠ specif∙ ß windo≈á iε ì
thσá OpenGraµ routinσ bu⌠ thi≤ caε bσ changeΣ durinτ graphic≤á iµ ì
you like.
Arguments: All real and passed by value hence constants allowed.
4) MoveTo(x,y);
Thi≤ change≤ thσ curren⌠ peε locatioε t∩ (x,y)«á (x,y⌐ arσ iε thσ ì
user coordinate system.
Arguments: All real, constants allowed.
5) DrawTo(x,y);
Draw≤á ßá linσá froφ thσ curren⌠ peε positioε t∩ (x,y⌐á anΣá set≤ ì
(x,y⌐á a≤á thσá curren⌠á peε location«á (x,y⌐á arσá iεá thσá use≥ ì
coordinate system.
Arguments: All real, constants allowed.
Example:
--------
{Ini⌠ graphics¼á selectinτ thσ TURBOPC╟ microbeσ screeε drive≥ a≤ ì
thσáá outpu⌠áá anΣáá se⌠á use≥á coordinate≤á t∩á aεáá areßáá witΦ ì
(10..20,10..20⌐ }
OpenGraf(Microbee,10,10,20,20);
{Set the viewport the upper half of the screen, on the microbee}
SetViewPort(0,132,639,263);
MoveTo(10,10); {set pen position}
{now draw a box around the viewport}
DrawTo(10,20);
DrawTo(20,20);
DrawTo(20,10);
DrawTo(10,10);
Good Luck!
----------
Therσá arσá heap≤á oµá routine≤ tha⌠ caε bσá addeΣá t∩á thi≤ ì
package¼ hopefull∙ yo⌡ wil∞ writσ somσ anΣ pu⌠ theφ oε thσ RCPMs.
╔ founΣ onσ booδ ver∙ helpfu∞ oε graphic≤ theory¼ Principle≤ ì
of Interactive Computer Graphics by W.M. Newman and R.F Sproull,
McGraw-Hill International Book Company.
Phil Parton.