graph.tex 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1997, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. % Documentation for the 'Graph' unit of Free Pascal.
  22. % Michael Van Canneyt, July 1997
  23. \chapter{The GRAPH unit.}
  24. \FPCexampledir{graphex}
  25. This document describes the \var{GRAPH} unit for Free Pascal, for all
  26. platforms. The unit was first written for \dos by Florian kl\"ampfl, but was
  27. later completely rewritten by Carl-Eric Codere to be completely portable.
  28. The unit is provided for compatibility only: It is recommended to use more
  29. modern graphical systems. The graph unit will allow to recompile old
  30. programs, they will work to some extent, but if the application has
  31. heavy graphical needs, it's recommended to use another set of graphical
  32. routines, suited to the platform the program should work on.
  33. This chapter is divided in 4 sections.
  34. \begin{itemize}
  35. \item The first section gives an introduction to the graph unit.
  36. \item The second section lists the pre-defined constants, types and variables.
  37. \item The second section describes the functions which appear in the
  38. interface part of the \file{GRAPH} unit.
  39. \item The last part describes some system-specific issues.
  40. \end{itemize}
  41. \section{Introduction}
  42. \label{se:Introduction}
  43. \subsection{Requirements}
  44. The unit Graph exports functions and procedures for graphical output.
  45. It requires at least a VGA-compatible Card or a VGA-Card with software-driver
  46. (min. \textbf{512Kb} video memory).
  47. \subsection{A word about mode selection}
  48. The graph unit was implemented for compatibility with the old \tp graph
  49. unit. For this reason, the mode constants as they were defined in the
  50. \tp graph unit are retained.
  51. However, since
  52. \begin{enumerate}
  53. \item Video cards have evolved very much
  54. \item Free Pascal runs on multiple platforms
  55. \end{enumerate}
  56. it was decided to implement new mode and graphic driver constants,
  57. which are more independent of the specific platform the program runs on.
  58. In this section we give a short explanation of the new mode system. the
  59. following drivers were defined:
  60. \begin{verbatim}
  61. D1bit = 11;
  62. D2bit = 12;
  63. D4bit = 13;
  64. D6bit = 14; { 64 colors Half-brite mode - Amiga }
  65. D8bit = 15;
  66. D12bit = 16; { 4096 color modes HAM mode - Amiga }
  67. D15bit = 17;
  68. D16bit = 18;
  69. D24bit = 19; { not yet supported }
  70. D32bit = 20; { not yet supported }
  71. D64bit = 21; { not yet supported }
  72. lowNewDriver = 11;
  73. highNewDriver = 21;
  74. \end{verbatim}
  75. Each of these drivers specifies a desired color-depth.
  76. The following modes have been defined:
  77. \begin{verbatim}
  78. detectMode = 30000;
  79. m320x200 = 30001;
  80. m320x256 = 30002; { amiga resolution (PAL) }
  81. m320x400 = 30003; { amiga/atari resolution }
  82. m512x384 = 30004; { mac resolution }
  83. m640x200 = 30005; { vga resolution }
  84. m640x256 = 30006; { amiga resolution (PAL) }
  85. m640x350 = 30007; { vga resolution }
  86. m640x400 = 30008;
  87. m640x480 = 30009;
  88. m800x600 = 30010;
  89. m832x624 = 30011; { mac resolution }
  90. m1024x768 = 30012;
  91. m1280x1024 = 30013;
  92. m1600x1200 = 30014;
  93. m2048x1536 = 30015;
  94. lowNewMode = 30001;
  95. highNewMode = 30015;
  96. \end{verbatim}
  97. These modes start at 30000 because Borland specified that the mode number
  98. should be ascending with increasing X resolution, and the new constants
  99. shouldn't interfere with the old ones.
  100. The above constants can be used to set a certain color depth and resultion,
  101. as demonstrated in the following example:
  102. \FPCexample{inigraph1}
  103. If other modes than the ones above are supported by the graphics card,
  104. you will not be able to select them with this mechanism.
  105. For this reason, there is also a 'dynamic' mode number, which is assigned at
  106. run-time. This number increases with increasing X resolution. It can be
  107. queried with the \var{getmoderange} call. This call will return the range
  108. of modes which are valid for a certain graphics driver. The numbers are
  109. guaranteed to be consecutive, and can be used to search for a certain
  110. resolution, as in the following example:
  111. \FPCexample{inigraph2}
  112. Thus, the \var{getmoderange} function can be used to detect all available
  113. modes and drivers, as in the following example:
  114. \FPCexample{modrange}
  115. \section{Constants, Types and Variables}
  116. \subsection{Types}
  117. \begin{verbatim}
  118. ArcCoordsType = record
  119. X,Y,Xstart,Ystart,Xend,Yend : Integer;
  120. end;
  121. FillPatternType = Array [1..8] of Byte;
  122. FillSettingsType = Record
  123. Pattern,Color : Word
  124. end;
  125. LineSettingsType = Record
  126. LineStyle,Pattern, Width : Word;
  127. end;
  128. RGBRec = packed record
  129. Red: smallint;
  130. Green: smallint;
  131. Blue : smallint;
  132. end;
  133. PaletteType = record
  134. Size : longint;
  135. Colors : array[0..MaxColors] of RGBRec;
  136. end;
  137. PointType = Record
  138. X,Y : Integer;
  139. end;
  140. TextSettingsType = Record
  141. Font,Direction, CharSize, Horiz, Vert : Word
  142. end;
  143. ViewPortType = Record
  144. X1,Y1,X2,Y2 : Integer;
  145. Clip : Boolean
  146. end;
  147. \end{verbatim}
  148. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  149. % Functions and procedures by category
  150. \section{Function list by category}
  151. What follows is a listing of the available functions, grouped by category.
  152. For each function there is a reference to the page where you can find the
  153. function.
  154. \subsection{Initialization}
  155. Initialization of the graphics screen.
  156. \begin{funclist}
  157. \procref{ClearDevice}{Empty the graphics screen}
  158. \procref{CloseGraph}{Finish drawing session, return to text mode}
  159. \procref{DetectGraph}{Detect graphical modes}
  160. \procref{GetAspectRatio}{Get aspect ratio of screen}
  161. \procref{GetModeRange}{Get range of valid modes for current driver}
  162. \procref{GraphDefaults}{Set defaults}
  163. \funcref{GetDriverName}{Return name of graphical driver}
  164. \funcref{GetGraphMode}{Return current or last used graphics mode}
  165. \funcref{GetMaxMode}{Get maximum mode for current driver}
  166. \funcref{GetModeName}{Get name of current mode}
  167. \funcref{GraphErrorMsg}{String representation of graphical error}
  168. \funcref{GraphResult}{Result of last drawing operation}
  169. \procref{InitGraph}{Initialize graphics drivers}
  170. \funcref{InstallUserDriver}{Install a new driver}
  171. \funcref{RegisterBGIDriver}{Register a new driver}
  172. \procref{RestoreCRTMode}{Go back to text mode}
  173. \procref{SetGraphBufSize}{Set buffer size for graphical operations}
  174. \procref{SetGraphMode}{Set graphical mode}
  175. \end{funclist}
  176. \subsection{screen management}
  177. General drawing screen management functions.
  178. \begin{funclist}
  179. \procref{ClearViewPort}{Clear the current viewport}
  180. \procref{GetImage}{Copy image from screen to memory}
  181. \funcref{GetMaxX}{Get maximum X coordinate}
  182. \funcref{GetMaxY}{Get maximum Y coordinate}
  183. \funcref{GetX}{Get current X position}
  184. \funcref{GetY}{Get current Y position}
  185. \funcref{ImageSize}{Get size of selected image}
  186. \procref{GetViewSettings}{Get current viewport settings}
  187. \procref{PutImage}{Copy image from memory to screen}
  188. \procref{SetActivePage}{Set active video page}
  189. \procref{SetAspectRatio}{Set aspect ratio for drawing routines}
  190. \procref{SetViewPort}{Set current viewport}
  191. \procref{SetVisualPage}{Set visual page}
  192. \procref{SetWriteMode}{Set write mode for screen operations}
  193. \end{funclist}
  194. \subsection{Color management}
  195. All functions related to color management.
  196. \begin{funclist}
  197. \funcref{GetBkColor}{Get current background color}
  198. \funcref{GetColor}{Get current foreground color}
  199. \procref{GetDefaultPalette}{Get default palette entries}
  200. \funcref{GetMaxColor}{Get maximum valid color}
  201. \funcref{GetPaletteSize}{Get size of palette for current mode}
  202. \funcref{GetPixel}{Get color of selected pixel}
  203. \procref{GetPalette}{Get palette entry}
  204. \procref{SetAllPallette}{Set all colors in palette}
  205. \procref{SetBkColor}{Set background color}
  206. \procref{SetColor}{Set foreground color}
  207. \procref{SetPalette}{Set palette entry}
  208. \procref{SetRGBPalette}{Set palette entry with RGB values}
  209. \end{funclist}
  210. \subsection{Drawing primitives}
  211. Functions for simple drawing.
  212. \begin{funclist}
  213. \procref{Arc}{Draw an arc}
  214. \procref{Circle}{Draw a complete circle}
  215. \procref{DrawPoly}{Draw a polygone with N points}
  216. \procref{Ellipse}{Draw an ellipse}
  217. \procref{GetArcCoords}{Get arc coordinates}
  218. \procref{GetLineSettings}{Get current line drawing settings}
  219. \procref{Line}{Draw line between 2 points}
  220. \procref{LineRel}{Draw line relative to current position}
  221. \procref{LineTo}{Draw line from current position to absolute position}
  222. \procref{MoveRel}{Move cursor relative to current position}
  223. \procref{MoveTo}{Move cursor to absolute position}
  224. \procref{PieSlice}{Draw a pie slice}
  225. \procref{PutPixel}{Draw 1 pixel}
  226. \procref{Rectangle}{Draw a non-filled rectangle}
  227. \procref{Sector}{Draw a sector}
  228. \procref{SetLineStyle}{Set current line drawing style}
  229. \end{funclist}
  230. \subsection{Filled drawings}
  231. Functions for drawing filled regions.
  232. \begin{funclist}
  233. \procref{Bar3D}{Draw a filled 3D-style bar}
  234. \procref{Bar}{Draw a filled rectangle}
  235. \procref{FloodFill}{Fill starting from coordinate}
  236. \procref{FillEllipse}{Draw a filled ellipse}
  237. \procref{FillPoly}{Draw a filled polygone}
  238. \procref{GetFillPattern}{Get current fill pattern}
  239. \procref{GetFillSettings}{Get current fill settings}
  240. \procref{SetFillPattern}{Set current fill pattern}
  241. \procref{SetFillStyle}{Set current fill settings}
  242. \end{funclist}
  243. \subsection{Text and font handling}
  244. Functions to set texts on the screen.
  245. \begin{funclist}
  246. \procref{GetTextSettings}{Get current text settings}
  247. \funcref{InstallUserFont}{Install a new font}
  248. \procref{OutText}{Write text at current cursor position}
  249. \procref{OutTextXY}{Write text at coordinates X,Y}
  250. \funcref{RegisterBGIFont}{Register a new font}
  251. \procref{SetTextJustify}{Set text justification}
  252. \procref{SetTextStyle}{Set text style}
  253. \procref{SetUserCharSize}{Set text size}
  254. \funcref{TextHeight}{Calculate height of text}
  255. \funcref{TextWidth}{Calculate width of text}
  256. \end{funclist}
  257. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  258. % Functions and procedures
  259. \section{Functions and procedures}
  260. \begin{procedure}{Arc}
  261. \Declaration
  262. Procedure Arc (X,Y : Integer; start,stop, radius : Word);
  263. \Description
  264. \var{Arc} draws part of a circle with center at \var{(X,Y)}, radius
  265. \var{radius}, starting from angle \var{start}, stopping at angle \var{stop}.
  266. These angles are measured
  267. counterclockwise.
  268. \Errors
  269. None.
  270. \SeeAlso
  271. \seep{Circle},\seep{Ellipse}
  272. \seep{GetArcCoords},\seep{PieSlice}, \seep{Sector}
  273. \end{procedure}
  274. \begin{procedure}{Bar}
  275. \Declaration
  276. Procedure Bar (X1,Y1,X2,Y2 : Integer);
  277. \Description
  278. Draws a rectangle with corners at \var{(X1,Y1)} and \var{(X2,Y2)}
  279. and fills it with the current color and fill-style.
  280. \Errors
  281. None.
  282. \SeeAlso
  283. \seep{Bar3D},
  284. \seep{Rectangle}
  285. \end{procedure}
  286. \begin{procedure}{Bar3D}
  287. \Declaration
  288. Procedure Bar3D (X1,Y1,X2,Y2 : Integer; depth : Word; Top : Boolean);
  289. \Description
  290. Draws a 3-dimensional Bar with corners at \var{(X1,Y1)} and \var{(X2,Y2)}
  291. and fills it with the current color and fill-style.
  292. \var{Depth} specifies the number of pixels used to show the depth of the
  293. bar.
  294. If \var{Top} is true; then a 3-dimensional top is drawn.
  295. \Errors
  296. None.
  297. \SeeAlso
  298. \seep{Bar}, \seep{Rectangle}
  299. \end{procedure}
  300. \begin{procedure}{Circle}
  301. \Declaration
  302. Procedure Circle (X,Y : Integer; Radius : Word);
  303. \Description
  304. \var{Circle} draws part of a circle with center at \var{(X,Y)}, radius
  305. \var{radius}.
  306. \Errors
  307. None.
  308. \SeeAlso
  309. \seep{Ellipse},\seep{Arc}
  310. \seep{GetArcCoords},\seep{PieSlice}, \seep{Sector}
  311. \end{procedure}
  312. \begin{procedure}{ClearDevice}
  313. \Declaration
  314. Procedure ClearDevice ;
  315. \Description
  316. Clears the graphical screen (with the current
  317. background color), and sets the pointer at \var{(0,0)}
  318. \Errors
  319. None.
  320. \SeeAlso
  321. \seep{ClearViewPort}, \seep{SetBkColor}
  322. \end{procedure}
  323. \begin{procedure}{ClearViewPort}
  324. \Declaration
  325. Procedure ClearViewPort ;
  326. \Description
  327. Clears the current viewport. The current background color is used as filling
  328. color. The pointer is set at
  329. \var{(0,0)}
  330. \Errors
  331. None.
  332. \SeeAlso
  333. \seep{ClearDevice},\seep{SetViewPort}, \seep{SetBkColor}
  334. \end{procedure}
  335. \begin{procedure}{CloseGraph}
  336. \Declaration
  337. Procedure CloseGraph ;
  338. \Description
  339. Closes the graphical system, and restores the
  340. screen modus which was active before the graphical modus was
  341. activated.
  342. \Errors
  343. None.
  344. \SeeAlso
  345. \seep{InitGraph}
  346. \end{procedure}
  347. \begin{procedure}{DetectGraph}
  348. \Declaration
  349. Procedure DetectGraph (Var Driver, Modus : Integer);
  350. \Description
  351. Checks the hardware in the PC and determines the driver and screen-modus to
  352. be used. These are returned in \var{Driver} and \var{Modus}, and can be fed
  353. to \var{InitGraph}.
  354. See the \var{InitGraph} for a list of drivers and modi.
  355. \Errors
  356. None.
  357. \SeeAlso
  358. \seep{InitGraph}
  359. \end{procedure}
  360. \begin{procedure}{DrawPoly}
  361. \Declaration
  362. Procedure DrawPoly (NumberOfPoints : Word; Var PolyPoints;
  363. \Description
  364. Draws a polygone with \var{NumberOfPoints} corner points, using the
  365. current color and line-style. PolyPoints is an array of type \var{PointType}.
  366. \Errors
  367. None.
  368. \SeeAlso
  369. \seep{Bar}, seep{Bar3D}, \seep{Rectangle}
  370. \end{procedure}
  371. \begin{procedure}{Ellipse}
  372. \Declaration
  373. Procedure Ellipse (X,Y : Integer; Start,Stop,XRadius,YRadius : Word);
  374. \Description
  375. \var{Ellipse} draws part of an ellipse with center at \var{(X,Y)}.
  376. \var{XRadius} and \var{Yradius} are the horizontal and vertical radii of the
  377. ellipse. \var{Start} and \var{Stop} are the starting and stopping angles of
  378. the part of the ellipse. They are measured counterclockwise from the X-axis
  379. (3 o'clock is equal to 0 degrees). Only positive angles can be specified.
  380. \Errors
  381. None.
  382. \SeeAlso
  383. \seep{Arc} \seep{Circle}, \seep{FillEllipse}
  384. \end{procedure}
  385. \begin{procedure}{FillEllipse}
  386. \Declaration
  387. Procedure FillEllipse (X,Y : Integer; Xradius,YRadius: Word);
  388. \Description
  389. \var{Ellipse} draws an ellipse with center at \var{(X,Y)}.
  390. \var{XRadius} and \var{Yradius} are the horizontal and vertical radii of the
  391. ellipse. The ellipse is filled with the current color and fill-style.
  392. \Errors
  393. None.
  394. \SeeAlso
  395. \seep{Arc} \seep{Circle},
  396. \seep{GetArcCoords},\seep{PieSlice}, \seep{Sector}
  397. \end{procedure}
  398. \begin{procedure}{FillPoly}
  399. \Declaration
  400. Procedure FillPoly (NumberOfPoints : Word; Var PolyPoints);
  401. \Description
  402. Draws a polygone with \var{NumberOfPoints} corner points and fills it
  403. using the current color and line-style.
  404. PolyPoints is an array of type \var{PointType}.
  405. \Errors
  406. None.
  407. \SeeAlso
  408. \seep{Bar}, seep{Bar3D}, \seep{Rectangle}
  409. \end{procedure}
  410. \begin{procedure}{FloodFill}
  411. \Declaration
  412. Procedure FloodFill (X,Y : Integer; BorderColor : Word);
  413. \Description
  414. Fills the area containing the point \var{(X,Y)}, bounded by the color
  415. \var{BorderColor}.
  416. \Errors
  417. None
  418. \SeeAlso
  419. \seep{SetColor}, \seep{SetBkColor}
  420. \end{procedure}
  421. \begin{procedure}{GetArcCoords}
  422. \Declaration
  423. Procedure GetArcCoords (Var ArcCoords : ArcCoordsType);
  424. \Description
  425. \var{GetArcCoords} returns the coordinates of the latest \var{Arc} or
  426. \var{Ellipse} call.
  427. \Errors
  428. None.
  429. \SeeAlso
  430. \seep{Arc}, \seep{Ellipse}
  431. \end{procedure}
  432. \begin{procedure}{GetAspectRatio}
  433. \Declaration
  434. Procedure GetAspectRatio (Var Xasp,Yasp : Word);
  435. \Description
  436. \var{GetAspectRatio} determines the effective resolution of the screen. The aspect ration can
  437. the be calculated as \var{Xasp/Yasp}.
  438. \Errors
  439. None.
  440. \SeeAlso
  441. \seep{InitGraph},\seep{SetAspectRatio}
  442. \end{procedure}
  443. \begin{function}{GetBkColor}
  444. \Declaration
  445. Function GetBkColor : Word;
  446. \Description
  447. \var{GetBkColor} returns the current background color (the palette
  448. entry).
  449. \Errors
  450. None.
  451. \SeeAlso
  452. \seef{GetColor},\seep{SetBkColor}
  453. \end{function}
  454. \begin{function}{GetColor}
  455. \Declaration
  456. Function GetColor : Word;
  457. \Description
  458. \var{GetColor} returns the current drawing color (the palette
  459. entry).
  460. \Errors
  461. None.
  462. \SeeAlso
  463. \seef{GetColor},\seep{SetBkColor}
  464. \end{function}
  465. \begin{procedure}{GetDefaultPalette}
  466. \Declaration
  467. Procedure GetDefaultPalette (Var Palette : PaletteType);
  468. \Description
  469. Returns the
  470. current palette in \var{Palette}.
  471. \Errors
  472. None.
  473. \SeeAlso
  474. \seef{GetColor}, \seef{GetBkColor}
  475. \end{procedure}
  476. \begin{function}{GetDriverName}
  477. \Declaration
  478. Function GetDriverName : String;
  479. \Description
  480. \var{GetDriverName} returns a string containing the name of the
  481. current driver.
  482. \Errors
  483. None.
  484. \SeeAlso
  485. \seef{GetModeName}, \seep{InitGraph}
  486. \end{function}
  487. \begin{procedure}{GetFillPattern}
  488. \Declaration
  489. Procedure GetFillPattern (Var FillPattern : FillPatternType);
  490. \Description
  491. \var{GetFillPattern} returns an array with the current fill-pattern in \var{FillPattern}
  492. \Errors
  493. None
  494. \SeeAlso
  495. \seep{SetFillPattern}
  496. \end{procedure}
  497. \begin{procedure}{GetFillSettings}
  498. \Declaration
  499. Procedure GetFillSettings (Var FillInfo : FillSettingsType);
  500. \Description
  501. \var{GetFillSettings} returns the current fill-settings in
  502. \var{FillInfo}
  503. \Errors
  504. None.
  505. \SeeAlso
  506. \seep{SetFillPattern}
  507. \end{procedure}
  508. \begin{function}{GetGraphMode}
  509. \Declaration
  510. Function GetGraphMode : Integer;
  511. \Description
  512. \var{GetGraphMode} returns the current graphical modus
  513. \Errors
  514. None.
  515. \SeeAlso
  516. \seep{InitGraph}
  517. \end{function}
  518. \begin{procedure}{GetImage}
  519. \Declaration
  520. Procedure GetImage (X1,Y1,X2,Y2 : Integer, Var Bitmap;
  521. \Description
  522. \var{GetImage}
  523. Places a copy of the screen area \var{(X1,Y1)} to \var{X2,Y2} in \var{BitMap}
  524. \Errors
  525. Bitmap must have enough room to contain the image.
  526. \SeeAlso
  527. \seef{ImageSize},
  528. \seep{PutImage}
  529. \end{procedure}
  530. \begin{procedure}{GetLineSettings}
  531. \Declaration
  532. Procedure GetLineSettings (Var LineInfo : LineSettingsType);
  533. \Description
  534. \var{GetLineSettings} returns the current Line settings in
  535. \var{LineInfo}
  536. \Errors
  537. None.
  538. \SeeAlso
  539. \seep{SetLineStyle}
  540. \end{procedure}
  541. \begin{function}{GetMaxColor}
  542. \Declaration
  543. Function GetMaxColor : Word;
  544. \Description
  545. \var{GetMaxColor} returns the maximum color-number which can be
  546. set with \var{SetColor}. Contrary to \tp, this color isn't always
  547. guaranteed to be white (for instance in 256+ color modes).
  548. \Errors
  549. None.
  550. \SeeAlso
  551. \seep{SetColor},
  552. \seef{GetPaletteSize}
  553. \end{function}
  554. \begin{function}{GetMaxMode}
  555. \Declaration
  556. Function GetMaxMode : Word;
  557. \Description
  558. \var{GetMaxMode} returns the highest modus for
  559. the current driver.
  560. \Errors
  561. None.
  562. \SeeAlso
  563. \seep{InitGraph}
  564. \end{function}
  565. \begin{function}{GetMaxX}
  566. \Declaration
  567. Function GetMaxX : Word;
  568. \Description
  569. \var{GetMaxX} returns the maximum horizontal screen
  570. length
  571. \Errors
  572. None.
  573. \SeeAlso
  574. \seef{GetMaxY}
  575. \end{function}
  576. \begin{function}{GetMaxY}
  577. \Declaration
  578. Function GetMaxY : Word;
  579. \Description
  580. \var{GetMaxY} returns the maximum number of screen
  581. lines
  582. \Errors
  583. None.
  584. \SeeAlso
  585. \seef{GetMaxY}
  586. \end{function}
  587. \begin{function}{GetModeName}
  588. \Declaration
  589. Function GetModeName (Var modus : Integer) : String;
  590. \Description
  591. Returns a string with the name of modus
  592. \var{Modus}
  593. \Errors
  594. None.
  595. \SeeAlso
  596. \seef{GetDriverName}, \seep{InitGraph}
  597. \end{function}
  598. \begin{procedure}{GetModeRange}
  599. \Declaration
  600. Procedure GetModeRange (Driver : Integer; \\ LoModus, HiModus: Integer);
  601. \Description
  602. \var{GetModeRange} returns the Lowest and Highest modus of the currently
  603. installed driver. If no modes are supported for this driver, HiModus
  604. will be -1.
  605. \Errors
  606. None.
  607. \SeeAlso
  608. \seep{InitGraph}
  609. \end{procedure}
  610. \begin{procedure}{GetPalette}
  611. \Declaration
  612. Procedure GetPalette (Var Palette : PaletteType);
  613. \Description
  614. \var{GetPalette} returns in \var{Palette} the current palette.
  615. \Errors
  616. None.
  617. \SeeAlso
  618. \seef{GetPaletteSize}, \seep{SetPalette}
  619. \end{procedure}
  620. \begin{function}{GetPaletteSize}
  621. \Declaration
  622. Function GetPaletteSize : Word;
  623. \Description
  624. \var{GetPaletteSize} returns the maximum
  625. number of entries in the current palette.
  626. \Errors
  627. None.
  628. \SeeAlso
  629. \seep{GetPalette},
  630. \seep{SetPalette}
  631. \end{function}
  632. \begin{function}{GetPixel}
  633. \Declaration
  634. Function GetPixel (X,Y : Integer) : Word;
  635. \Description
  636. \var{GetPixel} returns the color
  637. of the point at \var{(X,Y)}
  638. \Errors
  639. None.
  640. \SeeAlso
  641. \end{function}
  642. \begin{procedure}{GetTextSettings}
  643. \Declaration
  644. Procedure GetTextSettings (Var TextInfo : TextSettingsType);
  645. \Description
  646. \var{GetTextSettings} returns the current text style settings : The font,
  647. direction, size and placement as set with \var{SetTextStyle} and
  648. \var{SetTextJustify}
  649. \Errors
  650. None.
  651. \SeeAlso
  652. \seep{SetTextStyle}, \seep{SetTextJustify}
  653. \end{procedure}
  654. \begin{procedure}{GetViewSettings}
  655. \Declaration
  656. Procedure GetViewSettings (Var ViewPort : ViewPortType);
  657. \Description
  658. \var{GetViewSettings} returns the current viewport and clipping settings in
  659. \var{ViewPort}.
  660. \Errors
  661. None.
  662. \SeeAlso
  663. \seep{SetViewPort}
  664. \end{procedure}
  665. \begin{function}{GetX}
  666. \Declaration
  667. Function GetX : Integer;
  668. \Description
  669. \var{GetX} returns the X-coordinate of the current position of
  670. the graphical pointer
  671. \Errors
  672. None.
  673. \SeeAlso
  674. \seef{GetY}
  675. \end{function}
  676. \begin{function}{GetY}
  677. \Declaration
  678. Function GetY : Integer;
  679. \Description
  680. \var{GetY} returns the Y-coordinate of the current position of
  681. the graphical pointer
  682. \Errors
  683. None.
  684. \SeeAlso
  685. \seef{GetX}
  686. \end{function}
  687. \begin{procedure}{GraphDefaults}
  688. \Declaration
  689. Procedure GraphDefaults ;
  690. \Description
  691. \var{GraphDefaults} resets all settings for viewport, palette,
  692. foreground and background pattern, line-style and pattern, filling style,
  693. filling color and pattern, font, text-placement and
  694. text size.
  695. \Errors
  696. None.
  697. \SeeAlso
  698. \seep{SetViewPort}, \seep{SetFillStyle}, \seep{SetColor},
  699. \seep{SetBkColor}, \seep{SetLineStyle}
  700. \end{procedure}
  701. \begin{function}{GraphErrorMsg}
  702. \Declaration
  703. Function GraphErrorMsg (ErrorCode : Integer) : String;
  704. \Description
  705. \var{GraphErrorMsg}
  706. returns a string describing the error \var{Errorcode}. This string can be
  707. used to let the user know what went wrong.
  708. \Errors
  709. None.
  710. \SeeAlso
  711. \seef{GraphResult}
  712. \end{function}
  713. \begin{function}{GraphResult}
  714. \Declaration
  715. Function GraphResult : Integer;
  716. \Description
  717. \var{GraphResult} returns an error-code for
  718. the last graphical operation. If the returned value is zero, all went well.
  719. A value different from zero means an error has occurred.
  720. besides all operations which draw something on the screen,
  721. the following procedures also can produce a \var{GraphResult} different from
  722. zero:
  723. \begin{itemize}
  724. \item \seef{InstallUserFont}
  725. \item \seep{SetLineStyle}
  726. \item \seep{SetWriteMode}
  727. \item \seep{SetFillStyle}
  728. \item \seep{SetTextJustify}
  729. \item \seep{SetGraphMode}
  730. \item \seep{SetTextStyle}
  731. \end{itemize}
  732. \Errors
  733. None.
  734. \SeeAlso
  735. \seef{GraphErrorMsg}
  736. \end{function}
  737. \begin{function}{ImageSize}
  738. \Declaration
  739. Function ImageSize (X1,Y1,X2,Y2 : Integer) : Word;
  740. \Description
  741. \var{ImageSize} returns
  742. the number of bytes needed to store the image in the rectangle defined by
  743. \var{(X1,Y1)} and \var{(X2,Y2)}.
  744. \Errors
  745. None.
  746. \SeeAlso
  747. \seep{GetImage}
  748. \end{function}
  749. \begin{procedure}{InitGraph}
  750. \Declaration
  751. Procedure InitGraph (var GraphDriver,GraphModus : integer;\\
  752. const PathToDriver : string);
  753. \Description
  754. \var{InitGraph} initializes the \var{graph} package.
  755. \var{GraphDriver} has two valid values: \var{GraphDriver=0} which
  756. performs an auto detect and initializes the highest possible mode with the most
  757. colors. 1024x768x64K is the highest possible resolution supported by the
  758. driver, if you need a higher resolution, you must edit \file{MODES.PPI}.
  759. If you need another mode, then set \var{GraphDriver} to a value different
  760. from zero
  761. and \var{graphmode} to the mode you wish (VESA modes where 640x480x256
  762. is \var {101h} etc.).
  763. \var{PathToDriver} is only needed, if you use the BGI fonts from
  764. Borland. Free Pascal does not offer BGI fonts like Borland, these must be
  765. obtained separately.
  766. \Errors
  767. None.
  768. \SeeAlso
  769. Introduction, (page \pageref{se:Introduction}),
  770. \seep{DetectGraph}, \seep{CloseGraph}, \seef{GraphResult}
  771. \end{procedure}
  772. Example:
  773. \begin{verbatim}
  774. var
  775. gd,gm : integer;
  776. PathToDriver : string;
  777. begin
  778. gd:=detect; { highest possible resolution }
  779. gm:=0; { not needed, auto detection }
  780. PathToDriver:='C:\PP\BGI'; { path to BGI fonts,
  781. drivers aren't needed }
  782. InitGraph(gd,gm,PathToDriver);
  783. if GraphResult<>grok then
  784. halt; ..... { whatever you need }
  785. CloseGraph; { restores the old graphics mode }
  786. end.
  787. \end{verbatim}
  788. \begin{function}{InstallUserDriver}
  789. \Declaration
  790. Function InstallUserDriver (DriverPath : String; \\AutoDetectPtr: Pointer) : Integer;
  791. \Description
  792. \var{InstallUserDriver}
  793. adds the device-driver \var{DriverPath} to the list of .BGI
  794. drivers. \var{AutoDetectPtr} is a pointer to a possible auto-detect function.
  795. \Errors
  796. None.
  797. \SeeAlso
  798. \seep{InitGraph}, \seef{InstallUserFont}
  799. \end{function}
  800. \begin{function}{InstallUserFont}
  801. \Declaration
  802. Function InstallUserFont (FontPath : String) : Integer;
  803. \Description
  804. \var{InstallUserFont} adds the font in \var{FontPath} to the list of fonts
  805. of the .BGI system.
  806. \Errors
  807. None.
  808. \SeeAlso
  809. \seep{InitGraph}, \seef{InstallUserDriver}
  810. \end{function}
  811. \begin{procedure}{Line}
  812. \Declaration
  813. Procedure Line (X1,Y1,X2,Y2 : Integer);
  814. \Description
  815. \var{Line} draws a line starting from
  816. \var{(X1,Y1} to \var{(X2,Y2)}, in the current line style and color. The
  817. current position is put to \var{(X2,Y2)}
  818. \Errors
  819. None.
  820. \SeeAlso
  821. \seep{LineRel},\seep{LineTo}
  822. \end{procedure}
  823. \begin{procedure}{LineRel}
  824. \Declaration
  825. Procedure LineRel (DX,DY : Integer);
  826. \Description
  827. \var{LineRel} draws a line starting from
  828. the current pointer position to the point\var{(DX,DY}, \textbf{relative} to the
  829. current position, in the current line style and color. The Current Position
  830. is set to the endpoint of the line.
  831. \Errors
  832. None.
  833. \SeeAlso
  834. \seep{Line}, \seep{LineTo}
  835. \end{procedure}
  836. \begin{procedure}{LineTo}
  837. \Declaration
  838. Procedure LineTo (DX,DY : Integer);
  839. \Description
  840. \var{LineTo} draws a line starting from
  841. the current pointer position to the point\var{(DX,DY}, \textbf{relative} to the
  842. current position, in the current line style and color. The Current position
  843. is set to the end of the line.
  844. \Errors
  845. None.
  846. \SeeAlso
  847. \seep{LineRel},\seep{Line}
  848. \end{procedure}
  849. \begin{procedure}{MoveRel}
  850. \Declaration
  851. Procedure MoveRel (DX,DY : Integer;
  852. \Description
  853. \var{MoveRel} moves the pointer to the
  854. point \var{(DX,DY)}, relative to the current pointer
  855. position
  856. \Errors
  857. None.
  858. \SeeAlso
  859. \seep{MoveTo}
  860. \end{procedure}
  861. \begin{procedure}{MoveTo}
  862. \Declaration
  863. Procedure MoveTo (X,Y : Integer;
  864. \Description
  865. \var{MoveTo} moves the pointer to the
  866. point \var{(X,Y)}.
  867. \Errors
  868. None.
  869. \SeeAlso
  870. \seep{MoveRel}
  871. \end{procedure}
  872. \begin{procedure}{OutText}
  873. \Declaration
  874. Procedure OutText (Const TextString : String);
  875. \Description
  876. \var{OutText} puts \var{TextString} on the screen, at the current pointer
  877. position, using the current font and text settings. The current position is
  878. moved to the end of the text.
  879. \Errors
  880. None.
  881. \SeeAlso
  882. \seep{OutTextXY}
  883. \end{procedure}
  884. \begin{procedure}{OutTextXY}
  885. \Declaration
  886. Procedure OutTextXY (X,Y : Integer; Const TextString : String);
  887. \Description
  888. \var{OutText} puts \var{TextString} on the screen, at position \var{(X,Y)},
  889. using the current font and text settings. The current position is
  890. moved to the end of the text.
  891. \Errors
  892. None.
  893. \SeeAlso
  894. \seep{OutText}
  895. \end{procedure}
  896. \begin{procedure}{PieSlice}
  897. \Declaration
  898. Procedure PieSlice (X,Y : Integer; \\ Start,Stop,Radius : Word);
  899. \Description
  900. \var{PieSlice}
  901. draws and fills a sector of a circle with center \var{(X,Y)} and radius
  902. \var{Radius}, starting at angle \var{Start} and ending at angle \var{Stop}.
  903. \Errors
  904. None.
  905. \SeeAlso
  906. \seep{Arc}, \seep{Circle}, \seep{Sector}
  907. \end{procedure}
  908. \begin{procedure}{PutImage}
  909. \Declaration
  910. Procedure PutImage (X1,Y1 : Integer; Var Bitmap; How : word) ;
  911. \Description
  912. \var{PutImage}
  913. Places the bitmap in \var{Bitmap} on the screen at \var{(X1,Y1)}. \var{How}
  914. determines how the bitmap will be placed on the screen. Possible values are :
  915. \begin{itemize}
  916. \item CopyPut
  917. \item XORPut
  918. \item ORPut
  919. \item AndPut
  920. \item NotPut
  921. \end{itemize}
  922. \Errors
  923. None
  924. \SeeAlso
  925. \seef{ImageSize},\seep{GetImage}
  926. \end{procedure}
  927. \begin{procedure}{PutPixel}
  928. \Declaration
  929. Procedure PutPixel (X,Y : Integer; Color : Word);
  930. \Description
  931. Puts a point at
  932. \var{(X,Y)} using color \var{Color}
  933. \Errors
  934. None.
  935. \SeeAlso
  936. \seef{GetPixel}
  937. \end{procedure}
  938. \begin{procedure}{Rectangle}
  939. \Declaration
  940. Procedure Rectangle (X1,Y1,X2,Y2 : Integer);
  941. \Description
  942. Draws a rectangle with
  943. corners at \var{(X1,Y1)} and \var{(X2,Y2)}, using the current color and
  944. style.
  945. \Errors
  946. None.
  947. \SeeAlso
  948. \seep{Bar}, \seep{Bar3D}
  949. \end{procedure}
  950. \begin{function}{RegisterBGIDriver}
  951. \Declaration
  952. Function RegisterBGIDriver (Driver : Pointer) : Integer;
  953. \Description
  954. Registers a user-defined BGI driver
  955. \Errors
  956. None.
  957. \SeeAlso
  958. \seef{InstallUserDriver},
  959. \seef{RegisterBGIFont}
  960. \end{function}
  961. \begin{function}{RegisterBGIFont}
  962. \Declaration
  963. Function RegisterBGIFont (Font : Pointer) : Integer;
  964. \Description
  965. Registers a user-defined BGI driver
  966. \Errors
  967. None.
  968. \SeeAlso
  969. \seef{InstallUserFont},
  970. \seef{RegisterBGIDriver}
  971. \end{function}
  972. \begin{procedure}{RestoreCRTMode}
  973. \Declaration
  974. Procedure RestoreCRTMode ;
  975. \Description
  976. Restores the screen modus which was active before
  977. the graphical modus was started.
  978. To get back to the graph mode you were last in, you can use
  979. \var{SetGraphMode(GetGraphMode)}
  980. \Errors
  981. None.
  982. \SeeAlso
  983. \seep{InitGraph}
  984. \end{procedure}
  985. \begin{procedure}{Sector}
  986. \Declaration
  987. Procedure Sector (X,Y : Integer; \\ Start,Stop,XRadius,YRadius : Word);
  988. \Description
  989. \var{Sector}
  990. draws and fills a sector of an ellipse with center \var{(X,Y)} and radii
  991. \var{XRadius} and \var{YRadius}, starting at angle \var{Start} and ending at angle \var{Stop}.
  992. \Errors
  993. None.
  994. \SeeAlso
  995. \seep{Arc}, \seep{Circle}, \seep{PieSlice}
  996. \end{procedure}
  997. \begin{procedure}{SetActivePage}
  998. \Declaration
  999. Procedure SetActivePage (Page : Word);
  1000. \Description
  1001. Sets \var{Page} as the active page
  1002. for all graphical output.
  1003. \Errors
  1004. None.
  1005. \SeeAlso
  1006. \end{procedure}
  1007. \begin{procedure}{SetAllPallette}
  1008. \Declaration
  1009. Procedure SetAllPallette (Var Palette);
  1010. \Description
  1011. Sets the current palette to
  1012. \var{Palette}. \var{Palette} is an untyped variable, usually pointing to a
  1013. record of type \var{PaletteType}
  1014. \Errors
  1015. None.
  1016. \SeeAlso
  1017. \seep{GetPalette}
  1018. \end{procedure}
  1019. \begin{procedure}{SetAspectRatio}
  1020. \Declaration
  1021. Procedure SetAspectRatio (Xasp,Yasp : Word);
  1022. \Description
  1023. Sets the aspect ratio of the
  1024. current screen to \var{Xasp/Yasp}.
  1025. \Errors
  1026. None
  1027. \SeeAlso
  1028. \seep{InitGraph}, \seep{GetAspectRatio}
  1029. \end{procedure}
  1030. \begin{procedure}{SetBkColor}
  1031. \Declaration
  1032. Procedure SetBkColor (Color : Word);
  1033. \Description
  1034. Sets the background color to
  1035. \var{Color}.
  1036. \Errors
  1037. None.
  1038. \SeeAlso
  1039. \seef{GetBkColor}, \seep{SetColor}
  1040. \end{procedure}
  1041. \begin{procedure}{SetColor}
  1042. \Declaration
  1043. Procedure SetColor (Color : Word);
  1044. \Description
  1045. Sets the foreground color to
  1046. \var{Color}.
  1047. \Errors
  1048. None.
  1049. \SeeAlso
  1050. \seef{GetColor}, \seep{SetBkColor}
  1051. \end{procedure}
  1052. \begin{procedure}{SetFillPattern}
  1053. \Declaration
  1054. Procedure SetFillPattern (FillPattern : FillPatternType,\\ Color : Word);
  1055. \Description
  1056. \var{SetFillPattern} sets the current fill-pattern to \var{FillPattern}, and
  1057. the filling color to \var{Color}
  1058. The pattern is an 8x8 raster, corresponding to the 64 bits in
  1059. \var{FillPattern}.
  1060. \Errors
  1061. None
  1062. \SeeAlso
  1063. \seep{GetFillPattern}, \seep{SetFillStyle}
  1064. \end{procedure}
  1065. \begin{procedure}{SetFillStyle}
  1066. \Declaration
  1067. Procedure SetFillStyle (Pattern,Color : word);
  1068. \Description
  1069. \var{SetFillStyle} sets the filling pattern and color to one of the
  1070. predefined filling patterns. \var{Pattern} can be one of the following predefined
  1071. constants :
  1072. \begin{itemize}
  1073. \item \var{EmptyFill } Uses backgroundcolor.
  1074. \item \var{SolidFill } Uses filling color
  1075. \item \var{LineFill } Fills with horizontal lines.
  1076. \item \var{ltSlashFill} Fills with lines from left-under to top-right.
  1077. \item \var{SlashFill } Idem as previous, thick lines.
  1078. \item \var{BkSlashFill} Fills with thick lines from left-Top to bottom-right.
  1079. \item \var{LtBkSlashFill} Idem as previous, normal lines.
  1080. \item \var{HatchFill} Fills with a hatch-like pattern.
  1081. \item \var{XHatchFill} Fills with a hatch pattern, rotated 45 degrees.
  1082. \item \var{InterLeaveFill}
  1083. \item \var{WideDotFill} Fills with dots, wide spacing.
  1084. \item \var{CloseDotFill} Fills with dots, narrow spacing.
  1085. \item \var{UserFill} Fills with a user-defined pattern.
  1086. \end{itemize}
  1087. \Errors
  1088. None.
  1089. \SeeAlso
  1090. \seep{SetFillPattern}
  1091. \end{procedure}
  1092. \begin{procedure}{SetGraphBufSize}
  1093. \Declaration
  1094. Procedure SetGraphBufSize (BufSize : Word);
  1095. \Description
  1096. \var{SetGraphBufSize} is a dummy function which does not do
  1097. anything; it is no longer needed.
  1098. \Errors
  1099. None.
  1100. \SeeAlso
  1101. \end{procedure}
  1102. \begin{procedure}{SetGraphMode}
  1103. \Declaration
  1104. Procedure SetGraphMode (Mode : Integer);
  1105. \Description
  1106. \var{SetGraphMode} sets the graphical mode and clears the screen.
  1107. \Errors
  1108. None.
  1109. \SeeAlso
  1110. \seep{InitGraph}
  1111. \end{procedure}
  1112. \begin{procedure}{SetLineStyle}
  1113. \Declaration
  1114. Procedure SetLineStyle (LineStyle,Pattern,Width :
  1115. Word);
  1116. \Description
  1117. \var{SetLineStyle}
  1118. sets the drawing style for lines. You can specify a \var{LineStyle} which is
  1119. one of the following pre-defined constants:
  1120. \begin{itemize}
  1121. \item \var{Solidln=0;} draws a solid line.
  1122. \item \var{Dottedln=1;} Draws a dotted line.
  1123. \item \var{Centerln=2;} draws a non-broken centered line.
  1124. \item \var{Dashedln=3;} draws a dashed line.
  1125. \item \var{UserBitln=4;} Draws a User-defined bit pattern.
  1126. \end{itemize}
  1127. If \var{UserBitln} is specified then \var{Pattern} contains the bit pattern.
  1128. In all another cases, \var{Pattern} is ignored. The parameter \var{Width}
  1129. indicates how thick the line should be. You can specify one of the following
  1130. pre-defined constants:
  1131. \begin{itemize}
  1132. \item \var{NormWidth=1}
  1133. \item \var{ThickWidth=3}
  1134. \end{itemize}
  1135. \Errors
  1136. None.
  1137. \SeeAlso
  1138. \seep{GetLineSettings}
  1139. \end{procedure}
  1140. \begin{procedure}{SetPalette}
  1141. \Declaration
  1142. Procedure SetPalette (ColorNr : Word; NewColor : ShortInt);
  1143. \Description
  1144. \var{SetPalette} changes the \var{ColorNr}-th entry in the palette to
  1145. \var{NewColor}
  1146. \Errors
  1147. None.
  1148. \SeeAlso
  1149. \seep{SetAllPallette},\seep{SetRGBPalette}
  1150. \end{procedure}
  1151. \begin{procedure}{SetRGBPalette}
  1152. \Declaration
  1153. Procedure SetRGBPalette (ColorNr,Red,Green,Blue : Integer);
  1154. \Description
  1155. \var{SetRGBPalette} sets the \var{ColorNr}-th entry in the palette to the
  1156. color with RGB-values \var{Red, Green Blue}.
  1157. \Errors
  1158. None.
  1159. \SeeAlso
  1160. \seep{SetAllPallette},
  1161. \seep{SetPalette}
  1162. \end{procedure}
  1163. \begin{procedure}{SetTextJustify}
  1164. \Declaration
  1165. Procedure SetTextJustify (Horizontal,Vertical : Word);
  1166. \Description
  1167. \var{SetTextJustify} controls the placement of new text, relative to the
  1168. (graphical) cursor position. \var{Horizontal} controls horizontal placement, and can be
  1169. one of the following pre-defined constants:
  1170. \begin{itemize}
  1171. \item \var{LeftText=0;} Text is set left of the pointer.
  1172. \item \var{CenterText=1;} Text is set centered horizontally on the pointer.
  1173. \item \var{RightText=2;} Text is set to the right of the pointer.
  1174. \end{itemize}
  1175. \var{Vertical} controls the vertical placement of the text, relative to the
  1176. (graphical) cursor position. Its value can be one of the following
  1177. pre-defined constants :
  1178. \begin{itemize}
  1179. \item \var{BottomText=0;} Text is placed under the pointer.
  1180. \item \var{CenterText=1;} Text is placed centered vertically on the pointer.
  1181. \item \var{TopText=2;}Text is placed above the pointer.
  1182. \end{itemize}
  1183. \Errors
  1184. None.
  1185. \SeeAlso
  1186. \seep{OutText}, \seep{OutTextXY}
  1187. \end{procedure}
  1188. \begin{procedure}{SetTextStyle}
  1189. \Declaration
  1190. Procedure SetTextStyle (Font,Direction,Magnitude : Word);
  1191. \Description
  1192. \var{SetTextStyle} controls the style of text to be put on the screen.
  1193. pre-defined constants for \var{Font} are:
  1194. \begin{verbatim}
  1195. DefaultFont = 0;
  1196. TriplexFont = 1;
  1197. SmallFont = 2;
  1198. SansSerifFont = 3;
  1199. GothicFont = 4;
  1200. ScriptFont = 5;
  1201. SimpleFont = 6;
  1202. TSCRFont = 7;
  1203. LCOMFont = 8;
  1204. EuroFont = 9;
  1205. BoldFont = 10;
  1206. \end{verbatim}
  1207. Pre-defined constants for \var{Direction} are :
  1208. \begin{itemize}
  1209. \item \var{HorizDir=0;}
  1210. \item \var{VertDir=1;}
  1211. \end{itemize}
  1212. \Errors
  1213. None.
  1214. \SeeAlso
  1215. \seep{GetTextSettings}
  1216. \end{procedure}
  1217. \begin{procedure}{SetUserCharSize}
  1218. \Declaration
  1219. Procedure SetUserCharSize (Xasp1,Xasp2,Yasp1,Yasp2 : Word);
  1220. \Description
  1221. Sets the width and height of vector-fonts. The horizontal size is given
  1222. by \var{Xasp1/Xasp2}, and the vertical size by \var{Yasp1/Yasp2}.
  1223. \Errors
  1224. None.
  1225. \SeeAlso
  1226. \seep{SetTextStyle}
  1227. \end{procedure}
  1228. \begin{procedure}{SetViewPort}
  1229. \Declaration
  1230. Procedure SetViewPort (X1,Y1,X2,Y2 : Integer; Clip : Boolean);
  1231. \Description
  1232. Sets the current graphical viewport (window) to the rectangle defined by
  1233. the top-left corner \var{(X1,Y1)} and the bottom-right corner \var{(X2,Y2)}.
  1234. If \var{Clip} is true, anything drawn outside the viewport (window) will be
  1235. clipped (i.e. not drawn). Coordinates specified after this call are relative
  1236. to the top-left corner of the viewport.
  1237. \Errors
  1238. None.
  1239. \SeeAlso
  1240. \seep{GetViewSettings}
  1241. \end{procedure}
  1242. \begin{procedure}{SetVisualPage}
  1243. \Declaration
  1244. Procedure SetVisualPage (Page : Word);
  1245. \Description
  1246. \var{SetVisualPage} sets the video page to page number \var{Page}.
  1247. \Errors
  1248. None
  1249. \SeeAlso
  1250. \seep{SetActivePage}
  1251. \end{procedure}
  1252. \begin{procedure}{SetWriteMode}
  1253. \Declaration
  1254. Procedure SetWriteMode (Mode : Integer);
  1255. \Description
  1256. \var{SetWriteMode} controls the drawing of lines on the screen. It controls
  1257. the binary operation used when drawing lines on the screen. \var{Mode} can
  1258. be one of the following pre-defined constants:
  1259. \begin{itemize}
  1260. \item CopyPut=0;
  1261. \item XORPut=1;
  1262. \end{itemize}
  1263. \Errors
  1264. None.
  1265. \SeeAlso
  1266. \end{procedure}
  1267. \begin{function}{TextHeight}
  1268. \Declaration
  1269. Function TextHeight (S : String) : Word;
  1270. \Description
  1271. \var{TextHeight} returns the height (in pixels) of the string \var{S} in
  1272. the current font and text-size.
  1273. \Errors
  1274. None.
  1275. \SeeAlso
  1276. \seef{TextWidth}
  1277. \end{function}
  1278. \begin{function}{TextWidth}
  1279. \Declaration
  1280. Function TextWidth (S : String) : Word;
  1281. \Description
  1282. \var{TextHeight} returns the width (in pixels) of the string \var{S} in
  1283. the current font and text-size.
  1284. \Errors
  1285. None.
  1286. \SeeAlso
  1287. \seef{TextHeight}
  1288. \end{function}
  1289. % Target specific issues.
  1290. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1291. \section{Target specific issues}
  1292. In what follows we describe some things that are different on the various
  1293. platforms:
  1294. \subsection{\dos}
  1295. VESA modes (i.e., anything but 320x200x256 and 640x480x16) do not work
  1296. under most installations of Windows NT, Windows 2000 and Windows XP.
  1297. They also do not work for some people under Windows 98 and Windows ME,
  1298. depending on their graphics drivers. However, the graph unit cannot
  1299. detect this, because no errors are returned from the system.
  1300. In such cases, the screen simply turns black, or will show garbage.
  1301. Nothing can be done about this, the reason is missing or buggy
  1302. support in the graphics drivers of the operating system.
  1303. \subsection{\windows}
  1304. The windows version of the Graph units is not very performant. It works,
  1305. thus allowing to port old TP programs to Windows, but that is all what can
  1306. be expected from it. Further, it is windowed only: A separate window is
  1307. opened in which the graphics are displayed. This means that the normal
  1308. keyboard/mouse handling as provided by the crt and/or keyboard/mouse units
  1309. wil not work in the graphical window. If keyboard and mouse input are needed
  1310. the winmouse and the wincrt unit should be used instead.
  1311. To hide the console window, compile with the
  1312. \begin{verbatim}
  1313. {$apptype gui}
  1314. \end{verbatim}
  1315. switch.
  1316. Further, the following extra modes are available:
  1317. \begin{verbatim}
  1318. mLargestWindow16 = $f0;
  1319. mLargestWindow256 = $f1;
  1320. mLargestWindow32k = $f2;
  1321. mLargestWindow64k = $f3;
  1322. mLargestWindow16M = $f4;
  1323. mMaximizedWindow16 = $f5;
  1324. mMaximizedWindow256 = $f6;
  1325. mMaximizedWindow32k = $f7;
  1326. mMaximizedWindow64k = $f8;
  1327. mMaximizedWindow16M = $f9;
  1328. \end{verbatim}
  1329. \subsection{\linux}
  1330. There are several issues on Linux that need to be taken care of:
  1331. \begin{enumerate}
  1332. \item The Linux version of the \file{Graph} unit uses the \file{libvga}
  1333. library. This library works on the console, not under X.
  1334. \item If you get an error similar to
  1335. \begin{verbatim}
  1336. /usr/bin/ld: cannot find -lvga
  1337. \end{verbatim}
  1338. This can mean one of two things: either libvga is not installed properly, or
  1339. the directory where it is installed is not in the linker path. To remedy the
  1340. former, you should install both the libvga package and libvga-devel package
  1341. (or compile and install from scratch).
  1342. To remedy the latter, you should add the path to the compiler command-line
  1343. using the \var{-Fl} option.
  1344. \item Programs using \file{libvga} need root privileges to run.
  1345. You can make them setuid root with the following command:
  1346. \begin{verbatim}
  1347. chown root.root myprogram
  1348. chmod u+s myprogram
  1349. \end{verbatim}
  1350. The libvga library will give up the root privileges after it is initialized.
  1351. \item there is an experimental version of the Graphics library available that
  1352. uses GGI to do all the drawing, but it is not well tested. It's called
  1353. \file{ggigraph} and is distributed in source form only.
  1354. \item Do not use the CRT unit together with the Graph unit: the console may
  1355. end up in an unusable state. Instead, the \file{ncurses} unit may function
  1356. fine.
  1357. \end{enumerate}