GRAPH.LST 158 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101
  1. Listing:
  2. 1 (* Release 3.10 *)
  3. 2 (*-------------------------------------------------------------------------*
  4. 3 * *
  5. 4 * GRAPH.MOD - Graphics functions *
  6. 5 * *
  7. 6 * COPYRIGHT (C) 1987..1992 Clarion Software Corporation. *
  8. 7 * All Rights Reserved *
  9. 8 * *
  10. 9 *--------------------------------------------------------------------------*)
  11. 10
  12. 11 (*# call(o_a_copy => off) *)
  13. 12 (*%T _fcall *)
  14. 13 (*# call(seg_name => GRAPHICS) *)
  15. 14 (*%E *)
  16. 15 (*# module(implementation=>off) *)
  17. 16 (*%F _fdata *)
  18. 17 (*# data(seg_name => null) *)
  19. 18 (*%E *)
  20. 19 (*# check(stack=>off,
  21. 20 index=>off,
  22. 21 range=>off,
  23. 22 overflow=>off,
  24. 23 nil_ptr=>off) *)
  25. 24
  26. 25
  27. 26 IMPLEMENTATION MODULE Graph;
  28. 27
  29. 28 IMPORT Str,Lib,SYSTEM,Storage;
  30. 29 (*%T _XTD *)
  31. 30 IMPORT IO,TSXLIB;
  32. 31 FROM TSXLIB IMPORT SEL_A000H,SEL_B000H,SEL_B800H;
  33. ***** ^ duplicate identifier
  34. 32 CONST _XTDDOS = TRUE;
  35. 33 (*%E*)
  36. 34 (*%F _XTD *)
  37. 35 (*%F _OS2 *)
  38. 36 IMPORT IO;
  39. 37 CONST _XTDDOS = TRUE;
  40. 38 (*%E *)
  41. 39 (*%T _OS2 *)
  42. 40 (*%F _fcall *)
  43. 41 IMPORT IO;
  44. 42 (*%E *)
  45. 43 IMPORT Dos,Vio,GraphI,CoreGraph,CoreSig;
  46. 44 FROM Storage IMPORT ALLOCATE,DEALLOCATE;
  47. 45 CONST _XTDDOS = FALSE;
  48. 46 (*%E _OS2 *)
  49. 47 (*%E _XTD *)
  50. 48
  51. 49 (*%T _XTDDOS *)
  52. 50
  53. 51 (*%F _XTD *)
  54. 52 CONST
  55. 53 SEL_A000H = 0A000H;
  56. 54 SEL_B000H = 0B000H;
  57. 55 SEL_B800H = 0B800H;
  58. 56 (*%E*)
  59. 57
  60. 58 (*****************************************************************************)
  61. 59 (* Constant Definitions. *)
  62. 60 (*****************************************************************************)
  63. 61
  64. 62 CONST
  65. 63 HEADER_SIZE = 4;
  66. 64 FILL_MASK_SIZE = 8;
  67. 65 GRAPHICS = 1;
  68. 66 TEXT = 0;
  69. 67 LEFT = -1;
  70. 68 RIGHT = 1;
  71. 69 UP = -1;
  72. 70 DOWN = 1;
  73. 71 MAXMODE = _MRES256COLOR;
  74. ***** ^ undeclared identifier
  75. 72 CGA320Width = 320;
  76. 73 CGA640Width = 640;
  77. 74 EGA640Width = 640;
  78. 75 EGA320Width = 320;
  79. 76 EGA200Depth = 200;
  80. 77 EGA350Depth = 350;
  81. 78 EGA480Depth = 480;
  82. 79
  83. 80 TYPE
  84. 81 ArcQuadrant = ARRAY [0..3] OF SHORTCARD;
  85. ***** ^ not supported yet
  86. ***** ^ not supported yet
  87. 82
  88. 83 CONST
  89. 84 _Q_CLEAR = 5;
  90. 85 _Q_1SEG = 4; (* one section in quadrant *)
  91. 86 _Q_2SEG = 3; (* two sections in quadrant *)
  92. 87 _Q_STEST = 2; (* start vector in quadrant *)
  93. 88 _Q_ETEST = 1; (* end vector in quadrant *)
  94. 89 _Q_NULL = 0;
  95. 90
  96. 91 (*****************************************************************************)
  97. 92 (* type and function definitions. *)
  98. 93 (*****************************************************************************)
  99. 94 TYPE
  100. 95 InterSect = RECORD
  101. 96 x,y : INTEGER;
  102. 97 END; (*InterSect*)
  103. ***** ^ not supported yet
  104. 98
  105. 99 FloodStart = RECORD
  106. 100 best_quad : INTEGER;
  107. 101 quad_type : INTEGER;
  108. 102 flag : INTEGER;
  109. 103 END; (*FloodStart*)
  110. ***** ^ not supported yet
  111. 104 tinyint = [0..7];
  112. 105 bs = SET OF tinyint;
  113. ***** ^ not supported yet
  114. 106 bp = POINTER TO bs;
  115. ***** ^ not supported yet
  116. 107 (*# save,data(near_ptr=>off) *)
  117. 108 HercMapType = ARRAY[0..(HercDepth DIV 4)-1] OF ARRAY[0..(HercWidth DIV 8)-1] OF bs;
  118. ***** ^ undeclared identifier
  119. ***** ^ not supported yet
  120. ***** ^ undeclared identifier
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. 109 CGAPointer = POINTER TO SHORTCARD;
  124. ***** ^ not supported yet
  125. 110 VGAPointer = POINTER TO SHORTCARD;
  126. ***** ^ not supported yet
  127. 111 (*# restore *)
  128. 112
  129. 113 VAR
  130. 114 (*# save,data(near_ptr=>off) *)
  131. 115 HercBitMap : ARRAY [0..1] OF ARRAY [0..3] OF POINTER TO HercMapType;
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. 116 (*# restore *)
  136. 117 StaticMode : CARDINAL;
  137. 118 (*****************************************************************************)
  138. 119 (* Data Definitions and Declarations. *)
  139. 120 (*****************************************************************************)
  140. 121
  141. 122 TYPE
  142. 123 ColTableType = ARRAY [0..15] OF LONGCARD;
  143. ***** ^ not supported yet
  144. ***** ^ undeclared identifier
  145. 124 EGATableType = ARRAY [0..15] OF CARDINAL;
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. 125 CONST
  149. 126 ColTable = ColTableType( _BLACK, _BLUE, _GREEN, _CYAN, _RED, _MAGENTA, _BROWN,
  150. ***** ^ undeclared identifier
  151. ***** ^ undeclared identifier
  152. ***** ^ undeclared identifier
  153. ***** ^ undeclared identifier
  154. ***** ^ undeclared identifier
  155. ***** ^ undeclared identifier
  156. ***** ^ undeclared identifier
  157. 127 _WHITE, _GRAY, _LIGHTBLUE, _LIGHTGREEN, _LIGHTCYAN,
  158. ***** ^ undeclared identifier
  159. ***** ^ undeclared identifier
  160. ***** ^ undeclared identifier
  161. ***** ^ undeclared identifier
  162. ***** ^ undeclared identifier
  163. 128 _LIGHTRED, _LIGHTMAGENTA, _LIGHTYELLOW, _BRIGHTWHITE);
  164. ***** ^ undeclared identifier
  165. ***** ^ undeclared identifier
  166. ***** ^ undeclared identifier
  167. ***** ^ undeclared identifier
  168. 129
  169. 130
  170. 131 VAR
  171. 132 EGATable: EGATableType;
  172. ***** ^ not supported yet
  173. 133 ModeChanged: BOOLEAN;
  174. 134 (*****************************************************************************)
  175. 135 (* Function definitions - low level plotting and drawing. *)
  176. 136 (*****************************************************************************)
  177. 137
  178. 138 (*# save *)
  179. 139 (*# call(near_call=>on) *)
  180. 140
  181. 141
  182. 142 PROCEDURE EllipsePlot(x, y: INTEGER);
  183. 143
  184. 144 BEGIN
  185. 145 IF ((x <= CoreGraph._clip_br.xcoord) AND (x >= CoreGraph._clip_tl.xcoord)
  186. ***** ^ undeclared identifier
  187. ***** ^ not supported yet
  188. ***** ^ not supported yet
  189. ***** ^ undeclared identifier
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. 146 AND (y <= CoreGraph._clip_br.ycoord) AND (y >= CoreGraph._clip_tl.ycoord)) THEN
  193. ***** ^ undeclared identifier
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. ***** ^ undeclared identifier
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. 147 CoreGraph._plot(x, y, CoreGraph._fgcolor);
  200. ***** ^ undeclared identifier
  201. ***** ^ not supported yet
  202. ***** ^ undeclared identifier
  203. ***** ^ not supported yet
  204. 148 END;
  205. 149 RETURN;
  206. 150 END EllipsePlot;
  207. ***** ^ not supported yet
  208. 151
  209. 152 PROCEDURE GetFillStart(VAR x, y: INTEGER; ox, oy, startx, starty,
  210. 153 endx, endy: INTEGER): BOOLEAN;
  211. 154
  212. 155 VAR
  213. 156 fx, fy: INTEGER;
  214. 157 BEGIN
  215. 158 IF CoreGraph._fstart.flag = 0 THEN
  216. ***** ^ undeclared identifier
  217. ***** ^ not supported yet
  218. ***** ^ not supported yet
  219. 159 RETURN FALSE;
  220. 160 END;
  221. 161 IF((startx = endx) AND (starty = endy)) THEN
  222. 162 RETURN FALSE;
  223. 163 END;
  224. 164 IF CoreGraph._fstart.quad_type = _Q_CLEAR THEN
  225. ***** ^ undeclared identifier
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 165 CASE CoreGraph._fstart.best_quad OF
  229. ***** ^ undeclared identifier
  230. ***** ^ not supported yet
  231. ***** ^ not supported yet
  232. 166 | 0:
  233. 167 fx:=ox+1;
  234. 168 fy:=oy+1;
  235. 169 | 1:
  236. 170 fx:=ox+1;
  237. 171 fy:=oy-1;
  238. 172 | 2:
  239. 173 fx:=ox-1;
  240. 174 fy:=oy-1;
  241. 175 | 3:
  242. 176 fx:=ox-1;
  243. 177 fy:=oy+1;
  244. 178 END;
  245. 179 ELSIF (CoreGraph._fstart.quad_type = _Q_STEST) THEN
  246. ***** ^ undeclared identifier
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. 180 CASE CoreGraph._fstart.best_quad OF
  250. ***** ^ undeclared identifier
  251. ***** ^ not supported yet
  252. ***** ^ not supported yet
  253. 181 | 0:
  254. 182 fx:=ox+(((startx-ox+1)>>1)+1);
  255. 183 fy:=oy+(((starty-oy)>>1)-1);
  256. 184 | 1:
  257. 185 fx:=ox+(((startx-ox)>>1)-1);
  258. 186 fy:=starty+(((oy-starty)>>1)-1);
  259. 187 | 2:
  260. 188 fx:=startx+(((ox-startx)>>1)-1);
  261. 189 fy:=starty+(((oy-starty+1)>>1)+1);
  262. 190 | 3:
  263. 191 fx:=startx+(((ox-startx+1)>>1)+1);
  264. 192 fy:=oy+(((starty-oy+1)>>1)+1);
  265. 193 END;
  266. 194 ELSE (* _Q_1SEG *)
  267. 195 CASE CoreGraph._fstart.best_quad OF
  268. ***** ^ undeclared identifier
  269. ***** ^ not supported yet
  270. ***** ^ not supported yet
  271. 196 | 0:
  272. 197 fx:=startx+((endx-startx)>>1)-1;
  273. 198 fy:=endy+((starty-endy)>>1)-1;
  274. 199 | 1:
  275. 200 fx:=endx+((startx-endx)>>1)-1;
  276. 201 fy:=endy+((starty-endy)>>1)+1;
  277. 202 | 2:
  278. 203 fx:=endx+((startx-endx)>>1)+1;
  279. 204 fy:=starty+((endy-starty)>>1)+1;
  280. 205 | 3:
  281. 206 fx:=startx+((endx-startx)>>1)+1;
  282. 207 fy:=starty+((endy-starty)>>1)-1;
  283. 208 END;
  284. 209 END;
  285. 210 x:=fx;
  286. 211 y:=fy;
  287. 212 RETURN TRUE;
  288. 213 END GetFillStart;
  289. ***** ^ not supported yet
  290. 214
  291. 215 PROCEDURE SetFillStart(quadrant: ArcQuadrant);
  292. 216
  293. 217 VAR
  294. 218 q: INTEGER;
  295. 219
  296. 220 BEGIN
  297. 221 q:=0;
  298. 222 CoreGraph._fstart.flag:=1;
  299. ***** ^ undeclared identifier
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. 223 WHILE q < 4 DO
  303. 224 CASE quadrant[q] OF
  304. ***** ^ not supported yet
  305. ***** ^ not supported yet
  306. 225 | _Q_CLEAR:
  307. ***** ^ not supported yet
  308. 226 CoreGraph._fstart.best_quad:=q;
  309. ***** ^ undeclared identifier
  310. ***** ^ not supported yet
  311. ***** ^ not supported yet
  312. 227 CoreGraph._fstart.quad_type:=_Q_CLEAR;
  313. ***** ^ undeclared identifier
  314. ***** ^ not supported yet
  315. ***** ^ not supported yet
  316. 228 RETURN;
  317. 229 | _Q_1SEG:
  318. ***** ^ not supported yet
  319. 230 CoreGraph._fstart.best_quad:=q;
  320. ***** ^ undeclared identifier
  321. ***** ^ not supported yet
  322. ***** ^ not supported yet
  323. 231 CoreGraph._fstart.quad_type:=_Q_1SEG;
  324. ***** ^ undeclared identifier
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. 232 RETURN;
  328. 233 | _Q_STEST:
  329. ***** ^ not supported yet
  330. 234 CoreGraph._fstart.best_quad:=q;
  331. ***** ^ undeclared identifier
  332. ***** ^ not supported yet
  333. ***** ^ not supported yet
  334. 235 CoreGraph._fstart.quad_type:=_Q_STEST;
  335. ***** ^ undeclared identifier
  336. ***** ^ not supported yet
  337. ***** ^ not supported yet
  338. 236
  339. 237 END;
  340. 238 INC(q);
  341. ***** ^ undeclared identifier
  342. ***** ^ not supported yet
  343. 239 END;
  344. 240 RETURN;
  345. 241 END SetFillStart;
  346. ***** ^ not supported yet
  347. 242
  348. 243
  349. 244 PROCEDURE ArcPlot(quadrant: INTEGER; flag: SHORTCARD; noclip: BOOLEAN; xp, yp, startx, endx, starty, endy: INTEGER);
  350. 245
  351. 246 VAR
  352. 247 ok_to_plot: BOOLEAN;
  353. 248 BEGIN
  354. 249 IF flag = SHORTCARD(_Q_NULL) THEN
  355. ***** ^ not supported yet
  356. 250 RETURN ;
  357. 251 END;
  358. 252 ok_to_plot:=FALSE;
  359. 253 IF((noclip) OR (((xp <= CoreGraph._clip_br.xcoord) AND (xp >= CoreGraph._clip_tl.xcoord))
  360. ***** ^ undeclared identifier
  361. ***** ^ not supported yet
  362. ***** ^ not supported yet
  363. ***** ^ undeclared identifier
  364. ***** ^ not supported yet
  365. ***** ^ not supported yet
  366. 254 AND((yp <= CoreGraph._clip_br.ycoord) AND (yp >= CoreGraph._clip_tl.ycoord)))) THEN
  367. ***** ^ undeclared identifier
  368. ***** ^ not supported yet
  369. ***** ^ not supported yet
  370. ***** ^ undeclared identifier
  371. ***** ^ not supported yet
  372. ***** ^ not supported yet
  373. 255 IF flag = SHORTCARD(_Q_CLEAR) THEN
  374. ***** ^ not supported yet
  375. 256 ok_to_plot:=TRUE;
  376. 257 ELSE
  377. 258 CASE quadrant OF
  378. 259 | 0:
  379. 260 CASE flag OF
  380. 261 | _Q_1SEG:
  381. ***** ^ not supported yet
  382. 262 IF((xp >= startx) AND (xp <= endx)
  383. 263 AND (yp <= starty) AND (yp >= endy)) THEN
  384. 264 ok_to_plot:=TRUE;
  385. 265 END;
  386. 266 | _Q_2SEG:
  387. ***** ^ not supported yet
  388. 267 IF(((xp >= startx) AND (yp <= starty))
  389. 268 OR ((xp <= endx) AND (yp >= endy))) THEN
  390. 269 ok_to_plot:=TRUE;
  391. 270 END;
  392. 271 | _Q_ETEST:
  393. ***** ^ not supported yet
  394. 272 IF((xp <= endx) AND (yp >= endy)) THEN
  395. 273 ok_to_plot:=TRUE;
  396. 274 END;
  397. 275 ELSE
  398. 276 IF((xp >= startx) AND (yp <= starty)) THEN
  399. 277 ok_to_plot:=TRUE;
  400. 278 END;
  401. 279 END;
  402. 280 | 3:
  403. 281 CASE flag OF
  404. 282 | _Q_1SEG:
  405. ***** ^ not supported yet
  406. 283 IF((xp >= startx) AND (xp <= endx)
  407. 284 AND (yp >= starty) AND (yp <= endy)) THEN
  408. 285 ok_to_plot:=TRUE;
  409. 286 END;
  410. 287 | _Q_2SEG:
  411. ***** ^ not supported yet
  412. 288 IF(((xp >= startx) AND (yp >= starty))
  413. 289 OR ((xp <= endx) AND (yp <= endy))) THEN
  414. 290 ok_to_plot:=TRUE;
  415. 291 END;
  416. 292 | _Q_ETEST:
  417. ***** ^ not supported yet
  418. 293 IF((xp <= endx) AND (yp <= endy)) THEN
  419. 294 ok_to_plot:=TRUE;
  420. 295 END;
  421. 296 ELSE
  422. 297 IF((xp >= startx) AND (yp >= starty)) THEN
  423. 298 ok_to_plot:=TRUE;
  424. 299 END;
  425. 300 END;
  426. 301 | 2:
  427. 302 CASE flag OF
  428. 303 | _Q_1SEG:
  429. ***** ^ not supported yet
  430. 304 IF((xp <= startx) AND (xp >= endx)
  431. 305 AND (yp >= starty) AND (yp <= endy)) THEN
  432. 306 ok_to_plot:=TRUE;
  433. 307 END;
  434. 308 | _Q_2SEG:
  435. ***** ^ not supported yet
  436. 309 IF(((xp <= startx) AND (yp >= starty))
  437. 310 OR ((xp >= endx) AND (yp <= endy))) THEN
  438. 311 ok_to_plot:=TRUE;
  439. 312 END;
  440. 313 | _Q_ETEST:
  441. ***** ^ not supported yet
  442. 314 IF((xp >= endx) AND (yp <= endy)) THEN
  443. 315 ok_to_plot:=TRUE;
  444. 316 END;
  445. 317 ELSE
  446. 318 IF((xp <= startx) AND (yp >= starty)) THEN
  447. 319 ok_to_plot:=TRUE;
  448. 320 END;
  449. 321 END;
  450. 322 ELSE (* quadrant := 1 *)
  451. 323 CASE flag OF
  452. 324 | _Q_1SEG:
  453. ***** ^ not supported yet
  454. 325 IF((xp <= startx) AND (xp >= endx)
  455. 326 AND (yp <= starty) AND (yp >= endy)) THEN
  456. 327 ok_to_plot:=TRUE;
  457. 328 END;
  458. 329 | _Q_2SEG:
  459. ***** ^ not supported yet
  460. 330 IF(((xp <= startx) AND (yp <= starty))
  461. 331 OR ((xp >= endx) AND (yp >= endy))) THEN
  462. 332 ok_to_plot:=TRUE;
  463. 333 END;
  464. 334 | _Q_ETEST:
  465. ***** ^ not supported yet
  466. 335 IF((xp >= endx) AND (yp >= endy)) THEN
  467. 336 ok_to_plot:=TRUE;
  468. 337 END;
  469. 338 ELSE
  470. 339 IF((xp <= startx) AND (yp <= starty)) THEN
  471. 340 ok_to_plot:=TRUE;
  472. 341 END;
  473. 342 END;
  474. 343 END;
  475. 344 END;
  476. 345 IF ok_to_plot THEN
  477. 346 CoreGraph._plot(xp, yp, CoreGraph._fgcolor);
  478. ***** ^ undeclared identifier
  479. ***** ^ not supported yet
  480. ***** ^ undeclared identifier
  481. ***** ^ not supported yet
  482. 347 END;
  483. 348 END;
  484. 349 RETURN ;
  485. 350 END ArcPlot;
  486. ***** ^ not supported yet
  487. 351
  488. 352 PROCEDURE GetInRange(VAR a0, b0: INTEGER);
  489. 353
  490. 354 BEGIN
  491. 355 IF a0 > b0 THEN
  492. 356 IF a0 > 1023 THEN
  493. 357 b0 := INTEGER((LONGINT(b0)*1023) DIV LONGINT(a0));
  494. ***** ^ not supported yet
  495. ***** ^ not supported yet
  496. 358 a0 := 1023;
  497. 359 END;
  498. 360 ELSE
  499. 361 IF b0 > 1023 THEN
  500. 362 a0 := INTEGER((LONGINT(a0)*1023) DIV LONGINT(b0));
  501. ***** ^ not supported yet
  502. ***** ^ not supported yet
  503. 363 b0 := 1023;
  504. 364 END;
  505. 365 END;
  506. 366 END GetInRange;
  507. ***** ^ not supported yet
  508. 367
  509. 368 PROCEDURE DrawEllipse(x0, y0, a0, b0: INTEGER; Fill: BOOLEAN);
  510. 369
  511. 370 VAR
  512. 371 x, y, line, oldline: INTEGER;
  513. 372 a, b: LONGINT;
  514. 373 asq, asq2, bsq, bsq2: LONGINT;
  515. 374 d, dx, dy: LONGINT;
  516. 375 plotx, plotx2, ploty: INTEGER;
  517. 376 no_clip: BOOLEAN;
  518. 377 mask: CARDINAL;
  519. 378
  520. 379 BEGIN
  521. 380 GetInRange(a0, b0);
  522. ***** ^ not supported yet
  523. ***** ^ not supported yet
  524. 381 no_clip:=FALSE;
  525. 382 x := 0 ;
  526. 383 y := b0 ;
  527. 384 a := LONGINT(a0);
  528. ***** ^ not supported yet
  529. 385 b := LONGINT(b0);
  530. ***** ^ not supported yet
  531. 386 asq := a*a ;
  532. 387 asq2 := asq*2 ;
  533. 388 bsq := b*b ;
  534. 389 bsq2 := bsq*2 ;
  535. 390 d := bsq-(asq*b)+(asq>>2) ;
  536. 391 dx := 0 ;
  537. 392 dy := asq2*b ;
  538. 393 oldline := -(y0+y+1);
  539. 394 IF ((x0+a0 <= CoreGraph._clip_br.xcoord) AND (x0-a0 >= CoreGraph._clip_tl.xcoord))
  540. ***** ^ undeclared identifier
  541. ***** ^ not supported yet
  542. ***** ^ not supported yet
  543. ***** ^ undeclared identifier
  544. ***** ^ not supported yet
  545. ***** ^ not supported yet
  546. 395 AND ((y0+b0 <= CoreGraph._clip_br.ycoord) AND (y0-b0 >= CoreGraph._clip_tl.ycoord)) THEN
  547. ***** ^ undeclared identifier
  548. ***** ^ not supported yet
  549. ***** ^ not supported yet
  550. ***** ^ undeclared identifier
  551. ***** ^ not supported yet
  552. ***** ^ not supported yet
  553. 396 no_clip:=TRUE;
  554. 397 END;
  555. 398 WHILE dx < dy DO
  556. 399 plotx:=x0+x;
  557. 400 ploty:=y0+y;
  558. 401 IF no_clip THEN
  559. 402 CoreGraph._plot(plotx, ploty, CoreGraph._fgcolor);
  560. ***** ^ undeclared identifier
  561. ***** ^ not supported yet
  562. ***** ^ undeclared identifier
  563. ***** ^ not supported yet
  564. 403 ELSE
  565. 404 EllipsePlot(plotx, ploty);
  566. ***** ^ not supported yet
  567. ***** ^ not supported yet
  568. 405 END;
  569. 406 plotx:=x0-x;
  570. 407 ploty:=y0+y;
  571. 408 IF no_clip THEN
  572. 409 CoreGraph._plot(plotx, ploty, CoreGraph._fgcolor);
  573. ***** ^ undeclared identifier
  574. ***** ^ not supported yet
  575. ***** ^ undeclared identifier
  576. ***** ^ not supported yet
  577. 410 ELSE
  578. 411 EllipsePlot(plotx, ploty);
  579. ***** ^ not supported yet
  580. ***** ^ not supported yet
  581. 412 END;
  582. 413 plotx:=x0+x;
  583. 414 ploty:=y0-y;
  584. 415 IF no_clip THEN
  585. 416 CoreGraph._plot(plotx, ploty, CoreGraph._fgcolor);
  586. ***** ^ undeclared identifier
  587. ***** ^ not supported yet
  588. ***** ^ undeclared identifier
  589. ***** ^ not supported yet
  590. 417 ELSE
  591. 418 EllipsePlot(plotx, ploty);
  592. ***** ^ not supported yet
  593. ***** ^ not supported yet
  594. 419 END;
  595. 420 plotx:=x0-x;
  596. 421 ploty:=y0-y;
  597. 422 IF no_clip THEN
  598. 423 CoreGraph._plot(plotx, ploty, CoreGraph._fgcolor);
  599. ***** ^ undeclared identifier
  600. ***** ^ not supported yet
  601. ***** ^ undeclared identifier
  602. ***** ^ not supported yet
  603. 424 ELSE
  604. 425 EllipsePlot(plotx, ploty);
  605. ***** ^ not supported yet
  606. ***** ^ not supported yet
  607. 426 END;
  608. 427 IF Fill = _GFILLINTERIOR THEN
  609. ***** ^ undeclared identifier
  610. 428 plotx:=x0-x+1;
  611. 429 plotx2:=x0+x-1;
  612. 430 IF plotx2 > plotx THEN
  613. 431 line:=y0+y;
  614. 432 IF line # oldline THEN
  615. 433 oldline := line;
  616. 434 mask:=CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(line) * BITSET(7))])
  617. ***** ^ undeclared identifier
  618. ***** ^ not supported yet
  619. ***** ^ undeclared identifier
  620. ***** ^ not supported yet
  621. ***** ^ undeclared identifier
  622. ***** ^ not supported yet
  623. 435 +CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(line) * BITSET(7))])*100H;
  624. ***** ^ undeclared identifier
  625. ***** ^ not supported yet
  626. ***** ^ undeclared identifier
  627. ***** ^ not supported yet
  628. ***** ^ undeclared identifier
  629. ***** ^ not supported yet
  630. 436 IF mask = MAX(CARDINAL) THEN
  631. ***** ^ undeclared identifier
  632. ***** ^ not supported yet
  633. 437 CoreGraph._hline(plotx, line, plotx2, CoreGraph._fgcolor);
  634. ***** ^ undeclared identifier
  635. ***** ^ not supported yet
  636. ***** ^ undeclared identifier
  637. ***** ^ not supported yet
  638. 438 ELSE
  639. 439 CoreGraph._line(plotx, line, plotx2, line, mask);
  640. ***** ^ undeclared identifier
  641. ***** ^ not supported yet
  642. ***** ^ not supported yet
  643. 440 END;
  644. 441 line:=y0-y;
  645. 442 mask:=CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(line) * BITSET(7))])
  646. ***** ^ undeclared identifier
  647. ***** ^ not supported yet
  648. ***** ^ undeclared identifier
  649. ***** ^ not supported yet
  650. ***** ^ undeclared identifier
  651. ***** ^ not supported yet
  652. 443 +CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(line) * BITSET(7))])*100H;
  653. ***** ^ undeclared identifier
  654. ***** ^ not supported yet
  655. ***** ^ undeclared identifier
  656. ***** ^ not supported yet
  657. ***** ^ undeclared identifier
  658. ***** ^ not supported yet
  659. 444 IF mask = MAX(CARDINAL) THEN
  660. ***** ^ undeclared identifier
  661. ***** ^ not supported yet
  662. 445 CoreGraph._hline(plotx, line, plotx2, CoreGraph._fgcolor);
  663. ***** ^ undeclared identifier
  664. ***** ^ not supported yet
  665. ***** ^ undeclared identifier
  666. ***** ^ not supported yet
  667. 446 ELSE
  668. 447 CoreGraph._line(plotx, line, plotx2, line, mask);
  669. ***** ^ undeclared identifier
  670. ***** ^ not supported yet
  671. ***** ^ not supported yet
  672. 448 END;
  673. 449 END;
  674. 450 END;
  675. 451 END;
  676. 452 IF d > 0 THEN
  677. 453 DEC(y);
  678. ***** ^ undeclared identifier
  679. ***** ^ not supported yet
  680. 454 DEC(dy, asq2);
  681. ***** ^ undeclared identifier
  682. ***** ^ not supported yet
  683. 455 DEC(d, dy);
  684. ***** ^ undeclared identifier
  685. ***** ^ not supported yet
  686. 456 END;
  687. 457 INC(x);
  688. ***** ^ undeclared identifier
  689. ***** ^ not supported yet
  690. 458 INC(dx, bsq2);
  691. ***** ^ undeclared identifier
  692. ***** ^ not supported yet
  693. 459 INC(d, bsq+dx);
  694. ***** ^ undeclared identifier
  695. ***** ^ not supported yet
  696. 460 END;
  697. 461 INC(d, (3*((asq-bsq)>>1)-((dx+dy)>>1)));
  698. ***** ^ undeclared identifier
  699. ***** ^ not supported yet
  700. 462 WHILE y >= 0 DO
  701. 463 plotx:=x0+x;
  702. 464 ploty:=y0+y;
  703. 465 IF no_clip THEN
  704. 466 CoreGraph._plot(plotx, ploty, CoreGraph._fgcolor);
  705. ***** ^ undeclared identifier
  706. ***** ^ not supported yet
  707. ***** ^ undeclared identifier
  708. ***** ^ not supported yet
  709. 467 ELSE
  710. 468 EllipsePlot(plotx, ploty);
  711. ***** ^ not supported yet
  712. ***** ^ not supported yet
  713. 469 END;
  714. 470 plotx:=x0-x;
  715. 471 ploty:=y0+y;
  716. 472 IF no_clip THEN
  717. 473 CoreGraph._plot(plotx, ploty, CoreGraph._fgcolor);
  718. ***** ^ undeclared identifier
  719. ***** ^ not supported yet
  720. ***** ^ undeclared identifier
  721. ***** ^ not supported yet
  722. 474 ELSE
  723. 475 EllipsePlot(plotx, ploty);
  724. ***** ^ not supported yet
  725. ***** ^ not supported yet
  726. 476 END;
  727. 477 plotx:=x0+x;
  728. 478 ploty:=y0-y;
  729. 479 IF no_clip THEN
  730. 480 CoreGraph._plot(plotx, ploty, CoreGraph._fgcolor);
  731. ***** ^ undeclared identifier
  732. ***** ^ not supported yet
  733. ***** ^ undeclared identifier
  734. ***** ^ not supported yet
  735. 481 ELSE
  736. 482 EllipsePlot(plotx, ploty);
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. 483 END;
  740. 484 plotx:=x0-x;
  741. 485 ploty:=y0-y;
  742. 486 IF no_clip THEN
  743. 487 CoreGraph._plot(plotx, ploty, CoreGraph._fgcolor);
  744. ***** ^ undeclared identifier
  745. ***** ^ not supported yet
  746. ***** ^ undeclared identifier
  747. ***** ^ not supported yet
  748. 488 ELSE
  749. 489 EllipsePlot(plotx, ploty);
  750. ***** ^ not supported yet
  751. ***** ^ not supported yet
  752. 490 END;
  753. 491 IF Fill = _GFILLINTERIOR THEN
  754. ***** ^ undeclared identifier
  755. 492 plotx:=x0-x+1;
  756. 493 plotx2:=x0+x-1;
  757. 494 IF plotx2 > plotx THEN
  758. 495 line:=y0+y;
  759. 496 IF line # oldline THEN
  760. 497 oldline := line;
  761. 498 mask:=CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(line) * BITSET(7))])
  762. ***** ^ undeclared identifier
  763. ***** ^ not supported yet
  764. ***** ^ undeclared identifier
  765. ***** ^ not supported yet
  766. ***** ^ undeclared identifier
  767. ***** ^ not supported yet
  768. 499 +CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(line) * BITSET(7))])*100H;
  769. ***** ^ undeclared identifier
  770. ***** ^ not supported yet
  771. ***** ^ undeclared identifier
  772. ***** ^ not supported yet
  773. ***** ^ undeclared identifier
  774. ***** ^ not supported yet
  775. 500 IF mask = MAX(CARDINAL) THEN
  776. ***** ^ undeclared identifier
  777. ***** ^ not supported yet
  778. 501 CoreGraph._hline(plotx, line, plotx2, CoreGraph._fgcolor);
  779. ***** ^ undeclared identifier
  780. ***** ^ not supported yet
  781. ***** ^ undeclared identifier
  782. ***** ^ not supported yet
  783. 502 ELSE
  784. 503 CoreGraph._line(plotx, line, plotx2, line, mask);
  785. ***** ^ undeclared identifier
  786. ***** ^ not supported yet
  787. ***** ^ not supported yet
  788. 504 END;
  789. 505 line:=y0-y;
  790. 506 mask:=CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(line) * BITSET(7))])
  791. ***** ^ undeclared identifier
  792. ***** ^ not supported yet
  793. ***** ^ undeclared identifier
  794. ***** ^ not supported yet
  795. ***** ^ undeclared identifier
  796. ***** ^ not supported yet
  797. 507 +CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(line) * BITSET(7))])*100H;
  798. ***** ^ undeclared identifier
  799. ***** ^ not supported yet
  800. ***** ^ undeclared identifier
  801. ***** ^ not supported yet
  802. ***** ^ undeclared identifier
  803. ***** ^ not supported yet
  804. 508 IF mask = MAX(CARDINAL) THEN
  805. ***** ^ undeclared identifier
  806. ***** ^ not supported yet
  807. 509 CoreGraph._hline(plotx, line, plotx2, CoreGraph._fgcolor);
  808. ***** ^ undeclared identifier
  809. ***** ^ not supported yet
  810. ***** ^ undeclared identifier
  811. ***** ^ not supported yet
  812. 510 ELSE
  813. 511 CoreGraph._line(plotx, line, plotx2, line, mask);
  814. ***** ^ undeclared identifier
  815. ***** ^ not supported yet
  816. ***** ^ not supported yet
  817. 512 END;
  818. 513 END;
  819. 514 END;
  820. 515 END;
  821. 516 IF d < 0 THEN
  822. 517 INC(x);
  823. ***** ^ undeclared identifier
  824. ***** ^ not supported yet
  825. 518 INC(dx, bsq2);
  826. ***** ^ undeclared identifier
  827. ***** ^ not supported yet
  828. 519 INC(d, dx);
  829. ***** ^ undeclared identifier
  830. ***** ^ not supported yet
  831. 520 END;
  832. 521 DEC(y);
  833. ***** ^ undeclared identifier
  834. ***** ^ not supported yet
  835. 522 DEC(dy, asq2);
  836. ***** ^ undeclared identifier
  837. ***** ^ not supported yet
  838. 523 INC(d, asq-dy);
  839. ***** ^ undeclared identifier
  840. ***** ^ not supported yet
  841. 524 END;
  842. 525 RETURN;
  843. 526 END DrawEllipse;
  844. ***** ^ not supported yet
  845. 527
  846. 528 PROCEDURE GetArc(VAR quadrant: ArcQuadrant; x, y, sx, sy, ex, ey: INTEGER): BOOLEAN;
  847. 529
  848. 530 BEGIN
  849. 531 IF ((sx = ex) AND (sy = ey)) THEN
  850. 532 RETURN TRUE;
  851. 533 END;
  852. 534 DEC(sx, x);
  853. ***** ^ undeclared identifier
  854. ***** ^ not supported yet
  855. 535 DEC(ex, x);
  856. ***** ^ undeclared identifier
  857. ***** ^ not supported yet
  858. 536 DEC(sy, y);
  859. ***** ^ undeclared identifier
  860. ***** ^ not supported yet
  861. 537 DEC(ey, y);
  862. ***** ^ undeclared identifier
  863. ***** ^ not supported yet
  864. 538 IF((sx > 0) AND (sy > 0)) THEN (* start in quad 0 *)
  865. 539 quadrant[0]:=SHORTCARD(_Q_STEST);
  866. ***** ^ not supported yet
  867. ***** ^ not supported yet
  868. ***** ^ not supported yet
  869. 540 IF((ey <= 0) AND (ex > 0)) THEN
  870. 541 quadrant[1]:=SHORTCARD(_Q_ETEST);
  871. ***** ^ not supported yet
  872. ***** ^ not supported yet
  873. ***** ^ not supported yet
  874. 542 quadrant[2]:=SHORTCARD(_Q_NULL);
  875. ***** ^ not supported yet
  876. ***** ^ not supported yet
  877. ***** ^ not supported yet
  878. 543 quadrant[3]:=SHORTCARD(_Q_NULL);
  879. ***** ^ not supported yet
  880. ***** ^ not supported yet
  881. ***** ^ not supported yet
  882. 544 ELSIF((ey <= 0) AND (ex <= 0)) THEN
  883. 545 quadrant[1]:=SHORTCARD(_Q_CLEAR);
  884. ***** ^ not supported yet
  885. ***** ^ not supported yet
  886. ***** ^ not supported yet
  887. 546 quadrant[2]:=SHORTCARD(_Q_ETEST);
  888. ***** ^ not supported yet
  889. ***** ^ not supported yet
  890. ***** ^ not supported yet
  891. 547 quadrant[3]:=SHORTCARD(_Q_NULL);
  892. ***** ^ not supported yet
  893. ***** ^ not supported yet
  894. ***** ^ not supported yet
  895. 548 ELSIF((ey > 0) AND (ex <= 0)) THEN
  896. 549 quadrant[1]:=SHORTCARD(_Q_CLEAR);
  897. ***** ^ not supported yet
  898. ***** ^ not supported yet
  899. ***** ^ not supported yet
  900. 550 quadrant[2]:=SHORTCARD(_Q_CLEAR);
  901. ***** ^ not supported yet
  902. ***** ^ not supported yet
  903. ***** ^ not supported yet
  904. 551 quadrant[3]:=SHORTCARD(_Q_ETEST);
  905. ***** ^ not supported yet
  906. ***** ^ not supported yet
  907. ***** ^ not supported yet
  908. 552 ELSIF((ey > 0) AND (ex > 0)) THEN
  909. 553 IF(sx < ex) THEN
  910. 554 quadrant[0]:=SHORTCARD(_Q_1SEG);
  911. ***** ^ not supported yet
  912. ***** ^ not supported yet
  913. ***** ^ not supported yet
  914. 555 quadrant[1]:=SHORTCARD(_Q_NULL);
  915. ***** ^ not supported yet
  916. ***** ^ not supported yet
  917. ***** ^ not supported yet
  918. 556 quadrant[2]:=SHORTCARD(_Q_NULL);
  919. ***** ^ not supported yet
  920. ***** ^ not supported yet
  921. ***** ^ not supported yet
  922. 557 quadrant[3]:=SHORTCARD(_Q_NULL);
  923. ***** ^ not supported yet
  924. ***** ^ not supported yet
  925. ***** ^ not supported yet
  926. 558 ELSE
  927. 559 quadrant[0]:=SHORTCARD(_Q_2SEG);
  928. ***** ^ not supported yet
  929. ***** ^ not supported yet
  930. ***** ^ not supported yet
  931. 560 quadrant[1]:=SHORTCARD(_Q_CLEAR);
  932. ***** ^ not supported yet
  933. ***** ^ not supported yet
  934. ***** ^ not supported yet
  935. 561 quadrant[2]:=SHORTCARD(_Q_CLEAR);
  936. ***** ^ not supported yet
  937. ***** ^ not supported yet
  938. ***** ^ not supported yet
  939. 562 quadrant[3]:=SHORTCARD(_Q_CLEAR);
  940. ***** ^ not supported yet
  941. ***** ^ not supported yet
  942. ***** ^ not supported yet
  943. 563 END;
  944. 564 ELSE
  945. 565 RETURN FALSE;
  946. 566 END;
  947. 567 ELSIF((sx > 0) AND (sy <= 0)) THEN (* start in quad 1 *)
  948. 568 quadrant[1]:=_Q_STEST;
  949. ***** ^ not supported yet
  950. ***** ^ not supported yet
  951. 569 IF((ey <= 0) AND (ex <= 0)) THEN
  952. 570 quadrant[2]:=SHORTCARD(_Q_ETEST);
  953. ***** ^ not supported yet
  954. ***** ^ not supported yet
  955. ***** ^ not supported yet
  956. 571 quadrant[3]:=SHORTCARD(_Q_NULL);
  957. ***** ^ not supported yet
  958. ***** ^ not supported yet
  959. ***** ^ not supported yet
  960. 572 quadrant[0]:=SHORTCARD(_Q_NULL);
  961. ***** ^ not supported yet
  962. ***** ^ not supported yet
  963. ***** ^ not supported yet
  964. 573 ELSIF((ey > 0) AND (ex <= 0)) THEN
  965. 574 quadrant[2]:=SHORTCARD(_Q_CLEAR);
  966. ***** ^ not supported yet
  967. ***** ^ not supported yet
  968. ***** ^ not supported yet
  969. 575 quadrant[3]:=SHORTCARD(_Q_ETEST);
  970. ***** ^ not supported yet
  971. ***** ^ not supported yet
  972. ***** ^ not supported yet
  973. 576 quadrant[0]:=SHORTCARD(_Q_NULL);
  974. ***** ^ not supported yet
  975. ***** ^ not supported yet
  976. ***** ^ not supported yet
  977. 577 ELSIF((ey > 0) AND (ex > 0)) THEN
  978. 578 quadrant[2]:=SHORTCARD(_Q_CLEAR);
  979. ***** ^ not supported yet
  980. ***** ^ not supported yet
  981. ***** ^ not supported yet
  982. 579 quadrant[3]:=SHORTCARD(_Q_CLEAR);
  983. ***** ^ not supported yet
  984. ***** ^ not supported yet
  985. ***** ^ not supported yet
  986. 580 quadrant[0]:=SHORTCARD(_Q_ETEST);
  987. ***** ^ not supported yet
  988. ***** ^ not supported yet
  989. ***** ^ not supported yet
  990. 581 ELSIF((ey <= 0) AND (ex > 0)) THEN
  991. 582 IF(sx >= ex) THEN
  992. 583 quadrant[1]:=SHORTCARD(_Q_1SEG);
  993. ***** ^ not supported yet
  994. ***** ^ not supported yet
  995. ***** ^ not supported yet
  996. 584 quadrant[2]:=SHORTCARD(_Q_NULL);
  997. ***** ^ not supported yet
  998. ***** ^ not supported yet
  999. ***** ^ not supported yet
  1000. 585 quadrant[3]:=SHORTCARD(_Q_NULL);
  1001. ***** ^ not supported yet
  1002. ***** ^ not supported yet
  1003. ***** ^ not supported yet
  1004. 586 quadrant[0]:=SHORTCARD(_Q_NULL);
  1005. ***** ^ not supported yet
  1006. ***** ^ not supported yet
  1007. ***** ^ not supported yet
  1008. 587 ELSE
  1009. 588 quadrant[1]:=SHORTCARD(_Q_2SEG);
  1010. ***** ^ not supported yet
  1011. ***** ^ not supported yet
  1012. ***** ^ not supported yet
  1013. 589 quadrant[2]:=SHORTCARD(_Q_CLEAR);
  1014. ***** ^ not supported yet
  1015. ***** ^ not supported yet
  1016. ***** ^ not supported yet
  1017. 590 quadrant[3]:=SHORTCARD(_Q_CLEAR);
  1018. ***** ^ not supported yet
  1019. ***** ^ not supported yet
  1020. ***** ^ not supported yet
  1021. 591 quadrant[0]:=SHORTCARD(_Q_CLEAR);
  1022. ***** ^ not supported yet
  1023. ***** ^ not supported yet
  1024. ***** ^ not supported yet
  1025. 592 END;
  1026. 593 ELSE
  1027. 594 RETURN FALSE;
  1028. 595 END;
  1029. 596 ELSIF((sx <= 0) AND (sy <= 0)) THEN (* start in quad 2 *)
  1030. 597 quadrant[2]:=SHORTCARD(_Q_STEST);
  1031. ***** ^ not supported yet
  1032. ***** ^ not supported yet
  1033. ***** ^ not supported yet
  1034. 598 IF((ey > 0) AND (ex <= 0)) THEN
  1035. 599 quadrant[3]:=SHORTCARD(_Q_ETEST);
  1036. ***** ^ not supported yet
  1037. ***** ^ not supported yet
  1038. ***** ^ not supported yet
  1039. 600 quadrant[0]:=SHORTCARD(_Q_NULL);
  1040. ***** ^ not supported yet
  1041. ***** ^ not supported yet
  1042. ***** ^ not supported yet
  1043. 601 quadrant[1]:=SHORTCARD(_Q_NULL);
  1044. ***** ^ not supported yet
  1045. ***** ^ not supported yet
  1046. ***** ^ not supported yet
  1047. 602 ELSIF((ey > 0) AND (ex > 0)) THEN
  1048. 603 quadrant[3]:=SHORTCARD(_Q_CLEAR);
  1049. ***** ^ not supported yet
  1050. ***** ^ not supported yet
  1051. ***** ^ not supported yet
  1052. 604 quadrant[0]:=SHORTCARD(_Q_ETEST);
  1053. ***** ^ not supported yet
  1054. ***** ^ not supported yet
  1055. ***** ^ not supported yet
  1056. 605 quadrant[1]:=SHORTCARD(_Q_NULL);
  1057. ***** ^ not supported yet
  1058. ***** ^ not supported yet
  1059. ***** ^ not supported yet
  1060. 606 ELSIF((ey <= 0) AND (ex > 0)) THEN
  1061. 607 quadrant[3]:=SHORTCARD(_Q_CLEAR);
  1062. ***** ^ not supported yet
  1063. ***** ^ not supported yet
  1064. ***** ^ not supported yet
  1065. 608 quadrant[0]:=SHORTCARD(_Q_CLEAR);
  1066. ***** ^ not supported yet
  1067. ***** ^ not supported yet
  1068. ***** ^ not supported yet
  1069. 609 quadrant[1]:=SHORTCARD(_Q_ETEST);
  1070. ***** ^ not supported yet
  1071. ***** ^ not supported yet
  1072. ***** ^ not supported yet
  1073. 610 ELSIF((ey <= 0) AND (ex <= 0)) THEN
  1074. 611 IF(sx >= ex) THEN
  1075. 612 quadrant[2]:=SHORTCARD(_Q_1SEG);
  1076. ***** ^ not supported yet
  1077. ***** ^ not supported yet
  1078. ***** ^ not supported yet
  1079. 613 quadrant[3]:=SHORTCARD(_Q_NULL);
  1080. ***** ^ not supported yet
  1081. ***** ^ not supported yet
  1082. ***** ^ not supported yet
  1083. 614 quadrant[0]:=SHORTCARD(_Q_NULL);
  1084. ***** ^ not supported yet
  1085. ***** ^ not supported yet
  1086. ***** ^ not supported yet
  1087. 615 quadrant[1]:=SHORTCARD(_Q_NULL);
  1088. ***** ^ not supported yet
  1089. ***** ^ not supported yet
  1090. ***** ^ not supported yet
  1091. 616 ELSE
  1092. 617 quadrant[2]:=SHORTCARD(_Q_2SEG);
  1093. ***** ^ not supported yet
  1094. ***** ^ not supported yet
  1095. ***** ^ not supported yet
  1096. 618 quadrant[3]:=SHORTCARD(_Q_CLEAR);
  1097. ***** ^ not supported yet
  1098. ***** ^ not supported yet
  1099. ***** ^ not supported yet
  1100. 619 quadrant[0]:=SHORTCARD(_Q_CLEAR);
  1101. ***** ^ not supported yet
  1102. ***** ^ not supported yet
  1103. ***** ^ not supported yet
  1104. 620 quadrant[1]:=SHORTCARD(_Q_CLEAR);
  1105. ***** ^ not supported yet
  1106. ***** ^ not supported yet
  1107. ***** ^ not supported yet
  1108. 621 END;
  1109. 622 ELSE
  1110. 623 RETURN FALSE;
  1111. 624 END;
  1112. 625 ELSIF((sx <= 0) AND (sy > 0)) THEN (* start in quad 3 *)
  1113. 626 quadrant[3]:=SHORTCARD(_Q_STEST);
  1114. ***** ^ not supported yet
  1115. ***** ^ not supported yet
  1116. ***** ^ not supported yet
  1117. 627 IF((ey > 0) AND (ex > 0)) THEN
  1118. 628 quadrant[0]:=SHORTCARD(_Q_ETEST);
  1119. ***** ^ not supported yet
  1120. ***** ^ not supported yet
  1121. ***** ^ not supported yet
  1122. 629 quadrant[1]:=SHORTCARD(_Q_NULL);
  1123. ***** ^ not supported yet
  1124. ***** ^ not supported yet
  1125. ***** ^ not supported yet
  1126. 630 quadrant[2]:=SHORTCARD(_Q_NULL);
  1127. ***** ^ not supported yet
  1128. ***** ^ not supported yet
  1129. ***** ^ not supported yet
  1130. 631 ELSIF((ey <= 0) AND (ex > 0)) THEN
  1131. 632 quadrant[0]:=SHORTCARD(_Q_CLEAR);
  1132. ***** ^ not supported yet
  1133. ***** ^ not supported yet
  1134. ***** ^ not supported yet
  1135. 633 quadrant[1]:=SHORTCARD(_Q_ETEST);
  1136. ***** ^ not supported yet
  1137. ***** ^ not supported yet
  1138. ***** ^ not supported yet
  1139. 634 quadrant[2]:=SHORTCARD(_Q_NULL);
  1140. ***** ^ not supported yet
  1141. ***** ^ not supported yet
  1142. ***** ^ not supported yet
  1143. 635 ELSIF((ey <= 0) AND (ex <= 0)) THEN
  1144. 636 quadrant[0]:=SHORTCARD(_Q_CLEAR);
  1145. ***** ^ not supported yet
  1146. ***** ^ not supported yet
  1147. ***** ^ not supported yet
  1148. 637 quadrant[1]:=SHORTCARD(_Q_CLEAR);
  1149. ***** ^ not supported yet
  1150. ***** ^ not supported yet
  1151. ***** ^ not supported yet
  1152. 638 quadrant[2]:=SHORTCARD(_Q_ETEST);
  1153. ***** ^ not supported yet
  1154. ***** ^ not supported yet
  1155. ***** ^ not supported yet
  1156. 639 ELSIF((ey > 0) AND (ex <= 0)) THEN
  1157. 640 IF(sx < ex) THEN
  1158. 641 quadrant[3]:=SHORTCARD(_Q_1SEG);
  1159. ***** ^ not supported yet
  1160. ***** ^ not supported yet
  1161. ***** ^ not supported yet
  1162. 642 quadrant[0]:=SHORTCARD(_Q_NULL);
  1163. ***** ^ not supported yet
  1164. ***** ^ not supported yet
  1165. ***** ^ not supported yet
  1166. 643 quadrant[1]:=SHORTCARD(_Q_NULL);
  1167. ***** ^ not supported yet
  1168. ***** ^ not supported yet
  1169. ***** ^ not supported yet
  1170. 644 quadrant[2]:=SHORTCARD(_Q_NULL);
  1171. ***** ^ not supported yet
  1172. ***** ^ not supported yet
  1173. ***** ^ not supported yet
  1174. 645 ELSE
  1175. 646 quadrant[3]:=SHORTCARD(_Q_2SEG);
  1176. ***** ^ not supported yet
  1177. ***** ^ not supported yet
  1178. ***** ^ not supported yet
  1179. 647 quadrant[0]:=SHORTCARD(_Q_CLEAR);
  1180. ***** ^ not supported yet
  1181. ***** ^ not supported yet
  1182. ***** ^ not supported yet
  1183. 648 quadrant[1]:=SHORTCARD(_Q_CLEAR);
  1184. ***** ^ not supported yet
  1185. ***** ^ not supported yet
  1186. ***** ^ not supported yet
  1187. 649 quadrant[2]:=SHORTCARD(_Q_CLEAR);
  1188. ***** ^ not supported yet
  1189. ***** ^ not supported yet
  1190. ***** ^ not supported yet
  1191. 650 END;
  1192. 651 ELSE
  1193. 652 RETURN FALSE;
  1194. 653 END;
  1195. 654 ELSE
  1196. 655 RETURN FALSE;
  1197. 656 END;
  1198. 657 RETURN TRUE;
  1199. 658 END GetArc;
  1200. ***** ^ not supported yet
  1201. 659
  1202. 660
  1203. 661 PROCEDURE DrawArc(x0, y0, a0, b0, startx, starty, endx, endy: INTEGER): BOOLEAN;
  1204. 662
  1205. 663 VAR
  1206. 664 x, y: INTEGER;
  1207. 665 xp, yp: INTEGER;
  1208. 666 a, b: LONGINT;
  1209. 667 asq, asq2, bsq, bsq2: LONGINT;
  1210. 668 d, dx, dy: LONGINT;
  1211. 669 quadrant: ArcQuadrant;
  1212. ***** ^ not supported yet
  1213. 670 no_clip: BOOLEAN;
  1214. 671 BEGIN
  1215. 672 GetInRange(a0, b0);
  1216. ***** ^ not supported yet
  1217. ***** ^ not supported yet
  1218. 673 no_clip:=FALSE;
  1219. 674 quadrant:=ArcQuadrant(_Q_CLEAR,_Q_CLEAR,_Q_CLEAR,_Q_CLEAR);
  1220. ***** ^ not supported yet
  1221. ***** ^ not supported yet
  1222. 675 CoreGraph._fstart.flag:=0;
  1223. ***** ^ undeclared identifier
  1224. ***** ^ not supported yet
  1225. ***** ^ not supported yet
  1226. 676 x := 0 ;
  1227. 677 y := b0 ;
  1228. 678 a := LONGINT(a0);
  1229. ***** ^ not supported yet
  1230. 679 b := LONGINT(b0);
  1231. ***** ^ not supported yet
  1232. 680 asq := a*a ;
  1233. 681 asq2 := asq*2 ;
  1234. 682 bsq := b*b ;
  1235. 683 bsq2 := bsq*2 ;
  1236. 684 d := bsq-(asq*b)+(asq>>2) ;
  1237. 685 dx := 0 ;
  1238. 686 dy := asq2*b ;
  1239. 687 IF ~GetArc(quadrant, x0, y0, startx, starty, endx, endy) THEN
  1240. ***** ^ not supported yet
  1241. ***** ^ not supported yet
  1242. ***** ^ not supported yet
  1243. 688 RETURN FALSE;
  1244. 689 END;
  1245. 690 SetFillStart(quadrant);
  1246. ***** ^ not supported yet
  1247. ***** ^ not supported yet
  1248. 691 IF(((x0+a0 <= CoreGraph._clip_br.xcoord) AND (x0-a0 >= CoreGraph._clip_tl.xcoord))
  1249. ***** ^ undeclared identifier
  1250. ***** ^ not supported yet
  1251. ***** ^ not supported yet
  1252. ***** ^ undeclared identifier
  1253. ***** ^ not supported yet
  1254. ***** ^ not supported yet
  1255. 692 AND((y0+b0 <= CoreGraph._clip_br.ycoord) AND (y0-b0 >= CoreGraph._clip_tl.ycoord))) THEN
  1256. ***** ^ undeclared identifier
  1257. ***** ^ not supported yet
  1258. ***** ^ not supported yet
  1259. ***** ^ undeclared identifier
  1260. ***** ^ not supported yet
  1261. ***** ^ not supported yet
  1262. 693 no_clip:=TRUE;
  1263. 694 END;
  1264. 695 WHILE dx < dy DO
  1265. 696 xp:=x0+x;
  1266. 697 yp:=y0+y;
  1267. 698 ArcPlot(0, quadrant[0], no_clip, xp, yp, startx, endx, starty, endy);
  1268. ***** ^ not supported yet
  1269. ***** ^ not supported yet
  1270. ***** ^ not supported yet
  1271. ***** ^ not supported yet
  1272. 699 xp:=x0-x;
  1273. 700 yp:=y0+y;
  1274. 701 ArcPlot(3, quadrant[3], no_clip, xp, yp, startx, endx, starty, endy);
  1275. ***** ^ not supported yet
  1276. ***** ^ not supported yet
  1277. ***** ^ not supported yet
  1278. ***** ^ not supported yet
  1279. 702 xp:=x0+x;
  1280. 703 yp:=y0-y;
  1281. 704 ArcPlot(1, quadrant[1], no_clip, xp, yp, startx, endx, starty, endy);
  1282. ***** ^ not supported yet
  1283. ***** ^ not supported yet
  1284. ***** ^ not supported yet
  1285. ***** ^ not supported yet
  1286. 705 xp:=x0-x;
  1287. 706 yp:=y0-y;
  1288. 707 ArcPlot(2, quadrant[2], no_clip, xp, yp, startx, endx, starty, endy);
  1289. ***** ^ not supported yet
  1290. ***** ^ not supported yet
  1291. ***** ^ not supported yet
  1292. ***** ^ not supported yet
  1293. 708 IF d > 0 THEN
  1294. 709 DEC(y);
  1295. ***** ^ undeclared identifier
  1296. ***** ^ not supported yet
  1297. 710 DEC(dy, asq2);
  1298. ***** ^ undeclared identifier
  1299. ***** ^ not supported yet
  1300. 711 DEC(d, dy);
  1301. ***** ^ undeclared identifier
  1302. ***** ^ not supported yet
  1303. 712 END;
  1304. 713 INC(x);
  1305. ***** ^ undeclared identifier
  1306. ***** ^ not supported yet
  1307. 714 INC(dx, bsq2);
  1308. ***** ^ undeclared identifier
  1309. ***** ^ not supported yet
  1310. 715 INC(d, bsq+dx);
  1311. ***** ^ undeclared identifier
  1312. ***** ^ not supported yet
  1313. 716 END;
  1314. 717 INC(d, (3*((asq-bsq)>>1)-((dx+dy)>>1)));
  1315. ***** ^ undeclared identifier
  1316. ***** ^ not supported yet
  1317. 718 WHILE y >= 0 DO
  1318. 719 xp:=x0+x;
  1319. 720 yp:=y0+y;
  1320. 721 ArcPlot(0, quadrant[0], no_clip, xp, yp, startx, endx, starty, endy);
  1321. ***** ^ not supported yet
  1322. ***** ^ not supported yet
  1323. ***** ^ not supported yet
  1324. ***** ^ not supported yet
  1325. 722 xp:=x0-x;
  1326. 723 yp:=y0+y;
  1327. 724 ArcPlot(3, quadrant[3], no_clip, xp, yp, startx, endx, starty, endy);
  1328. ***** ^ not supported yet
  1329. ***** ^ not supported yet
  1330. ***** ^ not supported yet
  1331. ***** ^ not supported yet
  1332. 725 xp:=x0+x;
  1333. 726 yp:=y0-y;
  1334. 727 ArcPlot(1, quadrant[1], no_clip, xp, yp, startx, endx, starty, endy);
  1335. ***** ^ not supported yet
  1336. ***** ^ not supported yet
  1337. ***** ^ not supported yet
  1338. ***** ^ not supported yet
  1339. 728 xp:=x0-x;
  1340. 729 yp:=y0-y;
  1341. 730 ArcPlot(2, quadrant[2], no_clip, xp, yp, startx, endx, starty, endy);
  1342. ***** ^ not supported yet
  1343. ***** ^ not supported yet
  1344. ***** ^ not supported yet
  1345. ***** ^ not supported yet
  1346. 731 IF d<0 THEN
  1347. 732 INC(x);
  1348. ***** ^ undeclared identifier
  1349. ***** ^ not supported yet
  1350. 733 INC(dx, bsq2);
  1351. ***** ^ undeclared identifier
  1352. ***** ^ not supported yet
  1353. 734 INC(d, dx);
  1354. ***** ^ undeclared identifier
  1355. ***** ^ not supported yet
  1356. 735 END;
  1357. 736 DEC(y);
  1358. ***** ^ undeclared identifier
  1359. ***** ^ not supported yet
  1360. 737 DEC(dy, asq2);
  1361. ***** ^ undeclared identifier
  1362. ***** ^ not supported yet
  1363. 738 INC(d, asq-dy);
  1364. ***** ^ undeclared identifier
  1365. ***** ^ not supported yet
  1366. 739 END;
  1367. 740 RETURN TRUE;
  1368. 741 END DrawArc;
  1369. ***** ^ not supported yet
  1370. 742
  1371. 743
  1372. 744 PROCEDURE GetVec(x0, y0, a0, b0, vx, vy: INTEGER): InterSect;
  1373. 745
  1374. 746 VAR
  1375. 747 x, y: INTEGER;
  1376. 748 a, b: LONGINT;
  1377. 749 asq, asq2, bsq, bsq2: LONGINT;
  1378. 750 d, dx, dy: LONGINT;
  1379. 751 px, py, qx, qy: INTEGER;
  1380. 752 Ret: InterSect;
  1381. ***** ^ not supported yet
  1382. 753 flag: INTEGER;
  1383. 754 last_difference: LONGCARD;
  1384. ***** ^ undeclared identifier
  1385. 755 res: LONGINT;
  1386. 756
  1387. 757 BEGIN
  1388. 758 Ret:=InterSect(0,0);
  1389. ***** ^ not supported yet
  1390. ***** ^ not supported yet
  1391. 759 x := 0 ;
  1392. 760 y := b0 ;
  1393. 761 a := LONGINT(a0);
  1394. ***** ^ not supported yet
  1395. 762 b := LONGINT(b0);
  1396. ***** ^ not supported yet
  1397. 763 qx:=vx-x0;
  1398. 764 qy:=vy-y0;
  1399. 765 asq := a*a ;
  1400. 766 asq2 := asq*2 ;
  1401. 767 bsq := b*b ;
  1402. 768 bsq2 := bsq*2 ;
  1403. 769 d := bsq-(asq*b)+(asq>>2) ;
  1404. 770 dx := 0 ;
  1405. 771 dy := asq2*b ;
  1406. 772 last_difference:=MAX(LONGCARD);
  1407. ***** ^ not supported yet
  1408. ***** ^ undeclared identifier
  1409. ***** ^ undeclared identifier
  1410. 773 WHILE dx < dy DO
  1411. 774 IF((qx >= 0) AND (qy >= 0)) THEN
  1412. 775 px:=x0+x;
  1413. 776 py:=y0+y;
  1414. 777 flag:=0;
  1415. 778 ELSIF((qx < 0) AND (qy >= 0)) THEN
  1416. 779 px:=x0-x;
  1417. 780 py:=y0+y;
  1418. 781 flag:=1;
  1419. 782 ELSIF((qx >= 0) AND (qy < 0)) THEN
  1420. 783 px:=x0+x;
  1421. 784 py:=y0-y;
  1422. 785 flag:=2;
  1423. 786 ELSIF((qx < 0) AND (qy < 0)) THEN
  1424. 787 px:=x0-x;
  1425. 788 py:=y0-y;
  1426. 789 flag:=3;
  1427. 790 END;
  1428. 791 res:=(LONGINT(px-x0)*LONGINT(qy)) - (LONGINT(py-y0)*LONGINT(qx));
  1429. ***** ^ not supported yet
  1430. ***** ^ not supported yet
  1431. ***** ^ not supported yet
  1432. ***** ^ not supported yet
  1433. 792 IF res < 0 THEN
  1434. 793 res:=-res;
  1435. 794 END;
  1436. 795 IF LONGCARD(res) > last_difference THEN
  1437. ***** ^ undeclared identifier
  1438. ***** ^ not supported yet
  1439. ***** ^ not supported yet
  1440. 796 RETURN Ret;
  1441. ***** ^ not supported yet
  1442. 797 END;
  1443. 798 last_difference:=res;
  1444. ***** ^ not supported yet
  1445. 799 Ret.x:=px;
  1446. ***** ^ not supported yet
  1447. ***** ^ not supported yet
  1448. 800 Ret.y:=py;
  1449. ***** ^ not supported yet
  1450. ***** ^ not supported yet
  1451. 801 IF d > 0 THEN
  1452. 802 DEC(y);
  1453. ***** ^ undeclared identifier
  1454. ***** ^ not supported yet
  1455. 803 DEC(dy, asq2);
  1456. ***** ^ undeclared identifier
  1457. ***** ^ not supported yet
  1458. 804 DEC(d, dy);
  1459. ***** ^ undeclared identifier
  1460. ***** ^ not supported yet
  1461. 805 END;
  1462. 806 INC(x);
  1463. ***** ^ undeclared identifier
  1464. ***** ^ not supported yet
  1465. 807 INC(dx, bsq2);
  1466. ***** ^ undeclared identifier
  1467. ***** ^ not supported yet
  1468. 808 INC(d, bsq+dx);
  1469. ***** ^ undeclared identifier
  1470. ***** ^ not supported yet
  1471. 809 END;
  1472. 810 INC(d, (3*((asq-bsq)>>1)-((dx+dy)>>1)));
  1473. ***** ^ undeclared identifier
  1474. ***** ^ not supported yet
  1475. 811 last_difference:=MAX(LONGCARD);
  1476. ***** ^ not supported yet
  1477. ***** ^ undeclared identifier
  1478. ***** ^ undeclared identifier
  1479. 812 WHILE y >0 DO
  1480. 813 IF flag = 0 THEN
  1481. 814 px:=x0+x;
  1482. 815 py:=y0+y;
  1483. 816 ELSIF flag = 1 THEN
  1484. 817 px:=x0-x;
  1485. 818 py:=y0+y;
  1486. 819 ELSIF flag = 2 THEN
  1487. 820 px:=x0+x;
  1488. 821 py:=y0-y;
  1489. 822 ELSIF flag = 3 THEN
  1490. 823 px:=x0-x;
  1491. 824 py:=y0-y;
  1492. 825 END;
  1493. 826 res:=LONGINT(px-x0)*LONGINT(qy) - LONGINT(py-y0)*LONGINT(qx);
  1494. ***** ^ not supported yet
  1495. ***** ^ not supported yet
  1496. ***** ^ not supported yet
  1497. ***** ^ not supported yet
  1498. 827 IF res < 0 THEN
  1499. 828 res:=-res;
  1500. 829 END;
  1501. 830 IF LONGCARD(res) > last_difference THEN
  1502. ***** ^ undeclared identifier
  1503. ***** ^ not supported yet
  1504. ***** ^ not supported yet
  1505. 831 RETURN Ret;
  1506. ***** ^ not supported yet
  1507. 832 END;
  1508. 833 last_difference:=res;
  1509. ***** ^ not supported yet
  1510. 834 Ret.x:=px;
  1511. ***** ^ not supported yet
  1512. ***** ^ not supported yet
  1513. 835 Ret.y:=py;
  1514. ***** ^ not supported yet
  1515. ***** ^ not supported yet
  1516. 836 IF d < 0 THEN
  1517. 837 INC(x);
  1518. ***** ^ undeclared identifier
  1519. ***** ^ not supported yet
  1520. 838 INC(dx, bsq2);
  1521. ***** ^ undeclared identifier
  1522. ***** ^ not supported yet
  1523. 839 INC(d, dx);
  1524. ***** ^ undeclared identifier
  1525. ***** ^ not supported yet
  1526. 840 END;
  1527. 841 DEC(y);
  1528. ***** ^ undeclared identifier
  1529. ***** ^ not supported yet
  1530. 842 DEC(dy, asq2);
  1531. ***** ^ undeclared identifier
  1532. ***** ^ not supported yet
  1533. 843 INC(d, asq-dy);
  1534. ***** ^ undeclared identifier
  1535. ***** ^ not supported yet
  1536. 844 END;
  1537. 845 RETURN Ret;
  1538. ***** ^ not supported yet
  1539. 846 END GetVec;
  1540. ***** ^ not supported yet
  1541. 847
  1542. 848
  1543. 849 PROCEDURE HscanLine(VAR xlp, xrp: INTEGER; y, border: INTEGER);
  1544. 850
  1545. 851 VAR
  1546. 852 mask: CARDINAL;
  1547. 853 BEGIN
  1548. 854 CoreGraph._hscan(xlp, xrp, y, border);
  1549. ***** ^ undeclared identifier
  1550. ***** ^ not supported yet
  1551. ***** ^ not supported yet
  1552. 855 mask:=CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(y)*BITSET(7))])
  1553. ***** ^ undeclared identifier
  1554. ***** ^ not supported yet
  1555. ***** ^ undeclared identifier
  1556. ***** ^ not supported yet
  1557. ***** ^ undeclared identifier
  1558. ***** ^ not supported yet
  1559. 856 +CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(y)*BITSET(7))])*100H;
  1560. ***** ^ undeclared identifier
  1561. ***** ^ not supported yet
  1562. ***** ^ undeclared identifier
  1563. ***** ^ not supported yet
  1564. ***** ^ undeclared identifier
  1565. ***** ^ not supported yet
  1566. 857 IF mask = MAX(CARDINAL) THEN
  1567. ***** ^ undeclared identifier
  1568. ***** ^ not supported yet
  1569. 858 CoreGraph._hline(xlp, y, xrp, CoreGraph._fgcolor);
  1570. ***** ^ undeclared identifier
  1571. ***** ^ not supported yet
  1572. ***** ^ undeclared identifier
  1573. ***** ^ not supported yet
  1574. 859 ELSE
  1575. 860 CoreGraph._line(xlp, y, xrp, y, mask);
  1576. ***** ^ undeclared identifier
  1577. ***** ^ not supported yet
  1578. ***** ^ not supported yet
  1579. 861 END;
  1580. 862 END HscanLine;
  1581. ***** ^ not supported yet
  1582. 863
  1583. 864
  1584. 865 PROCEDURE LagFill(xl, xr, y, direction, llim, rlim, border: INTEGER);
  1585. 866
  1586. 867 LABEL
  1587. 868 ReStart;
  1588. ***** ^ not supported yet
  1589. 869 VAR
  1590. 870 x, xsl, v: INTEGER;
  1591. 871 mask: CARDINAL;
  1592. 872 BEGIN
  1593. 873 ReStart:
  1594. ***** ^ undeclared identifier
  1595. 874 DEC(y, direction);
  1596. 875 IF (CoreGraph._clip_tl.ycoord <= y) AND (y <= CoreGraph._clip_br.ycoord) THEN
  1597. 876 mask:=CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(y)*BITSET(7))]);
  1598. 877 x:=xl;
  1599. 878 WHILE x <= llim-1 DO
  1600. 879 IF (BITSET(1<<(CARDINAL(BITSET(x)*BITSET(7)))) * BITSET(mask) # {}) THEN
  1601. 880 v:=CoreGraph._point(x, y);
  1602. 881 IF((v # border) AND (v # CoreGraph._fgcolor)) THEN
  1603. 882 xsl := x;
  1604. 883 HscanLine (xsl, x, y, border);
  1605. 884 LagFill(xsl, x, y, -direction, xl, xr, border);
  1606. 885 END;
  1607. 886 END;
  1608. 887 INC(x);
  1609. 888 END;
  1610. 889 x:=rlim+1;
  1611. 890 WHILE x <= xr DO
  1612. 891 IF (BITSET(1<<(CARDINAL(BITSET(x)*BITSET(7)))) * BITSET(mask) # {}) THEN
  1613. 892 v:=CoreGraph._point(x, y);
  1614. 893 IF((v # border) AND (v # CoreGraph._fgcolor)) THEN
  1615. 894 xsl := x;
  1616. 895 HscanLine(xsl, x, y, border);
  1617. 896 LagFill(xsl, x, y, -direction, xl, xr, border);
  1618. 897 END;
  1619. 898 END;
  1620. 899 INC(x);
  1621. 900 END;
  1622. 901 END;
  1623. 902 INC(y, direction + direction);
  1624. 903 IF ( y >= CoreGraph._clip_tl.ycoord) AND (y <= CoreGraph._clip_br.ycoord ) THEN
  1625. 904 mask:=CARDINAL(CoreGraph._fill_mask[CARDINAL(BITSET(y)*BITSET(7))]);
  1626. 905 x:=xl;
  1627. 906 WHILE x <= xr DO
  1628. 907 IF (BITSET(1<<(CARDINAL(BITSET(x)*BITSET(7)))) * BITSET(mask) # {}) THEN
  1629. 908 v:=CoreGraph._point(x, y);
  1630. 909 IF((v # CoreGraph._fgcolor) AND (v # border)) THEN
  1631. 910 xsl := x;
  1632. 911 HscanLine (xsl, x, y, border);
  1633. 912 IF(x > xr-1) THEN
  1634. 913 (* Do last one iteratively... *)
  1635. 914 llim := xl;
  1636. 915 rlim := xr;
  1637. 916 xl := xsl;
  1638. 917 xr := x;
  1639. 918 GOTO ReStart;
  1640. 919 ELSE
  1641. 920 LagFill(xsl, x, y, direction, xl, xr, border);
  1642. 921 END;
  1643. 922 END;
  1644. 923 END;
  1645. 924 INC(x);
  1646. 925 END;
  1647. 926 END;
  1648. 927 RETURN;
  1649. 928 END LagFill;
  1650. 929 (*# restore *)
  1651. 930 (*****************************************************************************)
  1652. 931 (* Function definitions - CGA specIFic *)
  1653. 932 (*****************************************************************************)
  1654. 933
  1655. 934 (*# save *)
  1656. 935 (*# call(reg_param => (ax,bx,cx,dx,st0,st6,st5,st4,st3), reg_saved=>(ds, di, si,st1,st2), c_conv=>off) *)
  1657. 936
  1658. 937
  1659. 938 PROCEDURE _CGA320Plot(x, y, c: INTEGER);
  1660. 939
  1661. 940 VAR
  1662. 941 ptr: CGAPointer;
  1663. 942 ofs: CARDINAL;
  1664. 943 BEGIN
  1665. 944 ofs:=(CARDINAL(x)>>2)+((2000H-40)* CARDINAL( BITSET(y)*BITSET(1) ) )+ (40*CARDINAL(y));
  1666. 945 ptr := [SEL_B800H:ofs];
  1667. 946 x := 3 - INTEGER(BITSET(x)*BITSET(3));
  1668. 947 x := x << 1;
  1669. 948 ptr^ := SHORTCARD((BITSET(ptr^) - BITSET(3<<x)) + BITSET(c<<x));
  1670. 949 RETURN;
  1671. 950 END _CGA320Plot;
  1672. 951
  1673. 952 PROCEDURE _CGA640Plot(x, y, c: INTEGER);
  1674. 953
  1675. 954 VAR
  1676. 955 ptr: CGAPointer;
  1677. 956 ofs: CARDINAL;
  1678. 957 mask: CARDINAL;
  1679. 958 BEGIN
  1680. 959 ofs:=(CARDINAL(x)>>3)+((2000H-40)* CARDINAL( BITSET(y)*BITSET(1) ) )+ (40*CARDINAL(y));
  1681. 960 ptr := [SEL_B800H:ofs];
  1682. 961 x:= INTEGER(BITSET(x) * BITSET(7));
  1683. 962 mask:=80H>>x;
  1684. 963 IF(c # 0) THEN
  1685. 964 c:=mask;
  1686. 965 END;
  1687. 966 ptr^ := SHORTCARD((BITSET(ptr^) - BITSET(mask)) + BITSET(c));
  1688. 967 RETURN;
  1689. 968 END _CGA640Plot;
  1690. 969
  1691. 970 PROCEDURE _CGA320Point(x, y: INTEGER): INTEGER;
  1692. 971
  1693. 972 VAR
  1694. 973 ptr: CGAPointer;
  1695. 974 ofs: CARDINAL;
  1696. 975 BEGIN
  1697. 976 ofs:=(CARDINAL(x)>>2)+((2000H-40)* CARDINAL( BITSET(y)*BITSET(1) ) )+ (40*CARDINAL(y));
  1698. 977 ptr := [SEL_B800H:ofs];
  1699. 978 x := 3 - INTEGER(BITSET(x)*BITSET(3));
  1700. 979 x := (x<<1);
  1701. 980 RETURN( CARDINAL(BITSET(ptr^) * BITSET(3<<x)) >> CARDINAL(x));
  1702. 981 END _CGA320Point;
  1703. 982
  1704. 983 PROCEDURE _CGA640Point(x, y: INTEGER): INTEGER;
  1705. 984
  1706. 985 VAR
  1707. 986 c: SHORTCARD;
  1708. 987 ptr: CGAPointer;
  1709. 988 ofs: CARDINAL;
  1710. 989 BEGIN
  1711. 990 ofs:=(CARDINAL(x)>>3)+((2000H-40)* CARDINAL( BITSET(y)*BITSET(1) ) )+ (40*CARDINAL(y));
  1712. 991 ptr := [SEL_B800H:ofs];
  1713. 992 x:=INTEGER(BITSET(x) * BITSET(7));
  1714. 993 c:=SHORTCARD(80H>>x);
  1715. 994 IF(BITSET(ptr^)* BITSET(c) # {}) THEN
  1716. 995 RETURN 1;
  1717. 996 END;
  1718. 997 RETURN 0;
  1719. 998 END _CGA640Point;
  1720. 999
  1721. 1000 PROCEDURE _CGA320HScan(VAR xl, xr: INTEGER; y, border: INTEGER);
  1722. 1001
  1723. 1002 VAR
  1724. 1003 row, left, right: INTEGER;
  1725. 1004 BEGIN
  1726. 1005 left:=xl;
  1727. 1006 right:=xr;
  1728. 1007 row:=((2000H-40)*INTEGER(BITSET(y) * BITSET(1)))+(40*y);
  1729. 1008 xl:=CoreGraph._CGA320leftscan((left>>2)+row, border, CoreGraph._clip_tl.xcoord, left);
  1730. 1009 xr:=CoreGraph._CGA320rightscan((right>>2)+row, border, CoreGraph._clip_br.xcoord, right);
  1731. 1010 END _CGA320HScan;
  1732. 1011
  1733. 1012 PROCEDURE _CGA640HScan(VAR xl, xr: INTEGER; y, border: INTEGER);
  1734. 1013
  1735. 1014 VAR
  1736. 1015 row, left, right: INTEGER;
  1737. 1016 BEGIN
  1738. 1017 left:=xl;
  1739. 1018 right:=xr;
  1740. 1019 IF border # 0 THEN
  1741. 1020 border:=1;
  1742. 1021 END;
  1743. 1022 row:=((2000H-40)*INTEGER(BITSET(y)*BITSET(1)))+(40*y);
  1744. 1023 xl:=CoreGraph._CGA640leftscan((left>>3)+row, border, CoreGraph._clip_tl.xcoord, left);
  1745. 1024 xr:=CoreGraph._CGA640rightscan((right>>3)+row, border, CoreGraph._clip_br.xcoord, right);
  1746. 1025 END _CGA640HScan;
  1747. 1026
  1748. 1027 (*****************************************************************************)
  1749. 1028 (* Function definitions - VGA 256 color specIFic. *)
  1750. 1029 (*****************************************************************************)
  1751. 1030
  1752. 1031
  1753. 1032 PROCEDURE _VGAPlot(x, y, c: INTEGER);
  1754. 1033
  1755. 1034 VAR
  1756. 1035 ptr: VGAPointer;
  1757. 1036 BEGIN
  1758. 1037 ptr := [SEL_A000H:y*(VGA256Width)+x];
  1759. 1038 ptr^:= SHORTCARD(c);
  1760. 1039 END _VGAPlot;
  1761. 1040
  1762. 1041 PROCEDURE _VGAHScan(VAR xl, xr: INTEGER; y, border: INTEGER);
  1763. 1042
  1764. 1043 VAR
  1765. 1044 left, right: INTEGER;
  1766. 1045 ptr: CARDINAL;
  1767. 1046 BEGIN
  1768. 1047 left:=xl;
  1769. 1048 right:=xr;
  1770. 1049 y:=y*(VGA256Width);
  1771. 1050 ptr:=y+left;
  1772. 1051 xl:=CoreGraph._VGAleftscan(ptr, border, CoreGraph._clip_tl.xcoord, left);
  1773. 1052 ptr:=y+right;
  1774. 1053 xr:=CoreGraph._VGArightscan(ptr, border, CoreGraph._clip_br.xcoord, right);
  1775. 1054 RETURN;
  1776. 1055 END _VGAHScan;
  1777. 1056
  1778. 1057 (*****************************************************************************)
  1779. 1058 (* Function definitions - VGA and EGA native mode specIFic. *)
  1780. 1059 (*****************************************************************************)
  1781. 1060
  1782. 1061 PROCEDURE EGAHScan(VAR xl, xr: INTEGER; y, border: INTEGER);
  1783. 1062 VAR
  1784. 1063 left,right : INTEGER;
  1785. 1064 p,pp : CARDINAL;
  1786. 1065 ptr : FarADDRESS;
  1787. 1066 BEGIN
  1788. 1067 IF CoreGraph._EGAtranslate # 0 THEN
  1789. 1068 border:=CoreGraph._EGAxlat(border);
  1790. 1069 END; (*IF*)
  1791. 1070 left := xl;
  1792. 1071 right := xr;
  1793. 1072 pp := (CARDINAL(y) * CoreGraph._width) + (CoreGraph._active_page*CoreGraph._page_size) << 4;
  1794. 1073 p := CARDINAL(left>>3) + pp;
  1795. 1074 ptr := [SEL_A000H:p];
  1796. 1075 xl := CoreGraph._EGAleftscan(ptr, border, CoreGraph._clip_tl.xcoord, left);
  1797. 1076 p := CARDINAL(right>>3) + pp;
  1798. 1077 ptr := [SEL_A000H:p];
  1799. 1078 xr := CoreGraph._EGArightscan(ptr, border, CoreGraph._clip_br.xcoord, right);
  1800. 1079 END EGAHScan;
  1801. 1080
  1802. 1081 PROCEDURE GenericHScan(VAR xl, xr: INTEGER; y, border: INTEGER);
  1803. 1082
  1804. 1083 VAR
  1805. 1084 v, left, right: INTEGER;
  1806. 1085 BEGIN
  1807. 1086 left:=xl;
  1808. 1087 right:=xr;
  1809. 1088 REPEAT
  1810. 1089 DEC(left);
  1811. 1090 v:=CoreGraph._point(left, y);
  1812. 1091 UNTIL (v = border) OR (v = CoreGraph._fgcolor) OR (left < CoreGraph._clip_tl.xcoord);
  1813. 1092 INC(left);
  1814. 1093 REPEAT
  1815. 1094 INC(right);
  1816. 1095 v:=CoreGraph._point(right, y);
  1817. 1096 UNTIL (v = border) OR (v = CoreGraph._fgcolor) OR (right > CoreGraph._clip_br.xcoord);
  1818. 1097 DEC(right);
  1819. 1098 xl:=left;
  1820. 1099 xr:=right;
  1821. 1100 END GenericHScan;
  1822. 1101
  1823. 1102 (*****************************************************************************)
  1824. 1103 (* Function definitions - Hercules specIFic. *)
  1825. 1104 (*****************************************************************************)
  1826. 1105
  1827. 1106 PROCEDURE HercPlot(x,y,c: INTEGER);
  1828. 1107
  1829. 1108 VAR
  1830. 1109 Byte: bs;
  1831. 1110 BEGIN
  1832. 1111 IF (x > HercWidth) OR (y > HercDepth) THEN
  1833. 1112 RETURN;
  1834. 1113 END;
  1835. 1114 Byte:=HercBitMap[CoreGraph._active_page][y MOD 4]^[y >> 2][x >> 3];
  1836. 1115 IF c = 0 THEN
  1837. 1116 Byte:=Byte - bs{(7-(CARDINAL(x) MOD 8))};
  1838. 1117 ELSE
  1839. 1118 Byte:=Byte + bs{(7-(CARDINAL(x) MOD 8))};
  1840. 1119 END;
  1841. 1120 HercBitMap[CoreGraph._active_page][y MOD 4]^[y >> 2][x >> 3]:=Byte;
  1842. 1121 END HercPlot;
  1843. 1122
  1844. 1123 PROCEDURE HercPoint(x,y: INTEGER) : INTEGER;
  1845. 1124 BEGIN
  1846. 1125 IF (x > HercWidth) OR (y > HercDepth) THEN RETURN MAX(CARDINAL); END;
  1847. 1126 IF bs{7-(CARDINAL(x) MOD 8)} * HercBitMap[CoreGraph._active_page][y MOD 4]^[y >> 2][x >> 3] # bs(0) THEN
  1848. 1127 RETURN 1;
  1849. 1128 ELSE
  1850. 1129 RETURN 0;
  1851. 1130 END;
  1852. 1131 END HercPoint;
  1853. 1132
  1854. 1133 (*# restore *)
  1855. 1134
  1856. 1135 PROCEDURE HercGraphMode;
  1857. 1136 TYPE
  1858. 1137 DataType = ARRAY[0..11] OF SHORTCARD ;
  1859. 1138 CONST
  1860. 1139 Data = DataType(35H,2DH,2EH,07H,5BH,02H,57H,57H,02H,03H,00H,00H);
  1861. 1140 VAR
  1862. 1141 I: CARDINAL;
  1863. 1142 BEGIN
  1864. 1143 SYSTEM.Out(3BFH,03H); (* Remove this if do NOT want to override
  1865. 1144 the hercules text mode lock *)
  1866. 1145 Lib.Delay(10);
  1867. 1146 SYSTEM.Out(3B8H,02H);
  1868. 1147 FOR I:= 0 TO 11 DO
  1869. 1148 SYSTEM.Out(3B4H,SHORTCARD(I));
  1870. 1149 SYSTEM.Out(3B5H,Data[I])
  1871. 1150 END;
  1872. 1151 Lib.FarWordFill([SEL_B000H:0],4000H,0);
  1873. 1152 Lib.Delay(500);
  1874. 1153 SYSTEM.Out(3B8H,0AH)
  1875. 1154 END HercGraphMode;
  1876. 1155
  1877. 1156 PROCEDURE HercTextMode;
  1878. 1157 TYPE
  1879. 1158 DataType = ARRAY[0..11] OF SHORTCARD ;
  1880. 1159 CONST
  1881. 1160 Data = DataType(61H,50H,52H,0FH,19H,06H,19H,19H,02H,0DH,0BH,0CH);
  1882. 1161 VAR
  1883. 1162 I: CARDINAL;
  1884. 1163 BEGIN
  1885. 1164 SYSTEM.Out(3B8H,20H);
  1886. 1165 FOR I:= 0 TO 11 DO
  1887. 1166 SYSTEM.Out(3B4H,SHORTCARD(I));
  1888. 1167 SYSTEM.Out(3B5H,Data[I])
  1889. 1168 END;
  1890. 1169 Lib.FarWordFill([SEL_B000H:0],2000,720H);
  1891. 1170 Lib.Delay(500);
  1892. 1171 SYSTEM.Out(3B8H,28H)
  1893. 1172 END HercTextMode;
  1894. 1173
  1895. 1174
  1896. 1175 PROCEDURE InternalInitCGA(mode: CARDINAL);
  1897. 1176
  1898. 1177 BEGIN
  1899. 1178 IF((mode = 4) OR (mode = 5)) THEN
  1900. 1179 CoreGraph._plot := _CGA320Plot;
  1901. 1180 CoreGraph._point := _CGA320Point;
  1902. 1181 CoreGraph._hline := CoreGraph._CGA320HLine;
  1903. 1182 CoreGraph._line := CoreGraph._CGA320Line;
  1904. 1183 CoreGraph._hscan := _CGA320HScan;
  1905. 1184 CoreGraph._put := CoreGraph._CGA320Put;
  1906. 1185 CoreGraph._get := CoreGraph._CGA320Get;
  1907. 1186 CoreGraph._width := CGA320Width-1;
  1908. 1187 ELSE
  1909. 1188 CoreGraph._plot := _CGA640Plot ;
  1910. 1189 CoreGraph._point := _CGA640Point ;
  1911. 1190 CoreGraph._line := CoreGraph._CGA640Line ;
  1912. 1191 CoreGraph._hline := CoreGraph._CGA640HLine ;
  1913. 1192 CoreGraph._hscan := _CGA640HScan;
  1914. 1193 CoreGraph._put := CoreGraph._CGA640Put;
  1915. 1194 CoreGraph._get := CoreGraph._CGA640Get;
  1916. 1195 CoreGraph._width := CGA640Width-1;
  1917. 1196 END;
  1918. 1197 CoreGraph._depth:=CGADepth-1;
  1919. 1198 END InternalInitCGA;
  1920. 1199
  1921. 1200 PROCEDURE InternalInitEGA(mode: CARDINAL);
  1922. 1201
  1923. 1202 BEGIN
  1924. 1203 IF mode = 13 THEN
  1925. 1204 CoreGraph._width := 40;
  1926. 1205 CoreGraph._depth := EGA200Depth-1;
  1927. 1206 ELSIF mode = 14 THEN
  1928. 1207 CoreGraph._width := 80;
  1929. 1208 CoreGraph._depth := EGA200Depth-1;
  1930. 1209 ELSIF mode <= 16 THEN
  1931. 1210 CoreGraph._width := 80;
  1932. 1211 CoreGraph._depth := EGA350Depth-1;
  1933. 1212 ELSIF mode <= 18 THEN
  1934. 1213 CoreGraph._width := 80;
  1935. 1214 CoreGraph._depth := EGA480Depth-1;
  1936. 1215 END;
  1937. 1216 CoreGraph._EGAtranslate:=0;
  1938. 1217 IF mode = 15 THEN
  1939. 1218 CoreGraph._EGAStartPlane:=2;
  1940. 1219 CoreGraph._EGAPlaneShift:=2;
  1941. 1220 CoreGraph._EGAtranslate:=1;
  1942. 1221 ELSIF mode = 17 THEN
  1943. 1222 CoreGraph._EGAStartPlane:=0;
  1944. 1223 CoreGraph._EGAPlaneShift:=1;
  1945. 1224 ELSE
  1946. 1225 CoreGraph._EGAStartPlane:=3;
  1947. 1226 CoreGraph._EGAPlaneShift:=1;
  1948. 1227 END;
  1949. 1228 IF((CoreGraph._EGA64K = TRUE) AND ((mode = _ERESCOLOR) OR (mode = _ERESNOCOLOR))) THEN
  1950. 1229 CoreGraph._EGAStartPlane:=2;
  1951. 1230 CoreGraph._EGAPlaneShift:=2;
  1952. 1231 CoreGraph._EGAtranslate:=1;
  1953. 1232 CoreGraph._hscan:= GenericHScan;
  1954. 1233 ELSE
  1955. 1234 CoreGraph._hscan:= EGAHScan;
  1956. 1235 END;
  1957. 1236 CoreGraph._put := CoreGraph._EGAPut;
  1958. 1237 CoreGraph._get := CoreGraph._EGAGet;
  1959. 1238 IF mode = _VRES2COLOR THEN
  1960. 1239 CoreGraph._line := CoreGraph._EGA2Line;
  1961. 1240 CoreGraph._plot := CoreGraph._EGA2Plot;
  1962. 1241 CoreGraph._point := CoreGraph._EGA2Point;
  1963. 1242 CoreGraph._hline := CoreGraph._EGA2HLine;
  1964. 1243 ELSE
  1965. 1244 CoreGraph._line := CoreGraph._EGALine;
  1966. 1245 CoreGraph._plot := CoreGraph._EGAPlot;
  1967. 1246 CoreGraph._point := CoreGraph._EGAPoint;
  1968. 1247 CoreGraph._hline := CoreGraph._EGAHLine;
  1969. 1248 END;
  1970. 1249 (* _resetEGA();*)
  1971. 1250 END InternalInitEGA;
  1972. 1251
  1973. 1252 PROCEDURE InternalInitVGA256();
  1974. 1253
  1975. 1254 BEGIN
  1976. 1255 CoreGraph._width := VGA256Width;
  1977. 1256 CoreGraph._depth := VGA256Depth-1;
  1978. 1257 CoreGraph._plot := _VGAPlot;
  1979. 1258 CoreGraph._point := CoreGraph._VGAPoint;
  1980. 1259 CoreGraph._line := CoreGraph._VGALine;
  1981. 1260 CoreGraph._hline := CoreGraph._VGAHLine;
  1982. 1261 CoreGraph._hscan := _VGAHScan;
  1983. 1262 CoreGraph._put := CoreGraph._VGAPut;
  1984. 1263 CoreGraph._get := CoreGraph._VGAGet;
  1985. 1264 END InternalInitVGA256;
  1986. 1265
  1987. 1266 PROCEDURE InternalInitHerc();
  1988. 1267
  1989. 1268 BEGIN
  1990. 1269 CoreGraph._depth := HercDepth-1;
  1991. 1270 CoreGraph._width := HercWidth-1;
  1992. 1271 CoreGraph._plot := HercPlot ;
  1993. 1272 CoreGraph._point := HercPoint ;
  1994. 1273 CoreGraph._line := CoreGraph._HercLine ;
  1995. 1274 CoreGraph._hline := CoreGraph._HercHLine ;
  1996. 1275 CoreGraph._hscan := GenericHScan ;
  1997. 1276 CoreGraph._put := CoreGraph._HercPut;
  1998. 1277 CoreGraph._get := CoreGraph._HercGet;
  1999. 1278 HercBitMap[0][0]:= [SEL_B000H:0]; (* Initialise BitMap pointers *)
  2000. 1279 HercBitMap[0][1]:= [SEL_B000H:02000H];
  2001. 1280 HercBitMap[0][2]:= [SEL_B000H:04000H];
  2002. 1281 HercBitMap[0][3]:= [SEL_B000H:06000H];
  2003. 1282 HercBitMap[1][0]:= [SEL_B800H:0]; (* 2nd Page *)
  2004. 1283 HercBitMap[1][1]:= [SEL_B800H:02000H];
  2005. 1284 HercBitMap[1][2]:= [SEL_B800H:04000H];
  2006. 1285 HercBitMap[1][3]:= [SEL_B800H:06000H];
  2007. 1286 END InternalInitHerc;
  2008. 1287
  2009. 1288 (*****************************************************************************)
  2010. 1289 (* Function definitions - Misc low level and initialisation. *)
  2011. 1290 (*****************************************************************************)
  2012. 1291
  2013. 1292 CONST
  2014. 1293 MDA = 1;
  2015. 1294 CGA = 2;
  2016. 1295 EGA = 3;
  2017. 1296 MCGA = 4;
  2018. 1297 VGA = 5;
  2019. 1298 HGC = 80H;
  2020. 1299 HGCPlus= 81H;
  2021. 1300 InColor= 82H;
  2022. 1301
  2023. 1302 MDADisplay = 1;
  2024. 1303 CGADisplay = 2;
  2025. 1304 EGAColorDisplay = 3;
  2026. 1305 PS2MonoDisplay = 4;
  2027. 1306 PS2ColorDisplay = 5;
  2028. 1307
  2029. 1308 (*# save *)
  2030. 1309 (*# call(near_call=>on) *)
  2031. 1310 PROCEDURE SetLimits(VAR v: CoreGraph.VideoConfig);
  2032. 1311
  2033. 1312 BEGIN
  2034. 1313 CASE v.mode OF
  2035. 1314 | 0:
  2036. 1315 v.numxpixels := 0;
  2037. 1316 v.numypixels := 0;
  2038. 1317 v.numtextcols := 40;
  2039. 1318 v.numtextrows := 25;
  2040. 1319 v.numcolors := 32;
  2041. 1320 v.bitsperpixel := 0;
  2042. 1321 v.numvideopages := 8;
  2043. 1322 CoreGraph._txcolor := 15;
  2044. 1323 CoreGraph._scr_attr := 7;
  2045. 1324 | 1:
  2046. 1325 v.numxpixels := 0;
  2047. 1326 v.numypixels := 0;
  2048. 1327 v.numtextcols := 40;
  2049. 1328 v.numtextrows := 25;
  2050. 1329 v.numcolors := 32;
  2051. 1330 v.bitsperpixel := 0;
  2052. 1331 v.numvideopages := 8;
  2053. 1332 CoreGraph._txcolor := 15;
  2054. 1333 CoreGraph._scr_attr := 7;
  2055. 1334 | 2:
  2056. 1335 v.numxpixels := 0;
  2057. 1336 v.numypixels := 0;
  2058. 1337 v.numtextcols := 80;
  2059. 1338 v.numtextrows := 25;
  2060. 1339 v.numcolors := 32;
  2061. 1340 v.bitsperpixel := 0;
  2062. 1341 v.numvideopages := 4;
  2063. 1342 CoreGraph._txcolor := 15;
  2064. 1343 CoreGraph._scr_attr := 7;
  2065. 1344 | 3:
  2066. 1345 v.numxpixels := 0;
  2067. 1346 v.numypixels := 0;
  2068. 1347 v.numtextcols := 80;
  2069. 1348 v.numtextrows := 25;
  2070. 1349 v.numcolors := 32;
  2071. 1350 v.bitsperpixel := 0;
  2072. 1351 v.numvideopages := 4;
  2073. 1352 CoreGraph._txcolor := 15;
  2074. 1353 CoreGraph._scr_attr := 7;
  2075. 1354 | 4:
  2076. 1355 v.numxpixels := 320;
  2077. 1356 v.numypixels := 200;
  2078. 1357 v.numtextcols := 40;
  2079. 1358 v.numtextrows := 25;
  2080. 1359 v.numcolors := 4;
  2081. 1360 v.bitsperpixel := 2;
  2082. 1361 v.numvideopages := 1;
  2083. 1362 CoreGraph._fgcolor := 3;
  2084. 1363 CoreGraph._scr_attr := 0;
  2085. 1364 | 5:
  2086. 1365 v.numxpixels := 320;
  2087. 1366 v.numypixels := 200;
  2088. 1367 v.numtextcols := 40;
  2089. 1368 v.numtextrows := 25;
  2090. 1369 v.numcolors := 4;
  2091. 1370 v.bitsperpixel := 2;
  2092. 1371 v.numvideopages := 1;
  2093. 1372 CoreGraph._page_size:= 0;
  2094. 1373 CoreGraph._scr_attr := 0;
  2095. 1374 CoreGraph._fgcolor := 3;
  2096. 1375 | 6:
  2097. 1376 v.numxpixels := 640;
  2098. 1377 v.numypixels := 200;
  2099. 1378 v.numtextcols := 80;
  2100. 1379 v.numtextrows := 25;
  2101. 1380 v.numcolors := 2;
  2102. 1381 v.bitsperpixel := 1;
  2103. 1382 v.numvideopages := 1;
  2104. 1383 CoreGraph._page_size:= 0;
  2105. 1384 CoreGraph._scr_attr := 0;
  2106. 1385 CoreGraph._fgcolor := 1;
  2107. 1386 | 7:
  2108. 1387 v.numxpixels := 0;
  2109. 1388 v.numypixels := 0;
  2110. 1389 v.numtextcols := 80;
  2111. 1390 v.numtextrows := 25;
  2112. 1391 v.numcolors := 2;
  2113. 1392 v.bitsperpixel := 0;
  2114. 1393 v.numvideopages := 4;
  2115. 1394 CoreGraph._txcolor := 1;
  2116. 1395 CoreGraph._scr_attr := 7;
  2117. 1396 | 8:
  2118. 1397 v.numxpixels := 720;
  2119. 1398 v.numypixels := 348;
  2120. 1399 v.numtextcols := 80;
  2121. 1400 v.numtextrows := 25;
  2122. 1401 v.numcolors := 2;
  2123. 1402 v.bitsperpixel := 1;
  2124. 1403 v.numvideopages := 2;
  2125. 1404 CoreGraph._page_size:= 800H;
  2126. 1405 CoreGraph._fgcolor := 1;
  2127. 1406 CoreGraph._scr_attr := 0;
  2128. 1407 | 13:
  2129. 1408 v.numxpixels := 320;
  2130. 1409 v.numypixels := 200;
  2131. 1410 v.numtextcols := 40;
  2132. 1411 v.numtextrows := 25;
  2133. 1412 v.numcolors := 16;
  2134. 1413 v.bitsperpixel := 4;
  2135. 1414 v.numvideopages := CoreGraph._current_video.memory DIV 32;
  2136. 1415 CoreGraph._page_size:= 200H;
  2137. 1416 CoreGraph._fgcolor := 15;
  2138. 1417 CoreGraph._scr_attr := 0;
  2139. 1418 | 14:
  2140. 1419 v.numxpixels := 640;
  2141. 1420 v.numypixels := 200;
  2142. 1421 v.numtextcols := 80;
  2143. 1422 v.numtextrows := 25;
  2144. 1423 v.numcolors := 16;
  2145. 1424 v.bitsperpixel := 4;
  2146. 1425 v.numvideopages := CoreGraph._current_video.memory DIV 64;
  2147. 1426 CoreGraph._page_size:= 400H;
  2148. 1427 CoreGraph._fgcolor := 15;
  2149. 1428 CoreGraph._scr_attr := 0;
  2150. 1429 | 15:
  2151. 1430 v.numxpixels := 640;
  2152. 1431 v.numypixels := 350;
  2153. 1432 v.numtextcols := 80;
  2154. 1433 v.numtextrows := 25;
  2155. 1434 v.numcolors := 4;
  2156. 1435 v.bitsperpixel := 2;
  2157. 1436 v.numvideopages := 2;
  2158. 1437 CoreGraph._page_size:= 800H;
  2159. 1438 CoreGraph._fgcolor := 3;
  2160. 1439 CoreGraph._scr_attr := 0;
  2161. 1440 | 16:
  2162. 1441 v.numxpixels := 640;
  2163. 1442 v.numypixels := 350;
  2164. 1443 v.numtextcols := 80;
  2165. 1444 v.numtextrows := 25;
  2166. 1445 v.numcolors := 16;
  2167. 1446 v.bitsperpixel := 4;
  2168. 1447 v.numvideopages := 2;
  2169. 1448 CoreGraph._page_size:= 800H;
  2170. 1449 CoreGraph._fgcolor := 15;
  2171. 1450 CoreGraph._scr_attr := 0;
  2172. 1451 | 17:
  2173. 1452 v.numxpixels := 640;
  2174. 1453 v.numypixels := 480;
  2175. 1454 v.numtextcols := 80;
  2176. 1455 v.numtextrows := 30;
  2177. 1456 v.numcolors := 2;
  2178. 1457 v.bitsperpixel := 1;
  2179. 1458 v.numvideopages := 1;
  2180. 1459 CoreGraph._page_size:= 0;
  2181. 1460 CoreGraph._fgcolor := 1;
  2182. 1461 CoreGraph._scr_attr := 0;
  2183. 1462 | 18:
  2184. 1463 v.numxpixels := 640;
  2185. 1464 v.numypixels := 480;
  2186. 1465 v.numtextcols := 80;
  2187. 1466 v.numtextrows := 30;
  2188. 1467 v.numcolors := 16;
  2189. 1468 v.bitsperpixel := 4;
  2190. 1469 v.numvideopages := 1;
  2191. 1470 CoreGraph._fgcolor := 15;
  2192. 1471 CoreGraph._page_size:= 0;
  2193. 1472 CoreGraph._scr_attr := 0;
  2194. 1473 | 19:
  2195. 1474 v.numxpixels := 320;
  2196. 1475 v.numypixels := 200;
  2197. 1476 v.numtextcols := 40;
  2198. 1477 v.numtextrows := 25;
  2199. 1478 v.numcolors := 256;
  2200. 1479 v.bitsperpixel := 8;
  2201. 1480 v.numvideopages := 1;
  2202. 1481 CoreGraph._fgcolor := 255;
  2203. 1482 CoreGraph._page_size:= 0;
  2204. 1483 CoreGraph._scr_attr := 0;
  2205. 1484 END;
  2206. 1485 CoreGraph._clip_tl.xcoord :=0;
  2207. 1486 CoreGraph._clip_tl.ycoord :=0;
  2208. 1487 CoreGraph._clip_br.xcoord :=v.numxpixels-1;
  2209. 1488 CoreGraph._clip_br.ycoord :=v.numypixels-1;
  2210. 1489 CoreGraph._text_tl.row :=0;
  2211. 1490 CoreGraph._text_tl.col :=0;
  2212. 1491 CoreGraph._text_br.row :=v.numtextrows-1;
  2213. 1492 CoreGraph._text_br.col :=v.numtextcols-1;
  2214. 1493 END SetLimits;
  2215. 1494
  2216. 1495 PROCEDURE GEnter();
  2217. 1496
  2218. 1497 BEGIN
  2219. 1498 IF CoreGraph._cursor_state = _GCURSORON THEN
  2220. 1499 CoreGraph._gcur(0, CoreGraph._current_text.row, CoreGraph._current_text.col, CoreGraph._visual_page);
  2221. 1500 INC(CoreGraph._cursor_lock);
  2222. 1501 END;
  2223. 1502 END GEnter;
  2224. 1503
  2225. 1504 PROCEDURE GExit();
  2226. 1505
  2227. 1506 BEGIN
  2228. 1507 IF(CoreGraph._cursor_state = _GCURSORON) THEN
  2229. 1508 DEC(CoreGraph._cursor_lock);
  2230. 1509 IF (CoreGraph._cursor_lock = 0) THEN
  2231. 1510 CoreGraph._gcur(CoreGraph._txcolor, CoreGraph._current_text.row, CoreGraph._current_text.col, CoreGraph._visual_page);
  2232. 1511 END;
  2233. 1512 END;
  2234. 1513 END GExit;
  2235. 1514
  2236. 1515 PROCEDURE EGAcolXlat(Color: LONGCARD): INTEGER;
  2237. 1516
  2238. 1517 TYPE
  2239. 1518 LongSet = SET OF [0..31];
  2240. 1519 VAR
  2241. 1520 ncol, blue, green, red: CARDINAL;
  2242. 1521 BEGIN
  2243. 1522 blue:= CARDINAL(LONGCARD(LongSet(Color)*LongSet(0FF0000H))>>16);
  2244. 1523 green:= CARDINAL(LONGCARD(LongSet(Color)*LongSet(0FF00H))>>8);
  2245. 1524 red:= CARDINAL(LongSet(Color)*LongSet(0FFH));
  2246. 1525
  2247. 1526 IF red = 0 THEN
  2248. 1527 ncol:=0;
  2249. 1528 ELSIF red <= 015H THEN
  2250. 1529 ncol:=32;
  2251. 1530 ELSIF red <= 02AH THEN
  2252. 1531 ncol:=4;
  2253. 1532 ELSE
  2254. 1533 ncol:=36;
  2255. 1534 END;
  2256. 1535 IF green # 0 THEN
  2257. 1536 IF green <= 015H THEN
  2258. 1537 INC(ncol, 16);
  2259. 1538 ELSIF green <= 02AH THEN
  2260. 1539 INC(ncol, 2);
  2261. 1540 ELSE
  2262. 1541 INC(ncol, 18);
  2263. 1542 END;
  2264. 1543 END;
  2265. 1544 IF blue # 0 THEN
  2266. 1545 IF blue <= 015H THEN
  2267. 1546 INC(ncol, 8);
  2268. 1547 ELSIF blue <= 02AH THEN
  2269. 1548 INC(ncol, 1);
  2270. 1549 ELSE
  2271. 1550 INC(ncol, 9);
  2272. 1551 END;
  2273. 1552 END;
  2274. 1553 RETURN ncol;
  2275. 1554 END EGAcolXlat;
  2276. 1555
  2277. 1556 PROCEDURE ColXlat(Color: LONGCARD): INTEGER;
  2278. 1557
  2279. 1558 VAR
  2280. 1559 n: INTEGER;
  2281. 1560 BEGIN
  2282. 1561 n:=0;
  2283. 1562 LOOP
  2284. 1563 IF n = 16 THEN EXIT END;
  2285. 1564 IF ColTable[n] = Color THEN EXIT END;
  2286. 1565 INC(n);
  2287. 1566 END;
  2288. 1567 RETURN n;
  2289. 1568 END ColXlat;
  2290. 1569
  2291. 1570 PROCEDURE Scroll();
  2292. 1571
  2293. 1572 VAR
  2294. 1573 r: SYSTEM.Registers;
  2295. 1574 BEGIN
  2296. 1575 r.AX:=0601H;
  2297. 1576 r.BH:=SHORTCARD(CoreGraph._scr_attr);
  2298. 1577 r.CH:=SHORTCARD(CoreGraph._text_tl.row);
  2299. 1578 r.CL:=SHORTCARD(CoreGraph._text_tl.col);
  2300. 1579 r.DH:=SHORTCARD(CoreGraph._text_br.row);
  2301. 1580 r.DL:=SHORTCARD(CoreGraph._text_br.col);
  2302. 1581 Lib.Intr(r, 10H);
  2303. 1582 END Scroll;
  2304. 1583
  2305. 1584 (*# restore *)
  2306. 1585
  2307. 1586 (*****************************************************************************)
  2308. 1587 (* Public Function definitions. *)
  2309. 1588 (*****************************************************************************)
  2310. 1589
  2311. 1590 PROCEDURE GetVideoConfig(VAR V: VideoConfig);
  2312. 1591
  2313. 1592 BEGIN
  2314. 1593 IF CoreGraph._defaultmode = 0 THEN RETURN END;
  2315. 1594 Lib.FastMove(ADR(CoreGraph._current_video), ADR(V), SIZE(VideoConfig));
  2316. 1595 END GetVideoConfig;
  2317. 1596
  2318. 1597 PROCEDURE SetClipRgn(x1, y1, x2, y2: CARDINAL);
  2319. 1598
  2320. 1599 PROCEDURE Max(A, B: CARDINAL): CARDINAL;
  2321. 1600
  2322. 1601 BEGIN
  2323. 1602 IF A > B THEN
  2324. 1603 RETURN A;
  2325. 1604 ELSE
  2326. 1605 RETURN B;
  2327. 1606 END;
  2328. 1607 END Max;
  2329. 1608
  2330. 1609 PROCEDURE Min(A, B: CARDINAL): CARDINAL;
  2331. 1610
  2332. 1611 BEGIN
  2333. 1612 IF A < B THEN
  2334. 1613 RETURN A;
  2335. 1614 ELSE
  2336. 1615 RETURN B;
  2337. 1616 END;
  2338. 1617 END Min;
  2339. 1618
  2340. 1619 BEGIN
  2341. 1620 CoreGraph._clip_tl.xcoord:=Max(x1, 0);
  2342. 1621 CoreGraph._clip_tl.ycoord:=Max(y1, 0);
  2343. 1622 CoreGraph._clip_br.xcoord:=Min(x2, CoreGraph._current_video.numxpixels-1);
  2344. 1623 CoreGraph._clip_br.ycoord:=Min(y2, CoreGraph._current_video.numypixels-1);
  2345. 1624 END SetClipRgn;
  2346. 1625
  2347. 1626 PROCEDURE GetBkColor(): LONGCARD;
  2348. 1627
  2349. 1628 BEGIN
  2350. 1629 RETURN CoreGraph._bkcolor;
  2351. 1630 END GetBkColor;
  2352. 1631
  2353. 1632 PROCEDURE GetFillMask(VAR Mask: FillMaskType);
  2354. 1633
  2355. 1634 BEGIN
  2356. 1635 Lib.FastMove(ADR(CoreGraph._fill_mask), ADR(Mask), SIZE(CoreGraph.FillMaskType));
  2357. 1636 END GetFillMask;
  2358. 1637
  2359. 1638
  2360. 1639
  2361. 1640 PROCEDURE GetLinestyle(): CARDINAL;
  2362. 1641
  2363. 1642 BEGIN
  2364. 1643 RETURN CoreGraph._current_linestyle;
  2365. 1644 END GetLinestyle;
  2366. 1645
  2367. 1646 PROCEDURE SetBkColor(Color: LONGCARD): LONGCARD;
  2368. 1647
  2369. 1648 VAR
  2370. 1649 Ret: LONGCARD;
  2371. 1650 r: SYSTEM.Registers;
  2372. 1651
  2373. 1652 BEGIN
  2374. 1653 Ret:=CoreGraph._bkcolor;
  2375. 1654 IF Ret = Color THEN
  2376. 1655 RETURN Ret;
  2377. 1656 END;
  2378. 1657 IF (CoreGraph._current_video.mode = _MRES4COLOR) OR (CoreGraph._current_video.mode = _MRESNOCOLOR) THEN
  2379. 1658 r.AH:= 0BH;
  2380. 1659 r.BH:= 0;
  2381. 1660 r.BL:= SHORTCARD(ColXlat(Color));
  2382. 1661 Lib.Intr(r, 10H);
  2383. 1662 ELSIF CoreGraph._current_video.mode > _MRES16COLOR THEN
  2384. 1663 SYSTEM.Eval(RemapPalette(0, Color));
  2385. 1664 END;
  2386. 1665 CoreGraph._bkcolor:= Color;
  2387. 1666 RETURN Ret;
  2388. 1667 END SetBkColor;
  2389. 1668
  2390. 1669 PROCEDURE SetFillMask(Mask: CoreGraph.FillMaskType);
  2391. 1670
  2392. 1671 BEGIN
  2393. 1672 CoreGraph._current_mask:= CoreGraph.FillMaskPtr(ADR(Mask));
  2394. 1673 Lib.FastMove(ADR(Mask), ADR(CoreGraph._fill_mask), SIZE(CoreGraph.FillMaskType));
  2395. 1674 END SetFillMask;
  2396. 1675
  2397. 1676 PROCEDURE SetLinestyle(Mask: CARDINAL);
  2398. 1677
  2399. 1678 BEGIN
  2400. 1679 CoreGraph._current_linestyle:=Mask;
  2401. 1680 END SetLinestyle;
  2402. 1681
  2403. 1682 PROCEDURE DisplayCursor(Toggle: BOOLEAN): BOOLEAN;
  2404. 1683
  2405. 1684 VAR
  2406. 1685 Ret: BOOLEAN;
  2407. 1686 BEGIN
  2408. 1687 Ret:=CoreGraph._cursor_state;
  2409. 1688 CoreGraph._cursor_state:=Toggle;
  2410. 1689 RETURN Ret;
  2411. 1690 END DisplayCursor;
  2412. 1691
  2413. 1692
  2414. 1693
  2415. 1694 PROCEDURE GetTextColor(): CARDINAL;
  2416. 1695
  2417. 1696 BEGIN
  2418. 1697 RETURN CoreGraph._txcolor;
  2419. 1698 END GetTextColor;
  2420. 1699
  2421. 1700 PROCEDURE GetTextPosition(): TextCoords;
  2422. 1701
  2423. 1702 VAR
  2424. 1703 Ret: TextCoords;
  2425. 1704 BEGIN
  2426. 1705 Ret.row:=CoreGraph._current_text.row-CoreGraph._text_tl.row+1;
  2427. 1706 Ret.col:=CoreGraph._current_text.col-CoreGraph._text_tl.col+1;
  2428. 1707 RETURN Ret;
  2429. 1708 END GetTextPosition;
  2430. 1709
  2431. 1710
  2432. 1711 PROCEDURE SetTextColor(Color: CARDINAL): CARDINAL;
  2433. 1712
  2434. 1713 VAR
  2435. 1714 Ret: CARDINAL;
  2436. 1715 BEGIN
  2437. 1716 Ret:=CoreGraph._txcolor;
  2438. 1717 CoreGraph._txcolor:=Color;
  2439. 1718 RETURN Ret;
  2440. 1719 END SetTextColor;
  2441. 1720
  2442. 1721 PROCEDURE SetTextPosition(row, col: CARDINAL): TextCoords;
  2443. 1722
  2444. 1723 VAR
  2445. 1724 Ret: TextCoords;
  2446. 1725 BEGIN
  2447. 1726 Ret:=CoreGraph._current_text;
  2448. 1727 GEnter();
  2449. 1728 CoreGraph._current_text.row:=INTEGER(row)+CoreGraph._text_tl.row-1;
  2450. 1729 CoreGraph._current_text.col:=INTEGER(col)+CoreGraph._text_tl.col-1;
  2451. 1730 CoreGraph._setcur(CoreGraph._current_text.row, CoreGraph._current_text.col, CoreGraph._active_page);
  2452. 1731 GExit();
  2453. 1732 RETURN Ret;
  2454. 1733 END SetTextPosition;
  2455. 1734
  2456. 1735 PROCEDURE SetTextWindow(r1, c1, r2, c2: CARDINAL);
  2457. 1736
  2458. 1737 BEGIN
  2459. 1738 CoreGraph._text_tl.row:=r1-1;
  2460. 1739 CoreGraph._text_tl.col:=c1-1;
  2461. 1740 CoreGraph._text_br.row:=r2-1;
  2462. 1741 CoreGraph._text_br.col:=c2-1;
  2463. 1742 SYSTEM.Eval(SetTextPosition(1, 1));
  2464. 1743 END SetTextWindow;
  2465. 1744
  2466. 1745 PROCEDURE Wrapon(Opt: BOOLEAN): BOOLEAN;
  2467. 1746
  2468. 1747 VAR
  2469. 1748 Ret: BOOLEAN;
  2470. 1749
  2471. 1750 BEGIN
  2472. 1751 Ret:=CoreGraph._wrap_state;
  2473. 1752
  2474. 1753 CoreGraph._wrap_state:=Opt;
  2475. 1754 RETURN Ret;
  2476. 1755 END Wrapon;
  2477. 1756
  2478. 1757
  2479. 1758 PROCEDURE OutText(Text: ARRAY OF CHAR);
  2480. 1759
  2481. 1760 VAR
  2482. 1761 c: CHAR;
  2483. 1762 n, h: CARDINAL;
  2484. 1763 BEGIN
  2485. 1764 n:=0;
  2486. 1765 h:=HIGH(Text);
  2487. 1766 GEnter();
  2488. 1767 LOOP
  2489. 1768 IF n > h THEN EXIT END;
  2490. 1769 c:= Text[n];
  2491. 1770 INC(n);
  2492. 1771 IF c = CHAR(0) THEN EXIT END;
  2493. 1772 CoreGraph._setcur(CoreGraph._current_text.row, CoreGraph._current_text.col, CoreGraph._active_page);
  2494. 1773 IF c = CHAR(0AH) THEN
  2495. 1774 IF CoreGraph._current_text.row < CoreGraph._text_br.row THEN
  2496. 1775 INC(CoreGraph._current_text.row);
  2497. 1776 ELSE
  2498. 1777 Scroll();
  2499. 1778 END;
  2500. 1779 CoreGraph._current_text.col:=CoreGraph._text_tl.col;
  2501. 1780 ELSIF c = CHAR(0DH) THEN
  2502. 1781 CoreGraph._current_text.col:=CoreGraph._text_tl.col;
  2503. 1782 ELSE
  2504. 1783 CoreGraph._txt_out(INTEGER(c));
  2505. 1784 IF CoreGraph._current_text.col = CoreGraph._text_br.col THEN
  2506. 1785 CoreGraph._current_text.col:=CoreGraph._text_tl.col;
  2507. 1786 IF CoreGraph._current_text.row < CoreGraph._text_br.row THEN
  2508. 1787 INC(CoreGraph._current_text.row);
  2509. 1788 ELSE
  2510. 1789 Scroll();
  2511. 1790 END;
  2512. 1791 IF CoreGraph._wrap_state = _GWRAPOFF THEN EXIT END;
  2513. 1792 ELSE
  2514. 1793 INC(CoreGraph._current_text.col);
  2515. 1794 END;
  2516. 1795 END;
  2517. 1796 END;
  2518. 1797 CoreGraph._setcur(CoreGraph._current_text.row, CoreGraph._current_text.col, CoreGraph._active_page);
  2519. 1798 GExit();
  2520. 1799 END OutText;
  2521. 1800
  2522. 1801 PROCEDURE g_charoutput(c: CARDINAL);
  2523. 1802
  2524. 1803 BEGIN
  2525. 1804 GEnter();
  2526. 1805 CoreGraph._setcur(CoreGraph._current_text.row, CoreGraph._current_text.col, CoreGraph._active_page);
  2527. 1806 IF c = 0AH THEN
  2528. 1807 IF CoreGraph._current_text.row < CoreGraph._text_br.row THEN
  2529. 1808 INC(CoreGraph._current_text.row);
  2530. 1809 ELSE
  2531. 1810 Scroll();
  2532. 1811 END;
  2533. 1812 CoreGraph._current_text.col:=CoreGraph._text_tl.col;
  2534. 1813 ELSIF c = 0DH THEN
  2535. 1814 CoreGraph._current_text.col:=CoreGraph._text_tl.col;
  2536. 1815 ELSIF c = 8 THEN
  2537. 1816 IF CoreGraph._current_text.col = CoreGraph._text_tl.col THEN
  2538. 1817 IF CoreGraph._current_text.row > CoreGraph._text_tl.row THEN
  2539. 1818 DEC(CoreGraph._current_text.row);
  2540. 1819 CoreGraph._current_text.col:=CoreGraph._text_br.col;
  2541. 1820 END;
  2542. 1821 ELSE
  2543. 1822 DEC(CoreGraph._current_text.col);
  2544. 1823 END;
  2545. 1824 CoreGraph._setcur(CoreGraph._current_text.row, CoreGraph._current_text.col, CoreGraph._active_page);
  2546. 1825 CoreGraph._txt_out(INTEGER('\ '));
  2547. 1826 ELSE
  2548. 1827 CoreGraph._txt_out(INTEGER(c));
  2549. 1828 IF CoreGraph._current_text.col = CoreGraph._text_br.col THEN
  2550. 1829 CoreGraph._current_text.col:=CoreGraph._text_tl.col;
  2551. 1830 IF CoreGraph._current_text.row < CoreGraph._text_br.row THEN
  2552. 1831 INC(CoreGraph._current_text.row);
  2553. 1832 ELSE
  2554. 1833 Scroll();
  2555. 1834 END;
  2556. 1835 ELSE
  2557. 1836 INC(CoreGraph._current_text.col);
  2558. 1837 END;
  2559. 1838 END;
  2560. 1839 CoreGraph._setcur(CoreGraph._current_text.row, CoreGraph._current_text.col, CoreGraph._active_page);
  2561. 1840 GExit();
  2562. 1841 END g_charoutput;
  2563. 1842
  2564. 1843 PROCEDURE g_strinput(String: ARRAY OF CHAR);
  2565. 1844
  2566. 1845 VAR
  2567. 1846 c: CHAR;
  2568. 1847 p, n: CARDINAL;
  2569. 1848 BEGIN
  2570. 1849 p:=2;
  2571. 1850 n:=0;
  2572. 1851 LOOP
  2573. 1852 IF n = HIGH(String) THEN EXIT END;
  2574. 1853 c:= IO.RdChar();
  2575. 1854 IF (c = CHAR(8)) OR (c = CHAR(127)) THEN
  2576. 1855 IF n > 0 THEN
  2577. 1856 DEC(p);
  2578. 1857 DEC(n);
  2579. 1858 g_charoutput(8);
  2580. 1859 END;
  2581. 1860 ELSIF ( c > CHAR(' ')) THEN
  2582. 1861 g_charoutput(CARDINAL(c));
  2583. 1862 String[p]:=c;
  2584. 1863 INC(p);
  2585. 1864 INC(n);
  2586. 1865 ELSIF c = CHAR(13) THEN
  2587. 1866 g_charoutput(CARDINAL(0AH));
  2588. 1867 EXIT;
  2589. 1868 END;
  2590. 1869 END;
  2591. 1870 String[p]:=CHAR(0);
  2592. 1871 END g_strinput;
  2593. 1872
  2594. 1873 PROCEDURE SetVideoMode(Mode: CARDINAL): BOOLEAN;
  2595. 1874
  2596. 1875 TYPE
  2597. 1876 PalRegType = ARRAY [0..16] OF SHORTCARD;
  2598. 1877 PalColType = ARRAY [0..15] OF LONGCARD;
  2599. 1878 CONST
  2600. 1879 PalRegs = PalRegType(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0);
  2601. 1880 PalCols = PalColType(_BLACK, _BLUE, _GREEN, _CYAN, _RED, _MAGENTA, _BROWN,
  2602. 1881 _WHITE, _GRAY, _LIGHTBLUE, _LIGHTGREEN, _LIGHTCYAN,
  2603. 1882 _LIGHTRED, _LIGHTMAGENTA, _LIGHTYELLOW, _BRIGHTWHITE);
  2604. 1883 VAR
  2605. 1884 R: SYSTEM.Registers;
  2606. 1885 n: CARDINAL;
  2607. 1886
  2608. 1887 PROCEDURE CheckMode(): BOOLEAN;
  2609. 1888
  2610. 1889 VAR
  2611. 1890 Ret: BOOLEAN;
  2612. 1891 BEGIN
  2613. 1892 Ret:=TRUE;
  2614. 1893
  2615. 1894 IF Mode = _DEFAULTMODE THEN
  2616. 1895 RETURN Ret;
  2617. 1896 END;
  2618. 1897 IF CoreGraph._current_video.adapter = _MDPA THEN
  2619. 1898 IF Mode # _TEXTMONO THEN
  2620. 1899 Ret:=FALSE;
  2621. 1900 END;
  2622. 1901 ELSIF CoreGraph._current_video.adapter = _HGC THEN
  2623. 1902 IF (Mode # _TEXTMONO) AND (Mode # _HERCMONO) THEN
  2624. 1903 Ret:=FALSE;
  2625. 1904 END;
  2626. 1905 ELSE
  2627. 1906 CASE Mode OF
  2628. 1907 | _TEXTBW40, _TEXTC40, _TEXTBW80, _TEXTC80,
  2629. 1908 _MRES4COLOR, _MRESNOCOLOR, _HRESBW:
  2630. 1909 Ret:=TRUE;
  2631. 1910 | _TEXTMONO, _MRES16COLOR, _HRES16COLOR,
  2632. 1911 _ERESNOCOLOR, _ERESCOLOR:
  2633. 1912 IF (CoreGraph._current_video.adapter # _VGA) AND (CoreGraph._current_video.adapter # _EGA) THEN
  2634. 1913 Ret:=FALSE;
  2635. 1914 END;
  2636. 1915 | _VRES2COLOR:
  2637. 1916 IF (CoreGraph._current_video.adapter # _VGA) AND (CoreGraph._current_video.adapter # _MCGA) THEN
  2638. 1917 Ret:=FALSE;
  2639. 1918 END;
  2640. 1919 | _VRES16COLOR, _HERCMONO:
  2641. 1920 IF CoreGraph._current_video.adapter # _VGA THEN (* HGC already checked *)
  2642. 1921 Ret:=FALSE;
  2643. 1922 END;
  2644. 1923 | _MRES256COLOR:
  2645. 1924 IF (CoreGraph._current_video.adapter # _VGA) AND (CoreGraph._current_video.adapter # _MCGA) THEN
  2646. 1925 Ret:=FALSE;
  2647. 1926 END;
  2648. 1927 ELSE
  2649. 1928 Ret:=FALSE;
  2650. 1929 END;
  2651. 1930 END;
  2652. 1931 RETURN Ret;
  2653. 1932 END CheckMode;
  2654. 1933
  2655. 1934 BEGIN
  2656. 1935 IF ~CheckMode() THEN
  2657. 1936 RETURN FALSE;
  2658. 1937 END; (*IF*)
  2659. 1938 IF Mode = _DEFAULTMODE THEN
  2660. 1939 Mode := CoreGraph._defaultmode;
  2661. 1940 END; (*IF*)
  2662. 1941 CoreGraph._display_state := ~(((Mode >= 0) & (Mode <= 3)) OR (Mode = 7));
  2663. 1942 IF (Mode >= 4) & (Mode <= 6) THEN
  2664. 1943 InternalInitCGA(Mode);
  2665. 1944 ELSIF Mode = 8 THEN
  2666. 1945 InternalInitHerc;
  2667. 1946 ELSIF (Mode >= 13) & (Mode < 19) THEN
  2668. 1947 InternalInitEGA(Mode);
  2669. 1948 ELSIF Mode = 19 THEN
  2670. 1949 InternalInitVGA256;
  2671. 1950 END; (*IF*)
  2672. 1951 IF CoreGraph._lastmode = 8 THEN
  2673. 1952 HercTextMode;
  2674. 1953 END; (*IF*)
  2675. 1954 IF Mode = 8 THEN
  2676. 1955 HercGraphMode;
  2677. 1956 ELSE
  2678. 1957 CoreGraph._setbiosmode(Mode);
  2679. 1958 IF (Mode >= 13) AND (Mode < 19) THEN
  2680. 1959 R.AX := 1002H;
  2681. 1960 R.ES := Seg(PalRegs);
  2682. 1961 R.DX := Ofs(PalRegs);
  2683. 1962 Lib.Intr(R,10H);
  2684. 1963 FOR n := 0 TO 15 DO
  2685. 1964 R.AX := 1010H;
  2686. 1965 R.BH := SHORTCARD(n); (* Trial Fix 12/02/91 *)
  2687. 1966 R.BL := SHORTCARD(n);
  2688. 1967 R.DH := SHORTCARD(PalCols[n]);
  2689. 1968 R.CH := SHORTCARD(PalCols[n] >> 8);
  2690. 1969 R.CL := SHORTCARD(PalCols[n] >> 16);
  2691. 1970 Lib.Intr(R,10H);
  2692. 1971 END; (*FOR*)
  2693. 1972 END; (*IF*)
  2694. 1973 END; (*IF*)
  2695. 1974 CoreGraph._current_video.mode := Mode;
  2696. 1975 SetLimits(CoreGraph._current_video);
  2697. 1976 CoreGraph._lastmode := Mode;
  2698. 1977 ModeChanged := TRUE;
  2699. 1978 RETURN TRUE;
  2700. 1979 END SetVideoMode;
  2701. 1980
  2702. 1981 PROCEDURE SetActivePage(Page: CARDINAL): CARDINAL;
  2703. 1982
  2704. 1983
  2705. 1984 VAR
  2706. 1985 Ret: CARDINAL;
  2707. 1986 BEGIN
  2708. 1987 Ret:=CoreGraph._active_page;
  2709. 1988 IF (Page < 0) OR (Page > CoreGraph._current_video.numvideopages-1) THEN
  2710. 1989 RETURN MAX(CARDINAL);
  2711. 1990 END;
  2712. 1991 CoreGraph._active_page:=Page;
  2713. 1992 RETURN Ret;
  2714. 1993 END SetActivePage;
  2715. 1994
  2716. 1995 PROCEDURE SetVisualPage(Page:CARDINAL):CARDINAL;
  2717. 1996 VAR
  2718. 1997 r : SYSTEM.Registers;
  2719. 1998 Ret : CARDINAL;
  2720. 1999 BEGIN
  2721. 2000 Ret := CoreGraph._visual_page;
  2722. 2001 IF (Page < 0) OR (Page > CoreGraph._current_video.numvideopages-1) THEN
  2723. 2002 RETURN MAX(CARDINAL);
  2724. 2003 END; (*IF*)
  2725. 2004 CoreGraph._visual_page := Page;
  2726. 2005 IF CoreGraph._current_video.mode # _HERCMONO THEN
  2727. 2006 r.AH:=5;
  2728. 2007 r.AL:=SHORTCARD(Page);
  2729. 2008 Lib.Intr(r,10H);
  2730. 2009 ELSIF Page = 0 THEN
  2731. 2010 SYSTEM.Out(3B8H,0AH);
  2732. 2011 ELSE
  2733. 2012 SYSTEM.Out(3B8H,08AH);
  2734. 2013 END; (*IF*)
  2735. 2014 RETURN Ret;
  2736. 2015 END SetVisualPage;
  2737. 2016
  2738. 2017 PROCEDURE ClearScreen(Area: CARDINAL);
  2739. 2018
  2740. 2019 VAR
  2741. 2020 r: SYSTEM.Registers;
  2742. 2021 LineNum: INTEGER;
  2743. 2022 BEGIN
  2744. 2023 GEnter();
  2745. 2024 IF Area = _GWINDOW THEN
  2746. 2025 r.AX:=0600H;
  2747. 2026 IF CoreGraph._display_state = FALSE THEN
  2748. 2027 r.BH:=SHORTCARD(7+(CoreGraph._bkcolor<<4));
  2749. 2028 ELSE
  2750. 2029 r.BH:=0;
  2751. 2030 END;
  2752. 2031 r.CH:=SHORTCARD(CoreGraph._text_tl.row);
  2753. 2032 r.CL:=SHORTCARD(CoreGraph._text_tl.col);
  2754. 2033 r.DH:=SHORTCARD(CoreGraph._text_br.row);
  2755. 2034 r.DL:=SHORTCARD(CoreGraph._text_br.col);
  2756. 2035 Lib.Intr(r, 10H);
  2757. 2036 SYSTEM.Eval(SetTextPosition(1, 1));
  2758. 2037 ELSIF Area = _GVIEWPORT THEN
  2759. 2038 IF CoreGraph._display_state = TRUE THEN
  2760. 2039 LineNum:=CoreGraph._clip_tl.ycoord;
  2761. 2040 WHILE LineNum <= CoreGraph._clip_br.ycoord DO
  2762. 2041 CoreGraph._hline(CoreGraph._clip_tl.xcoord, LineNum, CoreGraph._clip_br.xcoord, 0);
  2763. 2042 INC(LineNum);
  2764. 2043 END;
  2765. 2044 END;
  2766. 2045 ELSIF CoreGraph._current_video.mode = _HERCMONO THEN
  2767. 2046 CoreGraph._clear_Herc();
  2768. 2047 SYSTEM.Eval(SetTextPosition(1, 1));
  2769. 2048 ELSE
  2770. 2049 r.AX:=0600H;
  2771. 2050 IF CoreGraph._display_state = FALSE THEN
  2772. 2051 r.BH:=SHORTCARD(7+(CoreGraph._bkcolor<<4));
  2773. 2052 ELSE
  2774. 2053 r.BH:=SHORTCARD(CoreGraph._bkcolor);
  2775. 2054 END;
  2776. 2055 r.CX:=0000H;
  2777. 2056 r.DH:=SHORTCARD(CoreGraph._current_video.numtextrows-1);
  2778. 2057 r.DL:=SHORTCARD(CoreGraph._current_video.numtextcols-1);
  2779. 2058 Lib.Intr(r, 10H);
  2780. 2059 SYSTEM.Eval(SetTextPosition(1, 1));
  2781. 2060 END;
  2782. 2061 GExit();
  2783. 2062 END ClearScreen;
  2784. 2063
  2785. 2064 PROCEDURE Line(x1, y1, x2, y2: CARDINAL; Color: CARDINAL);
  2786. 2065
  2787. 2066 BEGIN
  2788. 2067 GEnter();
  2789. 2068 CoreGraph._fgcolor:=Color;
  2790. 2069 IF (y1 = y2) AND (CoreGraph._current_linestyle = MAX(CARDINAL)) THEN
  2791. 2070 CoreGraph._hline(x1, y1, x2, Color);
  2792. 2071 ELSE
  2793. 2072 CoreGraph._line(x1, y1, x2, y2, CoreGraph._current_linestyle);
  2794. 2073 END;
  2795. 2074 GExit();
  2796. 2075 END Line;
  2797. 2076
  2798. 2077 PROCEDURE HLine(x1, y1, x2: CARDINAL; Color: CARDINAL);
  2799. 2078
  2800. 2079 BEGIN
  2801. 2080 GEnter();
  2802. 2081 CoreGraph._hline(x1, y1, x2, Color);
  2803. 2082 GExit();
  2804. 2083 END HLine;
  2805. 2084
  2806. 2085 PROCEDURE Rectangle(x1, y1, x2, y2: CARDINAL; Color: CARDINAL;Fill: BOOLEAN);
  2807. 2086
  2808. 2087 VAR
  2809. 2088 Mask: CARDINAL;
  2810. 2089 BEGIN
  2811. 2090 GEnter();
  2812. 2091 CoreGraph._fgcolor:=Color;
  2813. 2092 IF CoreGraph._current_linestyle = MAX(CARDINAL) THEN
  2814. 2093 CoreGraph._hline(x1, y1, x2, Color);
  2815. 2094 CoreGraph._line(x2, y1, x2, y2, CoreGraph._current_linestyle);
  2816. 2095 CoreGraph._hline(x2, y2, x1, Color);
  2817. 2096 CoreGraph._line(x1, y2, x1, y1, CoreGraph._current_linestyle);
  2818. 2097 ELSE
  2819. 2098 CoreGraph._line(x1, y1, x2, y1, CoreGraph._current_linestyle);
  2820. 2099 CoreGraph._line(x2, y1, x2, y2, CoreGraph._current_linestyle);
  2821. 2100 CoreGraph._line(x2, y2, x1, y2, CoreGraph._current_linestyle);
  2822. 2101 CoreGraph._line(x1, y2, x1, y1, CoreGraph._current_linestyle);
  2823. 2102 END;
  2824. 2103 IF Fill = _GFILLINTERIOR THEN
  2825. 2104 INC(x1);
  2826. 2105 INC(y1);
  2827. 2106 DEC(x2);
  2828. 2107 DEC(y2);
  2829. 2108 IF x1 = x2 THEN
  2830. 2109 GExit();
  2831. 2110 RETURN;
  2832. 2111 END;
  2833. 2112 WHILE y1 <= y2 DO
  2834. 2113 Mask:=CARDINAL(CoreGraph._fill_mask[y1 MOD 8])
  2835. 2114 +CARDINAL(CoreGraph._fill_mask[y1 MOD 8])*100H;
  2836. 2115 IF Mask = MAX(CARDINAL) THEN
  2837. 2116 CoreGraph._hline(x1, y1, x2, Color);
  2838. 2117 ELSE
  2839. 2118 CoreGraph._line(x1, y1, x2, y1, Mask);
  2840. 2119 END;
  2841. 2120 INC(y1);
  2842. 2121 END;
  2843. 2122 END;
  2844. 2123 GExit();
  2845. 2124 END Rectangle;
  2846. 2125
  2847. 2126 PROCEDURE Ellipse(x0, y0, a0, b0: CARDINAL; Color: CARDINAL; Fill: BOOLEAN);
  2848. 2127
  2849. 2128 BEGIN
  2850. 2129 GEnter();
  2851. 2130 CoreGraph._fgcolor:= Color;
  2852. 2131 DrawEllipse(x0, y0, a0, b0, Fill);
  2853. 2132 GExit();
  2854. 2133 END Ellipse;
  2855. 2134
  2856. 2135 PROCEDURE Disc(x0, y0, r: CARDINAL; Color: CARDINAL);
  2857. 2136
  2858. 2137 BEGIN
  2859. 2138 Ellipse(x0, y0, r, r, Color, TRUE);
  2860. 2139 END Disc;
  2861. 2140
  2862. 2141 PROCEDURE Circle(x0, y0, r: CARDINAL; Color: CARDINAL);
  2863. 2142
  2864. 2143 BEGIN
  2865. 2144 Ellipse(x0, y0, r, r, Color, FALSE);
  2866. 2145 END Circle;
  2867. 2146
  2868. 2147 PROCEDURE Arc(x1, y1, a, b, x3, y3, x4, y4: CARDINAL; Color: CARDINAL);
  2869. 2148
  2870. 2149 VAR
  2871. 2150 start, end: InterSect;
  2872. 2151 BEGIN
  2873. 2152 GEnter();
  2874. 2153 CoreGraph._fgcolor:=Color;
  2875. 2154 start:=GetVec(x1, y1, a, b, x3, y3);
  2876. 2155 end:=GetVec(x1, y1, a, b, x4, y4);
  2877. 2156 SYSTEM.Eval(DrawArc(x1, y1, a, b, start.x, start.y, end.x, end.y));
  2878. 2157 GExit();
  2879. 2158 END Arc;
  2880. 2159
  2881. 2160 PROCEDURE Pie(x1, y1, a, b, x3, y3, x4, y4: CARDINAL; Color: CARDINAL; Fill: BOOLEAN);
  2882. 2161
  2883. 2162 VAR
  2884. 2163 Ret: BOOLEAN;
  2885. 2164 fx, fy: INTEGER;
  2886. 2165 start, end: InterSect;
  2887. 2166 BEGIN
  2888. 2167 GEnter();
  2889. 2168 CoreGraph._fgcolor:=Color;
  2890. 2169 start:=GetVec(x1, y1, a, b, x3, y3);
  2891. 2170 end:=GetVec(x1, y1, a, b, x4, y4);
  2892. 2171 Ret:=DrawArc(x1, y1, a, b, start.x, start.y, end.x, end.y);
  2893. 2172 IF Ret = FALSE THEN
  2894. 2173 RETURN ;
  2895. 2174 END;
  2896. 2175 CoreGraph._line(x1, y1, start.x, start.y, CoreGraph._current_linestyle);
  2897. 2176 CoreGraph._line(x1, y1, end.x, end.y, CoreGraph._current_linestyle);
  2898. 2177 IF (Fill = _GFILLINTERIOR) AND (GetFillStart(fx, fy, x1, y1, start.x, start.y,
  2899. 2178 end.x, end.y)) THEN
  2900. 2179 FloodFill(fx, fy, CoreGraph._fgcolor, CoreGraph._fgcolor);
  2901. 2180 END;
  2902. 2181 GExit();
  2903. 2182 END Pie;
  2904. 2183
  2905. 2184 PROCEDURE Plot(x, y: CARDINAL; Color: CARDINAL);
  2906. 2185
  2907. 2186 BEGIN
  2908. 2187 GEnter();
  2909. 2188 IF (INTEGER(x) > CoreGraph._clip_br.xcoord) OR (INTEGER(x) < CoreGraph._clip_tl.xcoord)
  2910. 2189 OR (INTEGER(y) > CoreGraph._clip_br.ycoord) OR (INTEGER(y) < CoreGraph._clip_tl.ycoord) THEN
  2911. 2190 RETURN;
  2912. 2191 END;
  2913. 2192 CoreGraph._plot(x, y, Color);
  2914. 2193 GExit();
  2915. 2194 END Plot;
  2916. 2195
  2917. 2196 PROCEDURE Point(x, y: CARDINAL): CARDINAL;
  2918. 2197
  2919. 2198 BEGIN
  2920. 2199 IF (INTEGER(x) > CoreGraph._clip_br.xcoord) OR (INTEGER(x) < CoreGraph._clip_tl.xcoord)
  2921. 2200 OR (INTEGER(y) > CoreGraph._clip_br.ycoord) OR (INTEGER(y) < CoreGraph._clip_tl.ycoord) THEN
  2922. 2201 RETURN MAX(CARDINAL);
  2923. 2202 END;
  2924. 2203 RETURN CoreGraph._point(x, y);
  2925. 2204 END Point;
  2926. 2205
  2927. 2206 PROCEDURE FloodFill(x, y: CARDINAL; Color: CARDINAL; Boundary: CARDINAL);
  2928. 2207
  2929. 2208 VAR
  2930. 2209 xl, xr, v, i, nx, ny: INTEGER;
  2931. 2210 BEGIN
  2932. 2211 CoreGraph._fgcolor:=Color;
  2933. 2212 i:=0;
  2934. 2213 WHILE ( i < FILL_MASK_SIZE) DO
  2935. 2214 IF CoreGraph._fill_mask[i] = 0 THEN
  2936. 2215 StackFill(x, y, Color, Boundary);
  2937. 2216 RETURN;
  2938. 2217 END;
  2939. 2218 INC(i);
  2940. 2219 END;
  2941. 2220 GEnter();
  2942. 2221 nx := INTEGER(x);
  2943. 2222 ny := INTEGER(y);
  2944. 2223 IF Boundary >= CoreGraph._current_video.numcolors THEN
  2945. 2224 Boundary:=CoreGraph._current_video.numcolors-1;
  2946. 2225 END;
  2947. 2226 IF (nx > CoreGraph._clip_br.xcoord) OR (nx < CoreGraph._clip_tl.xcoord) THEN
  2948. 2227 RETURN;
  2949. 2228 END;
  2950. 2229 IF (ny > CoreGraph._clip_br.ycoord) OR (ny < CoreGraph._clip_tl.ycoord) THEN
  2951. 2230 RETURN;
  2952. 2231 END;
  2953. 2232 v:=CoreGraph._point(x, y);
  2954. 2233 IF v = INTEGER(Boundary) THEN
  2955. 2234 RETURN;
  2956. 2235 END;
  2957. 2236 xr := x;
  2958. 2237 xl := xr;
  2959. 2238 HscanLine (xl, xr, y, Boundary);
  2960. 2239 LagFill(xl, xr, y, UP, xl, xl-1, Boundary);
  2961. 2240 GExit();
  2962. 2241 END FloodFill;
  2963. 2242
  2964. 2243 PROCEDURE StackFill(x, y: CARDINAL; Color: CARDINAL; Boundary: CARDINAL);
  2965. 2244
  2966. 2245 VAR
  2967. 2246 xl, xr, xp, yp, nx, ny, direction: INTEGER;
  2968. 2247 BEGIN
  2969. 2248 nx := INTEGER(x);
  2970. 2249 ny := INTEGER(y);
  2971. 2250 GEnter();
  2972. 2251 CoreGraph._fgcolor:=Color;
  2973. 2252 IF Boundary >= CoreGraph._current_video.numcolors THEN
  2974. 2253 Boundary:=CoreGraph._current_video.numcolors-1;
  2975. 2254 END;
  2976. 2255 IF (nx > CoreGraph._clip_br.xcoord) OR (nx < CoreGraph._clip_tl.xcoord) THEN
  2977. 2256 RETURN;
  2978. 2257 END;
  2979. 2258 IF (ny > CoreGraph._clip_br.ycoord) OR (ny < CoreGraph._clip_tl.ycoord) THEN
  2980. 2259 RETURN;
  2981. 2260 END;
  2982. 2261 IF CoreGraph._point(x, y) = INTEGER(Boundary) THEN
  2983. 2262 RETURN;
  2984. 2263 END;
  2985. 2264 xr := x;
  2986. 2265 xl := xr;
  2987. 2266 xp:=x;
  2988. 2267 yp:=y;
  2989. 2268 HscanLine ( xl, xr, y, Boundary );
  2990. 2269
  2991. 2270 direction := +1;
  2992. 2271 LOOP
  2993. 2272 ny := yp;
  2994. 2273 nx := xl;
  2995. 2274 xp := xr;
  2996. 2275 LOOP
  2997. 2276 INC(ny, direction);
  2998. 2277 IF (ny < CoreGraph._clip_tl.ycoord) OR (CoreGraph._clip_br.ycoord < ny) THEN
  2999. 2278 EXIT;
  3000. 2279 END;
  3001. 2280 WHILE (nx <= xp) AND (CoreGraph._point ( nx, ny ) = INTEGER(Boundary)) DO
  3002. 2281 INC(nx);
  3003. 2282 END;
  3004. 2283 IF nx > xp THEN
  3005. 2284 EXIT;
  3006. 2285 END;
  3007. 2286 xp := nx;
  3008. 2287 HscanLine (nx, xp, ny, INTEGER(Boundary));
  3009. 2288 END;
  3010. 2289 IF direction < 0 THEN
  3011. 2290 EXIT;
  3012. 2291 END;
  3013. 2292 direction := -1;
  3014. 2293 END;
  3015. 2294 GExit();
  3016. 2295 END StackFill;
  3017. 2296
  3018. 2297 PROCEDURE RemapPalette(Pixel: CARDINAL; Color: LONGCARD): LONGCARD;
  3019. 2298
  3020. 2299 TYPE
  3021. 2300 LongSet = SET OF [0..31];
  3022. 2301 VAR
  3023. 2302 r: SYSTEM.Registers;
  3024. 2303 OldColor: LONGCARD;
  3025. 2304 n: CARDINAL;
  3026. 2305 ColSet: LongSet;
  3027. 2306 BEGIN
  3028. 2307 GEnter();
  3029. 2308 IF (CoreGraph._current_video.adapter = _VGA) OR (CoreGraph._current_video.adapter = _MCGA) THEN
  3030. 2309 ColSet:=LongSet(Color);
  3031. 2310 r.AX:=01015H;
  3032. 2311 r.BX:=Pixel;
  3033. 2312 Lib.Intr(r, 10H);
  3034. 2313 OldColor:= LONGCARD(r.DH);
  3035. 2314 OldColor:= OldColor+LONGCARD(r.CH)<<8;
  3036. 2315 OldColor:= OldColor+LONGCARD(r.CL)<<16;
  3037. 2316 r.AX:=01010H;
  3038. 2317 r.BX:=Pixel;
  3039. 2318 r.DH:=SHORTCARD(LONGCARD(ColSet));
  3040. 2319 r.CH:=SHORTCARD(LONGCARD(ColSet*LongSet(0FF00H))>>8);
  3041. 2320 r.CL:=SHORTCARD(LONGCARD(ColSet*LongSet(0FF0000H))>>16);
  3042. 2321 Lib.Intr(r, 10H);
  3043. 2322 ELSIF (CoreGraph._current_video.adapter = _EGA) THEN
  3044. 2323 n:=EGAcolXlat(Color);
  3045. 2324 r.AX:=01000H;
  3046. 2325 r.BL:=SHORTCARD(Pixel);
  3047. 2326 r.BH:=SHORTCARD(n);
  3048. 2327 Lib.Intr(r, 10H);
  3049. 2328 OldColor:=ColTable[EGATable[Pixel]];
  3050. 2329 EGATable[Pixel]:=n;
  3051. 2330 ELSE
  3052. 2331 OldColor := MAX(LONGCARD);
  3053. 2332 END;
  3054. 2333 GExit();
  3055. 2334 RETURN OldColor;
  3056. 2335 END RemapPalette;
  3057. 2336
  3058. 2337 PROCEDURE RemapAllPalette(Colarray: ARRAY OF LONGCARD): CARDINAL;
  3059. 2338
  3060. 2339 VAR
  3061. 2340 num, Count: CARDINAL;
  3062. 2341 Colors: ARRAY [0..256] OF ARRAY [0..2] OF SHORTCARD;
  3063. 2342 ColRegs: ARRAY [0..16] OF CHAR;
  3064. 2343 r: SYSTEM.Registers;
  3065. 2344
  3066. 2345 BEGIN
  3067. 2346 num:=CoreGraph._current_video.numcolors;
  3068. 2347 Count:=0;
  3069. 2348 GEnter();
  3070. 2349
  3071. 2350 IF (CoreGraph._current_video.adapter = _VGA) OR (CoreGraph._current_video.adapter = _MCGA) THEN
  3072. 2351 WHILE Count < num DO
  3073. 2352 Lib.Move(ADR(Colarray[Count]), ADR(Colors[Count]), 3);
  3074. 2353 INC(Count);
  3075. 2354 END;
  3076. 2355 r.AX:=01012H;
  3077. 2356 r.BX:=0;
  3078. 2357 r.CX:=num;
  3079. 2358
  3080. 2359 r.DX:=Ofs(Colors);
  3081. 2360 r.ES:=Seg(Colors);
  3082. 2361 Lib.Intr(r, 10H);
  3083. 2362 ELSIF (CoreGraph._current_video.adapter = _EGA) THEN
  3084. 2363 Count:=0;
  3085. 2364 WHILE Count < num DO
  3086. 2365 ColRegs[Count]:=CHAR(EGAcolXlat(Colarray[Count]));
  3087. 2366 INC(Count);
  3088. 2367 END;
  3089. 2368 ColRegs[16]:=CHAR(0);
  3090. 2369 r.AX:=1002H;
  3091. 2370 r.DX:=Ofs(ColRegs);
  3092. 2371 r.ES:=Seg(ColRegs);
  3093. 2372 Lib.Intr(r, 10H);
  3094. 2373 Lib.Move(ADR(ColRegs), ADR(EGATable), 17);
  3095. 2374 END;
  3096. 2375 GExit();
  3097. 2376 RETURN Count;
  3098. 2377 END RemapAllPalette;
  3099. 2378
  3100. 2379 VAR
  3101. 2380 OldPalette: CARDINAL;
  3102. 2381
  3103. 2382 PROCEDURE SelectPalette(Palnum: CARDINAL): CARDINAL;
  3104. 2383
  3105. 2384 VAR
  3106. 2385 r: SYSTEM.Registers;
  3107. 2386 Ret: CARDINAL;
  3108. 2387 BEGIN
  3109. 2388 Ret:=OldPalette;
  3110. 2389 IF (CoreGraph._current_video.mode # _MRES4COLOR) AND (CoreGraph._current_video.mode # _MRESNOCOLOR) THEN
  3111. 2390 RETURN MAX(CARDINAL);
  3112. 2391 END;
  3113. 2392 GEnter();
  3114. 2393 OldPalette:=Palnum;
  3115. 2394 r.AH:=0BH;
  3116. 2395 r.BH:=1;
  3117. 2396 r.BL:=SHORTCARD(Palnum);
  3118. 2397 Lib.Intr(r, 10H);
  3119. 2398 GExit();
  3120. 2399 RETURN Ret;
  3121. 2400 END SelectPalette;
  3122. 2401
  3123. 2402 PROCEDURE GetImage(x1, y1, x2, y2: CARDINAL; Buffer: ADDRESS);
  3124. 2403
  3125. 2404 BEGIN
  3126. 2405 GEnter();
  3127. 2406 CoreGraph._get(FarADR(Buffer^), x1, y1, x2, y2);
  3128. 2407 GExit();
  3129. 2408 END GetImage;
  3130. 2409
  3131. 2410 PROCEDURE PutImage(x, y: CARDINAL; Buffer: ADDRESS; Action: CARDINAL);
  3132. 2411
  3133. 2412 BEGIN
  3134. 2413 GEnter();
  3135. 2414 CoreGraph._put(x, y, FarADR(Buffer^), Action);
  3136. 2415 GExit();
  3137. 2416 END PutImage;
  3138. 2417
  3139. 2418 PROCEDURE ImageSize(x1, y1, x2, y2: CARDINAL): LONGCARD;
  3140. 2419
  3141. 2420 VAR
  3142. 2421 Size: LONGCARD;
  3143. 2422 ywidth, xwidth: LONGCARD;
  3144. 2423 BEGIN
  3145. 2424 xwidth:=LONGCARD(ABS(INTEGER(x1)-INTEGER(x2))+1);
  3146. 2425 ywidth:=LONGCARD(ABS(INTEGER(y1)-INTEGER(y2))+1);
  3147. 2426 Size:=((xwidth DIV 8)+1) * ywidth * LONGCARD(CoreGraph._current_video.bitsperpixel);
  3148. 2427 RETURN Size+HEADER_SIZE;
  3149. 2428 END ImageSize;
  3150. 2429
  3151. 2430 PROCEDURE Cube(top: BOOLEAN; x1, y1, x2, y2, depth: CARDINAL; Color: CARDINAL; Fill: BOOLEAN);
  3152. 2431
  3153. 2432 VAR
  3154. 2433 px, py: ARRAY [0..3] OF CARDINAL;
  3155. 2434 height: CARDINAL;
  3156. 2435 FillVal: BOOLEAN;
  3157. 2436 BEGIN
  3158. 2437 GEnter();
  3159. 2438 FillVal:=FillState;
  3160. 2439 FillState:=Fill;
  3161. 2440 CoreGraph._fgcolor:=Color;
  3162. 2441 height:=y2-y1;
  3163. 2442 px[0]:=x2;
  3164. 2443 py[0]:=y2;
  3165. 2444 px[1]:=x2+depth;
  3166. 2445 py[1]:=y2-(depth>>1);
  3167. 2446 px[2]:=px[1];
  3168. 2447 py[2]:=py[1]-height;
  3169. 2448 px[3]:=px[0];
  3170. 2449 py[3]:=py[0]-height;
  3171. 2450 Polygon(4, px, py, Color);
  3172. 2451 IF top THEN
  3173. 2452 px[0]:=x1;
  3174. 2453 py[0]:=y1;
  3175. 2454 px[1]:=x1+depth;
  3176. 2455 py[1]:=y1-(depth>>1);
  3177. 2456 DEC(px[2]);
  3178. 2457 DEC(px[3]);
  3179. 2458 Polygon(4, px, py, Color);
  3180. 2459 END;
  3181. 2460 Rectangle(x1, y1, x2, y2, Color, Fill);
  3182. 2461 FillState:=FillVal;
  3183. 2462 GExit();
  3184. 2463 END Cube;
  3185. 2464
  3186. 2465 CONST
  3187. 2466 MaxPts = 20;
  3188. 2467 VAR
  3189. 2468 xord: ARRAY [0..MaxPts] OF CARDINAL;
  3190. 2469 x: ARRAY [0..MaxPts] OF CARDINAL;
  3191. 2470
  3192. 2471 PROCEDURE QuickSort(l,r: INTEGER);
  3193. 2472 VAR
  3194. 2473 i,j,temp : INTEGER;
  3195. 2474 key : CARDINAL;
  3196. 2475 BEGIN
  3197. 2476 WHILE ( l < r ) DO
  3198. 2477 i := l; j := r; key := x[xord[j]];
  3199. 2478 REPEAT
  3200. 2479 WHILE ( i < j ) AND ( x[xord[i]] <= key ) DO i := i + 1 END;
  3201. 2480 WHILE ( i < j ) AND ( key <= x[xord[j]] ) DO j := j - 1 END;
  3202. 2481 IF i < j THEN
  3203. 2482 temp := xord[i]; xord[i] := xord[j]; xord[j] := temp;
  3204. 2483 END;
  3205. 2484 UNTIL ( i >= j );
  3206. 2485 temp := xord[i]; xord[i] := xord[r]; xord[r] := temp;
  3207. 2486 IF (i-l < r-i) THEN
  3208. 2487 QuickSort( l, i-1 ); l := i+1;
  3209. 2488 ELSE
  3210. 2489 QuickSort( i+1, r ); r := i-1;
  3211. 2490 END;
  3212. 2491 END;
  3213. 2492 END QuickSort;
  3214. 2493
  3215. 2494 PROCEDURE Polygon(n: CARDINAL; px, py: ARRAY OF CARDINAL; Color: CARDINAL);
  3216. 2495
  3217. 2496 VAR
  3218. 2497 y, miny, maxy, x0, y0, x1, y1: INTEGER;
  3219. 2498 temp, i, edge, next_edge, active: INTEGER;
  3220. 2499 e: ARRAY [0..MaxPts] OF INTEGER;
  3221. 2500 plotl, plotr: INTEGER;
  3222. 2501 Mask: CARDINAL;
  3223. 2502 BEGIN
  3224. 2503 IF n > MaxPts THEN RETURN END;
  3225. 2504 GEnter();
  3226. 2505 CoreGraph._fgcolor:=Color;
  3227. 2506 i:=0;
  3228. 2507 WHILE i < INTEGER(n) DO
  3229. 2508 IF i < INTEGER(n-1) THEN
  3230. 2509 CoreGraph._line(px[i], py[i], px[i+1], py[i+1], CoreGraph._current_linestyle);
  3231. 2510 ELSE
  3232. 2511 CoreGraph._line(px[i], py[i], px[0], py[0], CoreGraph._current_linestyle);
  3233. 2512 END;
  3234. 2513 INC(i);
  3235. 2514 END;
  3236. 2515 IF FillState = _GBORDER THEN
  3237. 2516 GExit();
  3238. 2517 RETURN;
  3239. 2518 END;
  3240. 2519 miny:=py[0]; (* find extremal y points *)
  3241. 2520 maxy:=miny;
  3242. 2521 i:=0;
  3243. 2522 WHILE i < INTEGER(n) DO
  3244. 2523 IF INTEGER(py[i]) < miny THEN
  3245. 2524 miny:=py[i];
  3246. 2525 END;
  3247. 2526 IF INTEGER(py[i]) > maxy THEN
  3248. 2527 maxy:=py[i];
  3249. 2528 END;
  3250. 2529 INC(i);
  3251. 2530 END;
  3252. 2531 y:=miny;
  3253. 2532 WHILE y <= maxy DO
  3254. 2533 active:=-1;
  3255. 2534 edge:= 0;
  3256. 2535 WHILE edge < INTEGER(n) DO
  3257. 2536 IF edge = INTEGER(n-1) THEN
  3258. 2537 next_edge:=0;
  3259. 2538 ELSE
  3260. 2539 next_edge:=edge+1;
  3261. 2540 END;
  3262. 2541 x0:=px[edge];
  3263. 2542 y0:=py[edge];
  3264. 2543 x1:=px[next_edge];
  3265. 2544 y1:=py[next_edge];
  3266. 2545 IF y0 > y1 THEN
  3267. 2546 temp:=x0;
  3268. 2547 x0:=x1;
  3269. 2548 x1:=temp;
  3270. 2549 temp:=y0;
  3271. 2550 y0:=y1;
  3272. 2551 y1:=temp;
  3273. 2552 END;
  3274. 2553 IF y = y0 THEN
  3275. 2554 e[edge]:=0;
  3276. 2555 x[edge]:=x0;
  3277. 2556 ELSIF (y0 <= y) AND (y <= y1) THEN
  3278. 2557 IF x1 >= x0 THEN (* x increases with y *)
  3279. 2558 INC(e[edge], (2*(x1-x0)));
  3280. 2559 WHILE e[edge] > (y1-y0) DO
  3281. 2560 DEC(e[edge], (2*(y1-y0)));
  3282. 2561 INC(x[edge]);
  3283. 2562 END;
  3284. 2563 ELSE (* x decreases with y *)
  3285. 2564 INC(e[edge], (2*(x0-x1)));
  3286. 2565 WHILE e[edge] > (y1-y0) DO
  3287. 2566 DEC(e[edge], (2*(y1-y0)));
  3288. 2567 DEC(x[edge]);
  3289. 2568 END;
  3290. 2569 END;
  3291. 2570 INC(active);
  3292. 2571 xord[active]:=edge;
  3293. 2572 END;
  3294. 2573 INC(edge);
  3295. 2574 END;
  3296. 2575 QuickSort(0, active);
  3297. 2576 i:=0;
  3298. 2577 WHILE i < active DO
  3299. 2578 plotl:=x[xord[i]]+1;
  3300. 2579 plotr:=x[xord[i+1]]-1;
  3301. 2580 IF plotr >= plotl THEN
  3302. 2581 CoreGraph._fgcolor:=Color;
  3303. 2582 Mask:=CARDINAL(CoreGraph._fill_mask[y MOD 8])
  3304. 2583 +CARDINAL(CoreGraph._fill_mask[y MOD 8])*100H;
  3305. 2584 IF Mask = MAX(CARDINAL) THEN
  3306. 2585 CoreGraph._hline(plotl, y, plotr, Color);
  3307. 2586 ELSE
  3308. 2587 CoreGraph._line(plotl, y, plotr, y, Mask);
  3309. 2588 END;
  3310. 2589 END;
  3311. 2590 INC(i, 2);
  3312. 2591 END;
  3313. 2592 INC(y);
  3314. 2593 END; (* for y = .. *)
  3315. 2594 GExit();
  3316. 2595 END Polygon;
  3317. 2596
  3318. 2597
  3319. 2598 PROCEDURE GraphMode();
  3320. 2599
  3321. 2600 BEGIN
  3322. 2601 (*%T AutoDetect *)
  3323. 2602 CASE CoreGraph._current_video.adapter OF
  3324. 2603 | _HGC :
  3325. 2604 Width:=HercWidth;
  3326. 2605 Depth:=HercDepth;
  3327. 2606 NumColor:=HercNumColor;
  3328. 2607 IF SetVideoMode(_HERCMONO) THEN END;
  3329. 2608 | _CGA, _MCGA:
  3330. 2609 Width:=CGAWidth;
  3331. 2610 Depth:=CGADepth;
  3332. 2611 NumColor:=CGANumColor;
  3333. 2612 IF SetVideoMode(_MRES4COLOR) THEN END;
  3334. 2613 | _EGA, _VGA :
  3335. 2614 Width:=EGAWidth;
  3336. 2615 Depth:=EGADepth;
  3337. 2616 NumColor:=EGANumColor;
  3338. 2617 IF SetVideoMode(_ERESCOLOR) THEN END;
  3339. 2618 ELSE
  3340. 2619 RETURN;
  3341. 2620 END;
  3342. 2621 (*%E *)
  3343. 2622 (*%F AutoDetect *)
  3344. 2623 CoreGraph._display_state:=TRUE;
  3345. 2624 IF StaticMode = _HERCMONO THEN
  3346. 2625 HercGraphMode();
  3347. 2626 ELSE
  3348. 2627 CoreGraph._setbiosmode(StaticMode);
  3349. 2628 END;
  3350. 2629 CoreGraph._current_video.mode:= StaticMode;
  3351. 2630 SetLimits(CoreGraph._current_video);
  3352. 2631 CoreGraph._lastmode:=StaticMode;
  3353. 2632 (*%E *)
  3354. 2633 END GraphMode;
  3355. 2634
  3356. 2635 PROCEDURE TextMode();
  3357. 2636
  3358. 2637 BEGIN
  3359. 2638 (*%T AutoDetect *)
  3360. 2639 IF SetVideoMode(_DEFAULTMODE) THEN END;
  3361. 2640 (*%E *)
  3362. 2641 (*%F AutoDetect *)
  3363. 2642 CoreGraph._display_state:=FALSE;
  3364. 2643 IF StaticMode = _HERCMONO THEN
  3365. 2644 HercTextMode();
  3366. 2645 ELSE
  3367. 2646 CoreGraph._setbiosmode(CoreGraph._defaultmode);
  3368. 2647 END;
  3369. 2648 CoreGraph._current_video.mode:= CoreGraph._defaultmode;
  3370. 2649 SetLimits(CoreGraph._current_video);
  3371. 2650 CoreGraph._lastmode:=CoreGraph._defaultmode;
  3372. 2651 (*%E *)
  3373. 2652 END TextMode;
  3374. 2653
  3375. 2654 PROCEDURE InitCGA();
  3376. 2655
  3377. 2656 BEGIN
  3378. 2657 InternalInitCGA(_MRES4COLOR);
  3379. 2658 CoreGraph._current_video.adapter := _CGA;
  3380. 2659 StaticMode:=_MRES4COLOR;
  3381. 2660 Width:=CGAWidth;
  3382. 2661 Depth:=CGADepth;
  3383. 2662 NumColor:=CGANumColor;
  3384. 2663 END InitCGA;
  3385. 2664
  3386. 2665 PROCEDURE InitEGA();
  3387. 2666
  3388. 2667 BEGIN
  3389. 2668 InternalInitEGA(_ERESCOLOR);
  3390. 2669 CoreGraph._current_video.adapter := _EGA;
  3391. 2670 StaticMode:=_ERESCOLOR;
  3392. 2671 Width:=EGAWidth;
  3393. 2672 Depth:=EGADepth;
  3394. 2673 NumColor:=EGANumColor;
  3395. 2674 END InitEGA;
  3396. 2675
  3397. 2676 PROCEDURE InitVGA();
  3398. 2677
  3399. 2678 BEGIN
  3400. 2679 InternalInitVGA256();
  3401. 2680 CoreGraph._current_video.adapter := _VGA;
  3402. 2681 StaticMode:=_MRES256COLOR;
  3403. 2682 Width:=VGA256Width;
  3404. 2683 Depth:=VGA256Depth;
  3405. 2684 NumColor:=VGANumColor;
  3406. 2685 END InitVGA;
  3407. 2686
  3408. 2687 PROCEDURE InitHerc();
  3409. 2688
  3410. 2689 BEGIN
  3411. 2690 InternalInitHerc();
  3412. 2691 CoreGraph._current_video.adapter := _HGC;
  3413. 2692 StaticMode:=_HERCMONO;
  3414. 2693 Width:=HercWidth;
  3415. 2694 Depth:=HercDepth;
  3416. 2695 NumColor:=HercNumColor;
  3417. 2696 END InitHerc;
  3418. 2697
  3419. 2698
  3420. 2699 PROCEDURE InitGraph();
  3421. 2700 VAR
  3422. 2701 display : CoreGraph.VideoType;
  3423. 2702 Disp : CARDINAL;
  3424. 2703 BEGIN
  3425. 2704 CoreGraph._defaultmode := CoreGraph._getvideomode();
  3426. 2705 CoreGraph._lastmode := CoreGraph._defaultmode;
  3427. 2706 CoreGraph._current_video.mode := CoreGraph._defaultmode;
  3428. 2707 SetLimits(CoreGraph._current_video);
  3429. 2708 CoreGraph._getsystem(display);
  3430. 2709 Disp := SetActivePage(0);
  3431. 2710 Disp := SetVisualPage(0);
  3432. 2711 CASE display.sys0 OF
  3433. 2712 MDA : CoreGraph._current_video.adapter:=_MDPA; |
  3434. 2713 CGA : CoreGraph._current_video.adapter:=_CGA;
  3435. 2714 Width:=CGAWidth;
  3436. 2715 Depth:=CGADepth;
  3437. 2716 NumColor:=CGANumColor; |
  3438. 2717 EGA : CoreGraph._current_video.adapter:=_EGA;
  3439. 2718 CoreGraph._current_video.memory:=CoreGraph._getmemory();
  3440. 2719 IF (CoreGraph._current_video.memory = 64 )THEN
  3441. 2720 CoreGraph._EGA64K:=TRUE;
  3442. 2721 END; (*IF*)
  3443. 2722 Width:=EGAWidth;
  3444. 2723 Depth:=EGADepth;
  3445. 2724 NumColor:=EGANumColor; |
  3446. 2725 MCGA : CoreGraph._current_video.adapter:=_MCGA;
  3447. 2726 CoreGraph._current_video.memory:=CoreGraph._getmemory();
  3448. 2727 Width:=CGAWidth;
  3449. 2728 Depth:=CGADepth;
  3450. 2729 NumColor:=CGANumColor; |
  3451. 2730 VGA : CoreGraph._current_video.adapter:=_VGA;
  3452. 2731 CoreGraph._current_video.memory:=CoreGraph._getmemory();
  3453. 2732 Width := VGAWidth;
  3454. 2733 Depth := VGADepth;
  3455. 2734 NumColor:=EGANumColor; |
  3456. 2735 HGC : CoreGraph._current_video.adapter:=_HGC;
  3457. 2736 CoreGraph._current_video.memory:=64;
  3458. 2737 Width:=HercWidth;
  3459. 2738 Depth:=HercDepth;
  3460. 2739 NumColor:=HercNumColor; |
  3461. 2740 HGCPlus,
  3462. 2741 InColor : CoreGraph._current_video.adapter:=-1; |
  3463. 2742 END; (*CASE*)
  3464. 2743 CASE display.dis0 OF
  3465. 2744 | MDADisplay:
  3466. 2745 CoreGraph._current_video.monitor:=_MONO;
  3467. 2746 | CGADisplay:
  3468. 2747 CoreGraph._current_video.monitor:=_COLOR;
  3469. 2748 | EGAColorDisplay:
  3470. 2749 CoreGraph._current_video.monitor:=_ENHCOLOR;
  3471. 2750 | PS2MonoDisplay:
  3472. 2751 CoreGraph._current_video.monitor:=_MONO;
  3473. 2752 | PS2ColorDisplay:
  3474. 2753 CoreGraph._current_video.monitor:=_ANALOG;
  3475. 2754 END;
  3476. 2755 END InitGraph;
  3477. 2756
  3478. 2757 PROCEDURE TrueDisc(x0,y0,r: CARDINAL; c: CARDINAL);
  3479. 2758 VAR b:CARDINAL;
  3480. 2759 BEGIN
  3481. 2760 IF CoreGraph._width=CGAWidth-1 THEN b := (r*5)DIV 6;
  3482. 2761 ELSIF CoreGraph._depth=EGADepth-1 THEN b := (r*73)DIV 100;
  3483. 2762 ELSE b := r;
  3484. 2763 END;
  3485. 2764 Ellipse (x0,y0,r,b,c,TRUE) ;
  3486. 2765 END TrueDisc;
  3487. 2766
  3488. 2767 PROCEDURE TrueCircle(x0,y0,r: CARDINAL; c: CARDINAL);
  3489. 2768 VAR b:CARDINAL;
  3490. 2769 BEGIN
  3491. 2770 IF CoreGraph._width=CGAWidth-1 THEN b := (r*5)DIV 6;
  3492. 2771 ELSIF CoreGraph._depth=EGADepth-1 THEN b := (r*73)DIV 100;
  3493. 2772 ELSE b := r;
  3494. 2773 END;
  3495. 2774 Ellipse (x0,y0,r,b,c,FALSE) ;
  3496. 2775 END TrueCircle;
  3497. 2776
  3498. 2777 VAR
  3499. 2778 C: PROC;
  3500. 2779
  3501. 2780 PROCEDURE GraphTerminate();
  3502. 2781
  3503. 2782 BEGIN
  3504. 2783 IF (CoreGraph._display_state = TRUE) AND (ModeChanged = TRUE) THEN
  3505. 2784 IF SetVideoMode(_DEFAULTMODE) THEN END;
  3506. 2785 END;
  3507. 2786 C;
  3508. 2787 END GraphTerminate;
  3509. 2788
  3510. 2789 (*%E _XTDDOS *)
  3511. 2790
  3512. 2791 (*%F _XTDDOS *)
  3513. 2792 PROCEDURE GenericGraphMode;
  3514. 2793 VAR r : CARDINAL;
  3515. 2794 BitMap : CARDINAL;
  3516. 2795 BEGIN
  3517. 2796 WHILE GraphI.Virtual DO Lib.Delay(100) END;
  3518. 2797 GraphI.CurMode.b := SIZE(GraphI.CurMode);
  3519. 2798 GraphI.CurMode.col := 80;
  3520. 2799 GraphI.CurMode.row := 25;
  3521. 2800 GraphI.CurMode.hres := Width;
  3522. 2801 GraphI.CurMode.vres := Depth;
  3523. 2802 IF Width<EGAWidth THEN GraphI.CurMode.col := 40 ELSE GraphI.CurMode.col := 80 END;
  3524. 2803 IF Depth<VGADepth THEN GraphI.CurMode.row := 25 ELSE GraphI.CurMode.row := 30 END;
  3525. 2804 IF NumColor=0 THEN GraphI.CurMode.color := 0
  3526. 2805 ELSIF NumColor<=2 THEN GraphI.CurMode.color := 1
  3527. 2806 ELSIF NumColor<=4 THEN GraphI.CurMode.color := 2
  3528. 2807 ELSIF NumColor<=16 THEN GraphI.CurMode.color := 4
  3529. 2808 ELSE GraphI.CurMode.color := 8
  3530. 2809 END;
  3531. 2810 GraphI.CurMode.type := 3;
  3532. 2811 r := Vio.SetMode(GraphI.CurMode,0);
  3533. 2812 Lib.OSFatalError('Vio.SetMode ',r);
  3534. 2813 IF GraphI.IsCGA THEN
  3535. 2814 Lib.FarWordFill(GraphI.Buffer[0],2000H,0);
  3536. 2815 ELSE
  3537. 2816 FOR BitMap := 0 TO GraphI.MaxBitMap DO
  3538. 2817 Lib.FarWordFill(GraphI.Buffer[BitMap],SIZE(GraphI.Buffer[BitMap]^) DIV 2,0);
  3539. 2818 END;
  3540. 2819 END;
  3541. 2820 GraphI.RestoreScreen;
  3542. 2821 GraphI.GraphM := TRUE ;
  3543. 2822 END GenericGraphMode;
  3544. 2823
  3545. 2824 PROCEDURE CGAPlot(x,y:CARDINAL;c:CARDINAL);
  3546. 2825 BEGIN
  3547. 2826 GraphI.CGAPlot(x,y,c);
  3548. 2827 END CGAPlot;
  3549. 2828
  3550. 2829 PROCEDURE CGAPoint(x,y:CARDINAL) : CARDINAL;
  3551. 2830 BEGIN
  3552. 2831 RETURN GraphI.CGAPoint(x,y);
  3553. 2832 END CGAPoint;
  3554. 2833
  3555. 2834 PROCEDURE CGAHLine ( x,y,x2 : CARDINAL; c:CARDINAL );
  3556. 2835 BEGIN
  3557. 2836 GraphI.CGAHLine(x,y,x2,c);
  3558. 2837 END CGAHLine;
  3559. 2838
  3560. 2839 (* == EGA/VGA specific routines == *)
  3561. 2840
  3562. 2841 PROCEDURE EGAPlot( x,y,c : CARDINAL); (* Also VGA *)
  3563. 2842 VAR
  3564. 2843 t:GraphI.BS;
  3565. 2844 p,b,s:CARDINAL;
  3566. 2845 BEGIN
  3567. 2846 GraphI.EGAPlot(x,y,c);
  3568. 2847 END EGAPlot;
  3569. 2848
  3570. 2849 PROCEDURE EGAPoint(x,y:CARDINAL) : CARDINAL; (* Also VGA *)
  3571. 2850 BEGIN
  3572. 2851 RETURN GraphI.EGAPoint(x,y);
  3573. 2852 END EGAPoint;
  3574. 2853
  3575. 2854 PROCEDURE EGAHLine ( x,y,x2 : CARDINAL; c:CARDINAL ); (* Also VGA *)
  3576. 2855 BEGIN
  3577. 2856 GraphI.EGAHLine(x,y,x2,c);
  3578. 2857 END EGAHLine;
  3579. 2858
  3580. 2859 PROCEDURE CGAGraphMode;
  3581. 2860 BEGIN
  3582. 2861 GenericGraphMode;
  3583. 2862 END CGAGraphMode;
  3584. 2863
  3585. 2864 PROCEDURE CGATextMode; (* General Text Mode *)
  3586. 2865 VAR r : CARDINAL;
  3587. 2866 BEGIN
  3588. 2867 WHILE GraphI.Virtual DO Lib.Delay(100) END;
  3589. 2868 GraphI.CurMode.b := VSIZE(Vio.MODEINFO.type);
  3590. 2869 GraphI.CurMode.type := 1;
  3591. 2870 r := Vio.SetMode(GraphI.CurMode,0);
  3592. 2871 GraphI.GraphM := FALSE;
  3593. 2872 END CGATextMode;
  3594. 2873
  3595. 2874 PROCEDURE EGAGraphMode; (* Also VGA *)
  3596. 2875 BEGIN
  3597. 2876 GenericGraphMode;
  3598. 2877 END EGAGraphMode;
  3599. 2878
  3600. 2879 PROCEDURE InitVGA ;
  3601. 2880 BEGIN
  3602. 2881 InitEGA ;
  3603. 2882 Depth := VGADepth ; (* Width same as EGA *)
  3604. 2883 END InitVGA ;
  3605. 2884
  3606. 2885 PROCEDURE Line(x1,y1,x2,y2: CARDINAL; c: CARDINAL);
  3607. 2886 BEGIN
  3608. 2887 GraphI.Line(x1,y1,x2,y2,c);
  3609. 2888 END Line;
  3610. 2889
  3611. 2890 PROCEDURE Disc(x0,y0,r: CARDINAL; c: CARDINAL);
  3612. 2891 BEGIN
  3613. 2892 GraphI.Disc(x0,y0,r,c);
  3614. 2893 END Disc;
  3615. 2894
  3616. 2895 PROCEDURE Circle(x0,y0,r: CARDINAL; c: CARDINAL);
  3617. 2896 BEGIN
  3618. 2897 GraphI.Circle(x0,y0,r,c);
  3619. 2898 END Circle;
  3620. 2899
  3621. 2900 PROCEDURE TrueCircle(x0,y0,r: CARDINAL; c: CARDINAL);
  3622. 2901 VAR b:CARDINAL;
  3623. 2902 BEGIN
  3624. 2903 IF Width=CGAWidth THEN b := (r*5)DIV 6;
  3625. 2904 ELSIF Depth=EGADepth THEN b := (r*73)DIV 100;
  3626. 2905 ELSE b := r;
  3627. 2906 END;
  3628. 2907 Ellipse (x0,y0,r,b,c,FALSE) ;
  3629. 2908 END TrueCircle;
  3630. 2909
  3631. 2910 PROCEDURE TrueDisc(x0,y0,r: CARDINAL; c: CARDINAL);
  3632. 2911 VAR b:CARDINAL;
  3633. 2912 BEGIN
  3634. 2913 IF Width=CGAWidth THEN b := (r*5)DIV 6;
  3635. 2914 ELSIF Depth=EGADepth THEN b := (r*73)DIV 100;
  3636. 2915 ELSE b := r;
  3637. 2916 END;
  3638. 2917 Ellipse (x0,y0,r,b,c,TRUE) ;
  3639. 2918 END TrueDisc;
  3640. 2919
  3641. 2920 PROCEDURE Ellipse ( x0,y0 : CARDINAL ; (* center *)
  3642. 2921 a0,b0 : CARDINAL ; (* semi-axes *)
  3643. 2922 c : CARDINAL ; (* color *)
  3644. 2923 fill : BOOLEAN ) ; (* wether filled *)
  3645. 2924 VAR
  3646. 2925 x,y : CARDINAL ;
  3647. 2926 a,b : LONGINT ;
  3648. 2927 asq,asq2,bsq,bsq2 : LONGINT ;
  3649. 2928 d,dx,dy : LONGINT ;
  3650. 2929 BEGIN
  3651. 2930 x := 0 ;
  3652. 2931 y := b0 ;
  3653. 2932 a := LONGINT(a0) ;
  3654. 2933 b := LONGINT(b0) ;
  3655. 2934 asq := a*a ;
  3656. 2935 asq2 := asq*2 ;
  3657. 2936 bsq := b*b ;
  3658. 2937 bsq2 := bsq*2 ;
  3659. 2938 d := bsq-(asq*b)+(asq DIV 4) ;
  3660. 2939 dx := 0 ;
  3661. 2940 dy := asq2*b ;
  3662. 2941 WHILE dx<dy DO
  3663. 2942 IF fill THEN
  3664. 2943 HLine(x0-x,y0+y,x0+x,c);
  3665. 2944 HLine(x0-x,y0-y,x0+x,c);
  3666. 2945 ELSE
  3667. 2946 Plot(x0+x,y0+y,c) ;
  3668. 2947 Plot(x0-x,y0+y,c) ;
  3669. 2948 Plot(x0+x,y0-y,c) ;
  3670. 2949 Plot(x0-x,y0-y,c) ;
  3671. 2950 END ;
  3672. 2951 IF d>0 THEN
  3673. 2952 DEC(y) ;
  3674. 2953 DEC(dy,asq2) ;
  3675. 2954 DEC(d,dy) ;
  3676. 2955 END ;
  3677. 2956 INC(x) ;
  3678. 2957 INC(dx,bsq2) ;
  3679. 2958 INC(d,bsq+dx) ;
  3680. 2959 END ;
  3681. 2960 INC(d,(3*(asq-bsq)DIV 2-(dx+dy))DIV 2) ;
  3682. 2961 WHILE INTEGER(y)>=0 DO
  3683. 2962 IF fill THEN
  3684. 2963 HLine(x0-x,y0+y,x0+x,c);
  3685. 2964 HLine(x0-x,y0-y,x0+x,c);
  3686. 2965 ELSE
  3687. 2966 Plot(x0+x,y0+y,c) ;
  3688. 2967 Plot(x0-x,y0+y,c) ;
  3689. 2968 Plot(x0+x,y0-y,c) ;
  3690. 2969 Plot(x0-x,y0-y,c) ;
  3691. 2970 END ;
  3692. 2971 IF d<0 THEN
  3693. 2972 INC(x) ;
  3694. 2973 INC(dx,bsq2) ;
  3695. 2974 INC(d,dx) ;
  3696. 2975 END ;
  3697. 2976 DEC(y) ;
  3698. 2977 DEC(dy,asq2) ;
  3699. 2978 INC(d,asq-dy) ;
  3700. 2979 END ;
  3701. 2980 END Ellipse ;
  3702. 2981
  3703. 2982 PROCEDURE Polygon(n: CARDINAL; px,py: ARRAY OF CARDINAL; c: CARDINAL);
  3704. 2983 BEGIN
  3705. 2984 GraphI.Polygon(n,px,py,c);
  3706. 2985 END Polygon;
  3707. 2986
  3708. 2987
  3709. 2988 VAR
  3710. 2989 SwapStack : ARRAY [0..1023] OF BYTE;
  3711. 2990 SwapThread : CARDINAL;
  3712. 2991
  3713. 2992 PROCEDURE SwapProcess;
  3714. 2993 VAR r,action,svs : CARDINAL;
  3715. 2994 BEGIN
  3716. 2995 GraphI.Virtual := FALSE;
  3717. 2996 Lib.OSFatalError('Dos.SetPrty',
  3718. 2997 Dos.SetPrty(2,3,0,SwapThread));
  3719. 2998 LOOP
  3720. 2999 Lib.OSFatalError('Vio.SavRedrawWait',
  3721. 3000 Vio.SavRedrawWait(0,action,0));
  3722. 3001 IF GraphI.GraphM THEN
  3723. 3002 IF (action=1)AND GraphI.Virtual THEN (* restore *)
  3724. 3003 Dos.EnterCritSec;
  3725. 3004 GraphI.VideoSel := svs;
  3726. 3005 GraphI.Virtual := FALSE;
  3727. 3006 GraphI.RestoreScreen;
  3728. 3007 Dos.ExitCritSec;
  3729. 3008 r := Vio.SetMode(GraphI.CurMode,0);
  3730. 3009 ELSIF (action=0)AND NOT GraphI.Virtual THEN (* save *)
  3731. 3010 Dos.EnterCritSec;
  3732. 3011 svs := GraphI.VideoSel;
  3733. 3012 GraphI.SaveScreen;
  3734. 3013 GraphI.VideoSel := SYSTEM.Seg(GraphI.Buffer[0]^);
  3735. 3014 GraphI.Virtual := TRUE;
  3736. 3015 Dos.ExitCritSec;
  3737. 3016 Lib.Delay(100); (* wait for pending operations to finish *)
  3738. 3017 END;
  3739. 3018 END;
  3740. 3019 END;
  3741. 3020 END SwapProcess;
  3742. 3021
  3743. 3022
  3744. 3023 PROCEDURE GraphMode;
  3745. 3024
  3746. 3025 BEGIN
  3747. 3026 GraphI.G_GraphMode;
  3748. 3027 END GraphMode;
  3749. 3028
  3750. 3029 PROCEDURE TextMode;
  3751. 3030 BEGIN
  3752. 3031 GraphI.G_TextMode;
  3753. 3032 END TextMode;
  3754. 3033
  3755. 3034
  3756. 3035 PROCEDURE InitCGA ;
  3757. 3036 VAR
  3758. 3037 r : CARDINAL;
  3759. 3038 sl : Vio.PHYSBUF;
  3760. 3039 BEGIN
  3761. 3040 sl.bufaddr := 0B8000H;
  3762. 3041 sl.buflen := 004000H;
  3763. 3042 r := Vio.GetPhysBuf(sl,0);
  3764. 3043 GraphI.VideoSel := sl.sel[0];
  3765. 3044 Width := CGAWidth ;
  3766. 3045 Depth := CGADepth ;
  3767. 3046 NumColor := 4 ;
  3768. 3047 GraphI.G_TextMode := CGATextMode ;
  3769. 3048 GraphI.G_GraphMode := CGAGraphMode ;
  3770. 3049 GraphI.G_Plot := CGAPlot ;
  3771. 3050 GraphI.G_Point := CGAPoint ;
  3772. 3051 GraphI.G_HLine := CGAHLine ;
  3773. 3052 IF GraphI.Buffer[0]=FarNIL THEN
  3774. 3053 Storage.FarAllocate(GraphI.Buffer[0], GraphI.BitMapSize);
  3775. 3054 END;
  3776. 3055 GraphI.IsCGA := TRUE;
  3777. 3056 END InitCGA ;
  3778. 3057
  3779. 3058
  3780. 3059 PROCEDURE InitEGA ;
  3781. 3060 VAR
  3782. 3061 BitMap : CARDINAL;
  3783. 3062 r : CARDINAL;
  3784. 3063 sl : Vio.PHYSBUF;
  3785. 3064 BEGIN
  3786. 3065 FOR BitMap := 0 TO GraphI.MaxBitMap DO
  3787. 3066 IF GraphI.Buffer[BitMap]=FarNIL THEN
  3788. 3067 Storage.FarAllocate(GraphI.Buffer[BitMap], GraphI.BitMapSize);
  3789. 3068 END;
  3790. 3069 END;
  3791. 3070 sl.bufaddr := 0A0000H;
  3792. 3071 sl.buflen := 010000H;
  3793. 3072 r := Vio.GetPhysBuf(sl,0);
  3794. 3073 GraphI.VideoSel := sl.sel[0];
  3795. 3074 Width := EGAWidth ;
  3796. 3075 Depth := EGADepth ;
  3797. 3076 Depth := EGADepth;
  3798. 3077 NumColor := 16 ;
  3799. 3078 GraphI.G_TextMode := CGATextMode ;
  3800. 3079 GraphI.G_GraphMode := EGAGraphMode ;
  3801. 3080 GraphI.G_Plot := EGAPlot ;
  3802. 3081 GraphI.G_Point := EGAPoint ;
  3803. 3082 GraphI.G_HLine := EGAHLine ;
  3804. 3083 GraphI.IsCGA := FALSE;
  3805. 3084 END InitEGA ;
  3806. 3085
  3807. 3086
  3808. 3087 PROCEDURE Plot(x,y: CARDINAL; Color: CARDINAL);
  3809. 3088
  3810. 3089 BEGIN
  3811. 3090 GraphI.G_Plot(x, y, Color);
  3812. 3091 END Plot;
  3813. 3092
  3814. 3093
  3815. 3094 PROCEDURE Point(x,y: CARDINAL) : CARDINAL;
  3816. 3095
  3817. 3096 BEGIN
  3818. 3097 RETURN GraphI.G_Point(x, y);
  3819. 3098 END Point;
  3820. 3099
  3821. 3100
  3822. 3101 PROCEDURE HLine(x,y,x2: CARDINAL; FillColor: CARDINAL);
  3823. 3102
  3824. 3103 BEGIN
  3825. 3104 GraphI.G_HLine(x, y, x2, FillColor);
  3826. 3105 END HLine;
  3827. 3106
  3828. 3107
  3829. 3108 PROCEDURE NotSupported(Func: ARRAY OF CHAR);
  3830. 3109
  3831. 3110 VAR
  3832. 3111 Msg: ARRAY [0..79] OF CHAR;
  3833. 3112 BEGIN
  3834. 3113 Str.Concat(Msg, Func, ': Not Supported Under OS2.');
  3835. 3114 Lib.RunTimeError(CoreSig._FatalErrorPos(), 0D1H, Msg);
  3836. 3115 END NotSupported;
  3837. 3116
  3838. 3117 PROCEDURE GetVideoConfig(VAR V: VideoConfig);
  3839. 3118
  3840. 3119 BEGIN
  3841. 3120 NotSupported('GetVideoConfig');
  3842. 3121 END GetVideoConfig;
  3843. 3122
  3844. 3123 PROCEDURE SetClipRgn(x1, y1, x2, y2: CARDINAL);
  3845. 3124
  3846. 3125 BEGIN
  3847. 3126 NotSupported('SetClipRgn');
  3848. 3127 END SetClipRgn;
  3849. 3128
  3850. 3129 PROCEDURE GetBkColor(): LONGCARD;
  3851. 3130
  3852. 3131 BEGIN
  3853. 3132 NotSupported('GetBkColor');
  3854. 3133 RETURN 0;
  3855. 3134 END GetBkColor;
  3856. 3135
  3857. 3136 PROCEDURE GetFillMask(VAR Mask: FillMaskType);
  3858. 3137
  3859. 3138 BEGIN
  3860. 3139 NotSupported('GetFillMask');
  3861. 3140 END GetFillMask;
  3862. 3141
  3863. 3142 PROCEDURE GetLinestyle(): CARDINAL;
  3864. 3143
  3865. 3144 BEGIN
  3866. 3145 NotSupported( 'GetLineStyle');
  3867. 3146 RETURN 0;
  3868. 3147 END GetLinestyle;
  3869. 3148
  3870. 3149 PROCEDURE SetBkColor(Color: LONGCARD): LONGCARD;
  3871. 3150
  3872. 3151 BEGIN
  3873. 3152 NotSupported( 'SetBkColor');
  3874. 3153 RETURN 0;
  3875. 3154 END SetBkColor;
  3876. 3155
  3877. 3156 PROCEDURE SetFillMask(Mask: FillMaskType);
  3878. 3157
  3879. 3158 BEGIN
  3880. 3159 NotSupported( 'SetFillMask');
  3881. 3160 END SetFillMask;
  3882. 3161
  3883. 3162 PROCEDURE SetLinestyle(Mask: CARDINAL);
  3884. 3163
  3885. 3164 BEGIN
  3886. 3165 NotSupported( 'SetLinestyle');
  3887. 3166 END SetLinestyle;
  3888. 3167
  3889. 3168 PROCEDURE GetTextColor(): CARDINAL;
  3890. 3169
  3891. 3170 BEGIN
  3892. 3171 NotSupported( 'GetTextColor');
  3893. 3172 RETURN 0;
  3894. 3173 END GetTextColor;
  3895. 3174
  3896. 3175 PROCEDURE GetTextPosition(): TextCoords;
  3897. 3176
  3898. 3177 BEGIN
  3899. 3178 NotSupported( 'GetTextPosition');
  3900. 3179 RETURN TextCoords(0,0);
  3901. 3180 END GetTextPosition;
  3902. 3181
  3903. 3182 PROCEDURE DisplayCursor(Mode: BOOLEAN): BOOLEAN;
  3904. 3183
  3905. 3184 BEGIN
  3906. 3185 NotSupported( 'DisplayCursor');
  3907. 3186 RETURN FALSE;
  3908. 3187 END DisplayCursor;
  3909. 3188
  3910. 3189 PROCEDURE SetTextPosition(row, col: CARDINAL): TextCoords;
  3911. 3190
  3912. 3191 BEGIN
  3913. 3192 NotSupported( 'SetTextPosition');
  3914. 3193 RETURN TextCoords(0,0);
  3915. 3194 END SetTextPosition;
  3916. 3195
  3917. 3196 PROCEDURE SetTextWindow(r1, c1, r2, c2: CARDINAL);
  3918. 3197
  3919. 3198 BEGIN
  3920. 3199 NotSupported( 'SetTextWindow');
  3921. 3200 END SetTextWindow;
  3922. 3201
  3923. 3202 PROCEDURE Wrapon(Opt: BOOLEAN): BOOLEAN;
  3924. 3203
  3925. 3204 BEGIN
  3926. 3205 NotSupported( 'Wrapon');
  3927. 3206 RETURN FALSE;
  3928. 3207 END Wrapon;
  3929. 3208
  3930. 3209 PROCEDURE OutText(Text: ARRAY OF CHAR);
  3931. 3210
  3932. 3211 BEGIN
  3933. 3212 NotSupported( 'OutText');
  3934. 3213 END OutText;
  3935. 3214
  3936. 3215 PROCEDURE SetVideoMode(Mode: CARDINAL): BOOLEAN;
  3937. 3216
  3938. 3217 BEGIN
  3939. 3218 NotSupported( 'SetVideoMode');
  3940. 3219 RETURN FALSE;
  3941. 3220 END SetVideoMode;
  3942. 3221
  3943. 3222 PROCEDURE SetActivePage(Page: CARDINAL): CARDINAL;
  3944. 3223
  3945. 3224 BEGIN
  3946. 3225 NotSupported('SetActivePage');
  3947. 3226 RETURN 0;
  3948. 3227 END SetActivePage;
  3949. 3228
  3950. 3229 PROCEDURE SetVisualPage(Page: CARDINAL): CARDINAL;
  3951. 3230
  3952. 3231 BEGIN
  3953. 3232 NotSupported( 'SetVisualPage');
  3954. 3233 RETURN 0;
  3955. 3234 END SetVisualPage;
  3956. 3235
  3957. 3236 PROCEDURE ClearScreen(Area: CARDINAL);
  3958. 3237
  3959. 3238 BEGIN
  3960. 3239 NotSupported( 'ClearScreen');
  3961. 3240 END ClearScreen;
  3962. 3241
  3963. 3242 PROCEDURE Rectangle(x1, y1, x2, y2: CARDINAL; Color: CARDINAL;Fill: BOOLEAN);
  3964. 3243
  3965. 3244 BEGIN
  3966. 3245 NotSupported( 'Rectangle');
  3967. 3246 END Rectangle;
  3968. 3247
  3969. 3248 PROCEDURE Arc(x1, y1, x2, y2, x3, y3, x4, y4: CARDINAL; Color: CARDINAL);
  3970. 3249
  3971. 3250 BEGIN
  3972. 3251 NotSupported( 'Arc');
  3973. 3252 END Arc;
  3974. 3253
  3975. 3254 PROCEDURE Pie(x1, y1, x2, y2, x3, y3, x4, y4: CARDINAL; Colr: CARDINAL; Fill: BOOLEAN);
  3976. 3255
  3977. 3256 BEGIN
  3978. 3257 NotSupported( 'Pie');
  3979. 3258 END Pie;
  3980. 3259
  3981. 3260 PROCEDURE FloodFill(x, y: CARDINAL; Color: CARDINAL; Boundary: CARDINAL);
  3982. 3261
  3983. 3262 BEGIN
  3984. 3263 NotSupported( 'FloodFill');
  3985. 3264 END FloodFill;
  3986. 3265
  3987. 3266 PROCEDURE StackFill(x, y: CARDINAL; Color: CARDINAL; Boundary: CARDINAL);
  3988. 3267
  3989. 3268 BEGIN
  3990. 3269 NotSupported( 'StackFill');
  3991. 3270 END StackFill;
  3992. 3271
  3993. 3272 PROCEDURE RemapPalette(Pixel: CARDINAL; Color: LONGCARD): LONGCARD;
  3994. 3273
  3995. 3274 BEGIN
  3996. 3275 NotSupported( 'RemapPalette');
  3997. 3276 RETURN 0;
  3998. 3277 END RemapPalette;
  3999. 3278
  4000. 3279 PROCEDURE RemapAllPalette(Colarray: ARRAY OF LONGCARD): CARDINAL;
  4001. 3280
  4002. 3281 BEGIN
  4003. 3282 NotSupported( 'RemapAllPalette');
  4004. 3283 RETURN 0;
  4005. 3284 END RemapAllPalette;
  4006. 3285
  4007. 3286 PROCEDURE SelectPalette(Palnum: CARDINAL): CARDINAL;
  4008. 3287
  4009. 3288 BEGIN
  4010. 3289 NotSupported( 'SelectPalette');
  4011. 3290 RETURN 0;
  4012. 3291 END SelectPalette;
  4013. 3292
  4014. 3293 PROCEDURE GetImage(x1, y1, x2, y2: CARDINAL; Buffer: ADDRESS);
  4015. 3294
  4016. 3295 BEGIN
  4017. 3296 NotSupported( 'GetImage');
  4018. 3297 END GetImage;
  4019. 3298
  4020. 3299 PROCEDURE PutImage(x, y: CARDINAL; Buffer: ADDRESS; Action: CARDINAL);
  4021. 3300
  4022. 3301 BEGIN
  4023. 3302 NotSupported( 'PutImage');
  4024. 3303 END PutImage;
  4025. 3304
  4026. 3305 PROCEDURE ImageSize(x1, y1, x2, y2: CARDINAL): LONGCARD;
  4027. 3306
  4028. 3307 BEGIN
  4029. 3308 NotSupported( 'ImageSize');
  4030. 3309 RETURN 0;
  4031. 3310 END ImageSize;
  4032. 3311
  4033. 3312 PROCEDURE Cube(top: BOOLEAN; x1, y1, x2, y2, depth: CARDINAL; Color: CARDINAL; Fill: BOOLEAN);
  4034. 3313
  4035. 3314 BEGIN
  4036. 3315 NotSupported( 'Cube');
  4037. 3316 END Cube;
  4038. 3317
  4039. 3318 PROCEDURE InitHerc();
  4040. 3319
  4041. 3320 BEGIN
  4042. 3321 NotSupported( 'InitHerc');
  4043. 3322 END InitHerc;
  4044. 3323
  4045. 3324 PROCEDURE InitGraph();
  4046. 3325
  4047. 3326 BEGIN
  4048. 3327 NotSupported( 'InitGraph');
  4049. 3328 END InitGraph;
  4050. 3329
  4051. 3330 PROCEDURE SetTextColor(Col: CARDINAL): CARDINAL;
  4052. 3331
  4053. 3332 BEGIN
  4054. 3333 NotSupported( 'SetTextColor');
  4055. 3334 RETURN 0;
  4056. 3335 END SetTextColor;
  4057. 3336
  4058. 3337 PROCEDURE Init;
  4059. 3338 VAR
  4060. 3339 i,r : CARDINAL;
  4061. 3340 BEGIN
  4062. 3341 GraphI.GraphM := FALSE;
  4063. 3342 r := Dos.CreateThread(Dos.THREAD(SwapProcess),SwapThread,FarADR(SwapStack[HIGH(SwapStack)]));
  4064. 3343 FOR i := 0 TO 4 DO
  4065. 3344 GraphI.Buffer[i] := FarNIL;
  4066. 3345 END;
  4067. 3346 InitCGA;
  4068. 3347 END Init;
  4069. 3348
  4070. 3349 (*%E _XTDDOS *)
  4071. 3350
  4072. 3351 BEGIN (*Initialization*)
  4073. 3352 (*%T _XTDDOS *)
  4074. 3353 (*%T _XTD *)
  4075. 3354 TSXLIB.InitInt10;
  4076. 3355 (*%E *)
  4077. 3356 (*%T AutoDetect *)
  4078. 3357 InitGraph();
  4079. 3358 (*%E *)
  4080. 3359 (*%F AutoDetect *)
  4081. 3360 InitCGA;
  4082. 3361 (*%E *)
  4083. 3362 Lib.Terminate(GraphTerminate, C);
  4084. 3363 FillState:=_GFILLINTERIOR;
  4085. 3364 ModeChanged := FALSE;
  4086. 3365 EGATable := EGATableType( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
  4087. 3366 (*%E *)
  4088. 3367 (*%F _XTDDOS *)
  4089. 3368 (*%F _fcall *)
  4090. 3369 IO.WrStr('OS/2 Graphics Not Supported In This Model.');
  4091. 3370 IO.WrLn;
  4092. 3371 HALT;
  4093. 3372 (*%E *)
  4094. 3373 Init;
  4095. 3374 (*%E _XTDDOS *)
  4096. 3375 END Graph.
  4097. 720 errors