graph.tex 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1997,1999-2000 by the Free Pascal Development team
  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. % Carl Eric Codere, April 1999
  24. \chapter{The GRAPH unit.}
  25. This document describes the \textbf{GRAPH} unit for Free Pascal. This unit includes
  26. more then 50 graphics routines, that range from low-level calls such as putpixel
  27. to high level calls like Circle and Bar3D. Different fill styles and line
  28. patterns are supported in most of the routines.
  29. \section{Overview}
  30. \label{se:Overview}
  31. \subsection{Compatibility}
  32. Since the graph unit included with \var{fpc} is a portable implementation of
  33. the Turbo Pascal unit, there are some slight differences between the video
  34. modes and features.
  35. \subsubsection{Initialization}
  36. Each graph unit implementation, will have a 320x200 resolution refered to
  37. \textit{LowResolution}. If the hardware for the specific platform does
  38. not support that resolution, then it will have to be emulated. Apart
  39. from that requirement, all other resolutions will be dependant on the
  40. target platform.
  41. The correct way and portable way to initialize to graphics subsystem, is
  42. to first query the hardware, and then from that, decide which mode you
  43. wish to support. The routine which does this is called \textit{QueryAdapterInfo}.
  44. This routine returns a linked list of modes availables, and their
  45. mode number as well as driver numbers. It is to note that this list is
  46. initialized only once during the lifetime of the application (that is,
  47. even if CloseGraph is called, the list will still be valid). The memory
  48. allocated for this list is automatically freed as part as the graph
  49. unit's exit procedure.
  50. You can always use Detect as a parameter to \textit{InitGraph}
  51. which will initialize the graphics to the highest resolution possible.
  52. The following constants are also defined for compatiblity with older
  53. applications written with Turbo Pascal, they should no longer be used:
  54. \begin{tabular}{|c|c|c|}
  55. \hline
  56. Driver Name & Constant Name & Column x Row & Colors \\ \hline
  57. VGA & VGAHi & 640x480 & 16 \\
  58. VGA & VGALo & 640x200 & 16 \\
  59. VGA & VGAMed & 640x350 & 16 \\
  60. VGA & VGA256 & 320x200 & 256 \\
  61. \hline
  62. \end{tabular}
  63. \subsubsection{Other differences}
  64. Some notable differences with the Turbo Pascal graph unit are noted
  65. below:
  66. \begin{itemize}
  67. \item \textit{Rectangle} do not write
  68. the end points twice, which permits the XORPut write mode to be used
  69. effectively for erasing these forms on the screen.
  70. \item \textit{RegisterBGIDriver} and \textit{InstallUserDriver} always
  71. return errors, as they are not directly supported.
  72. \item \textit{DrawPoly} XORPut write mode does not have the same behaviour
  73. as the one in the Turbo Pascal graph unit.
  74. \item XORPut write mode is not supported by \textit{Bar3d}.
  75. \item Passing invalid parameters to \textit{SetTextStyle} will not
  76. result in the same visual appearance. Make sure your input is valid.
  77. \item All routines using sines/cosines (e.g: \textit{circle}), don't
  78. exactly have the same radii, because the aspect ratio correction is
  79. different.
  80. \item PutImage supports clipping.
  81. \item \textit{SetRGBPalette} use the LSB's of the RGB components to
  82. set the color values of the palette. This makes the unit more portable.
  83. \item \textit{PaletteType} is different then the Turbo Pascal version,
  84. it uses RGB Values for the palettes.
  85. \item \textit{SetAllPalette} is different then the Turbo Pascal version,
  86. it uses the PaletteType as a parameter.
  87. \item \textit{GetDefaultPalette} only returns only at most the 256 first
  88. default entries of a palette, even if the mode supports more then
  89. 256 colors.
  90. \end{itemize}
  91. \subsection{Coordinate system}
  92. The upper left of the graphics screen is located at position (0,0). The x
  93. value, which represents the column, increments to the right. The y values,
  94. or rows, increment downward. The maximum value which can be set for an x
  95. value, for the graphics screen is given by the \textit{GetMaxX} routine.
  96. The same is true for the y coordinate, except a call to \textit{GetMaxY}
  97. is required.
  98. \subsection{Current pointer}
  99. Some graphics routines support the concept of the current pointer (CP). The
  100. current pointer is similar in concept to a text cursor, except that it is
  101. invisible.
  102. When you write in text mode, the text cursor is automatically incremented
  103. by the number of characters written. The same is true with the graphics
  104. current pointer, which is instead incremented on a pixel basis.
  105. For example, the following:
  106. \begin{verbatim}
  107. MoveTo(0,0);
  108. LineTo(100,100);
  109. \end{verbatim}
  110. will leave the current pointer to the (100,100) coordinate pair. The
  111. pixels might not be drawn depending on your clipping settings, but the
  112. CP is never clipped to clipping boundaries.
  113. The following routines set the CP to the new position:
  114. \begin{itemize}
  115. \item \textit{ClearDevice}
  116. \item \textit{ClearViewPort}
  117. \item \textit{GraphDefaults}
  118. \item \textit{InitGraph}
  119. \item \textit{LineRel}
  120. \item \textit{LineTo}
  121. \item \textit{MoveRel}
  122. \item \textit{MoveTo}
  123. \item \textit{OutText}
  124. \item \textit{SetGraphMode}
  125. \item \textit{SetViewPort}
  126. \end{itemize}
  127. \subsection{Error handling}
  128. There is only basic error checking in the graph unit. To get the value of
  129. the last error returned by a graphics driver call, call the
  130. \textit{GraphResult} routine. The following routines can set error codes,
  131. others don't :
  132. \begin{itemize}
  133. \item \textit{Bar} --- ok
  134. \item \textit{Bar3D} --- ok
  135. \item \textit{ClearViewPort}
  136. \item \textit{CloseGraph} --- ok
  137. \item \textit{DetectGraph} --- ok
  138. \item \textit{DrawPoly} --- ok
  139. \item \textit{FillPoly} --- ok
  140. \item \textit{FloodFill} --- ok
  141. \item \textit{GetModeName} --- ok
  142. \item \textit{GetRGBPalette} --- ok
  143. \item \textit{InitGraph} --- ok
  144. \item \textit{InstallUserDriver} --- ok
  145. \item \textit{InstallUserFont} --- ok
  146. \item \textit{PieSlice}
  147. \item \textit{RegisterBGIDriver} --- ok
  148. \item \textit{RegisterBGIFont} --- ok
  149. \item \textit{SetAllPalette} --- ok
  150. \item \textit{SetFillPattern} --- ok
  151. \item \textit{SetFillStyle} --- ok
  152. \item \textit{SetGraphBufSize}
  153. \item \textit{SetGraphMode}
  154. \item \textit{SetLineStyle} --- ok
  155. \item \textit{SetPalette} --- ok
  156. \item \textit{SetRGBPalette} --- ok
  157. \item \textit{SetTextJustify} --- ok
  158. \item \textit{SetTextStyle} --- ok
  159. \item \textit{SetViewPort} --- ok
  160. \end{itemize}
  161. \textit{GraphResult} is reset to zero after it has been called. Therefore
  162. the user should store the value returned by this function into a temporary
  163. variable and then use it.
  164. \subsection{Write modes}
  165. Write modes permits combining colors with already existing on-screen colors,
  166. \textit{PutImage} supports several write modes, while most other routines
  167. support only CopyPut/NormalPut and XORPut modes.
  168. The following routines support XORPut write modes (all routines support
  169. CopyPut modes):
  170. \begin{itemize}
  171. \item \textit{FillEllipse}
  172. \item \textit{FillPoly}
  173. \item \textit{Arc} with ThickWidth line styles only
  174. \item \textit{Circle} with ThickWidth line styles only
  175. \item \textit{Line}
  176. \item \textit{LineRel}
  177. \item \textit{LineTo}
  178. \item \textit{Rectangle}
  179. \item \textit{DrawPoly}
  180. \end{itemize}
  181. \subsection{Text}
  182. An internal bitmap font is included with this implementation of the graph
  183. unit. It also possible to load and use standard Borland CHR external
  184. vectorized font files. A bitmapped font is defined in this case by
  185. a matrix of 8x8 pixels. A vector font (also referred to as a stroked font)
  186. is defined by a series of vectors that tell the graphics system how to draw
  187. the font.
  188. \subsection{Clipping and Viewports}
  189. \textit{SetViewPort} makes all output commands operate in a rectangular
  190. region of the screen. Most output routines are viewport relative until
  191. the viewport is changed. If clipping is active, all graphics is output
  192. is clipped to the current region.
  193. There is always clipping to the screen boundaries, whatever the clipping
  194. setting is.
  195. \subsection{Internals}
  196. To make porting to a new platform easier, some of the graph unit routines
  197. have been designed using procedural variables. Some of the routines have
  198. default hooks, while others must absolutely be implemented for every new
  199. platform to make the graph unit work.
  200. The following routines must be created for every new platform supported:
  201. \begin{itemize}
  202. \item \textit{CloseGraph}
  203. \item \textit{DirectPutPixel}
  204. \item \textit{PutPixel}
  205. \item \textit{GetPixel}
  206. \item \textit{InitMode}
  207. \item \textit{SaveVideoState}
  208. \item \textit{RestoreVideoState}
  209. \item \textit{QueryAdapterInfo}
  210. \item \textit{SetRGBPalette}
  211. \item \textit{GetRGBPalette}
  212. \end{itemize}
  213. The following global variables must be setup for every new platform
  214. supported:
  215. InternalDriverName
  216. \var{InternalDriverName}
  217. This variable should be set to a string describing the platform driver
  218. name. It is returned by the user function GetDriverName. Some examples
  219. of driver names are 'DosGX', 'DirectX', 'QuickDrw','CyberGFX', 'Dive'.
  220. \var{CloseGraph}
  221. The CloseGraph routine is called directly by the user and must
  222. do the necessary cleanup by freeing up all platform specific
  223. memory allocations, and by calling RestoreVideoState.
  224. \var{DirectPutPixel}
  225. This routine is one of the most important callback routines with
  226. PutPixel, it is called by most of the routines in the graph unit. It
  227. is about the same as PutPixel except that the coordinates passed to
  228. it are already in global (screen) coordinates, and that clipping has
  229. already been performed. Note that the current WriteMode has to be taken
  230. into account in this procedure.
  231. \var{InitMode}
  232. This callback routine is called by SetGraphMode to actualliy change to
  233. the correct video mode. (SetGraphMode is called by InitGraph).
  234. \var{SaveVideoState}
  235. This routine is called by InitGraph before changing to the graphics video
  236. mode, it should save the old video mode, save any internal video state
  237. such as the palette entries.
  238. \var{RestoreVideoState}
  239. This routine should be called by CloseGraph, it should restore the video
  240. mode to the one saved in SaveVideoState, and restore all appropriate video
  241. information, so that the video is in the same state as it was when
  242. SaveVideoState was called.
  243. \var{QueryAdapterInfo}
  244. This routine might be called by the user BEFORE we are in graphics
  245. mode. It is called by the initialization code of the graph unit. It
  246. creates a linked list of video capabilities and procedural hooks for
  247. all supported video modes on the platform. Look at the DOS version,
  248. to see how it works. This linked list can be read by the user before a
  249. call to InitGraph to determine which mode to use.
  250. The linked list is composed of mode information, as well to pointers
  251. to the callback routines cited above. Some additional optional hooks
  252. are also possible for those who wish to optimize the speed of the unit.
  253. -------------------------------------------------------------
  254. \begin{function}{GetModeName}
  255. \Declaration
  256. Function GetModeName (ModeNumber : smallint) : String;
  257. \Description
  258. Returns a string with the name of the specified graphics mode. The
  259. return values are in the form, XRes x YRes NAME. This function is
  260. useful for building menus, display status, and so forth.
  261. \Errors
  262. If the specified \var{ModeNumber} is invalid, the function returns an
  263. empty string and sets GraphResult to grInvalidMode.
  264. \SeeAlso
  265. \seef{GetDriverName}, \seep{GetModeRange}, \seep{GetMaxMode}
  266. \end{function}
  267. ------------------------
  268. \begin{procedure}{SetAllPalette}
  269. \Declaration
  270. Procedure SetAllPalette(var Palette: PaletteType) ;
  271. \Description
  272. \var{Palette} is of type PaletteType. The first field in Palette
  273. contains the length of the palette. The next \textit{n} fields of
  274. type \var{RGBRec} contains the Red-Green-Blue components to replace
  275. that specific color with. A value of -1 will not change the previous
  276. entry's value.
  277. Note that valid colors depend on the current graphics mode.
  278. If the number of palette entries to replace is greater then the
  279. number of colors possible on the screen, \var{GraphResult} returns
  280. a value of \var{grError} and no changes to the palette settings will
  281. occur.
  282. Changes to the palette take effect immediately on the screen. Each time
  283. a palette color is changed, that color will be changed to the new color
  284. value.
  285. This routine returns \var{grError} if called in a direct color mode.
  286. \Errors
  287. None.
  288. \SeeAlso
  289. \seep{SetRGBPalette}, \seep{SetPalette}
  290. \end{procedure}
  291. ------------------------
  292. ------------------------
  293. \begin{procedure}{GetDefaultPalette}
  294. \Declaration
  295. Procedure GetDefaultPalette (Var Palette : PaletteType);
  296. \Description
  297. Returns a \var{PaletteType} record containing the default RGB color
  298. values when the graphics mode is initialized. These values are based
  299. on the IBM-PC VGA hardware adapter, but do not change from platform
  300. to platform.
  301. On other platforms the colors may not exactly match those
  302. on the IBM-PC, but the match should be close enough for most uses. This
  303. value is static and does never change.
  304. Even if the modes can support more then 256 color entries, only the
  305. 256 first colors can be considered as having default values. Therefore,
  306. at most this function will return 256 entries. To query all colors over
  307. 256 yourself, use \var{GetRGBPalette} for the entire palette range.
  308. \Errors
  309. None.
  310. \SeeAlso
  311. \seef{GetColor}, \seef{GetBkColor}, \seep{GetRGBPalette}
  312. \end{procedure}
  313. ------------------------
  314. \begin{procedure}{GetPalette}
  315. \Declaration
  316. Procedure GetPalette (Var Palette : PaletteType);
  317. \Description
  318. \var{GetPalette} returns in \var{Palette} the current palette. The palette
  319. is in LSB RGB format.
  320. This routine returns \var{grError} if called in a direct color mode.
  321. \Errors
  322. None.
  323. \SeeAlso
  324. \seef{GetPaletteSize}, \seep{SetPalette}
  325. \end{procedure}
  326. ---------------------------
  327. ---------------------------
  328. \begin{function}{GetBkColor}
  329. \Declaration
  330. Function GetBkColor : Word;
  331. \Description
  332. \var{GetBkColor} returns the current background color. If in non direct color
  333. mode, this returns the palette entry, otherwise it returns the direct
  334. RGB value of the current drawing color.
  335. \Errors
  336. None.
  337. \SeeAlso
  338. \seef{GetColor},\seep{SetBkColor}
  339. \end{function}
  340. ---------------------------
  341. \begin{function}{GetColor}
  342. \Declaration
  343. Function GetColor : Word;
  344. \Description
  345. \var{GetColor} returns the current drawing color. If in non direct color
  346. mode, this returns the palette entry, otherwise it returns the direct
  347. RGB value of the current drawing color.
  348. \Errors
  349. None.
  350. \SeeAlso
  351. \seef{GetColor},\seep{SetBkColor}
  352. \end{function}
  353. ---------------------------
  354. \begin{procedure}{GetRGBPalette}
  355. \Declaration
  356. Procedure GetRGBPalette (ColorNum: intege; var Red,Green,Blue : smallint);
  357. \Description
  358. \var{GetRGBPalette} gets the \var{ColorNum}-th entry in the palette.
  359. The Red , Green and Blue values returned arein LSB format.
  360. If the palette entry could not be read for a reason,
  361. the routine returns \var{grError}.
  362. This routine returns \var{grError} if called in a direct color mode.
  363. \Errors
  364. None.
  365. \SeeAlso
  366. \seep{SetAllPallette},
  367. \seep{SetPalette}
  368. \seep{SetRGBPalette}
  369. \end{procedure}
  370. ----------------------------
  371. ----------------------------
  372. \begin{procedure}{SetDirectVideo}
  373. \Declaration
  374. Procedure SetDirectVideo (DirectAccess : boolean);
  375. \Description
  376. Determines how the video access should be done, if DirectAccess
  377. is set to TRUE then access will be done directly to video memory, if
  378. it is supported, otherwise Operating systems calls will be done to
  379. access the video memory.
  380. The behaviour of this routine depends on the platform, and is required
  381. for example to use the graph unit under older multitaskers such as
  382. Desqview (DOS platform). Certain modes re simply not supported
  383. via Operating system calls, while others are only supported by the
  384. operating system. In those cases this routine is simply ignored.
  385. Using operating system calls to plot pixels is much slower then using
  386. the direct mode, but it provides more compatibility.
  387. \textbf{Platform specific}
  388. Windows NT, OS/2, Windows '9x, Windows 3.x, Linux DOSEMU support
  389. all \textit{standard} video DOS modes, even in DirectVideo mode.
  390. Others, like Desqview, Topview, DoubleDOS and MultiDOS might not.
  391. In that case, \vaR{SetDirectVideo} should be called and set to FALSE.
  392. VESA modes are not considered as standard DOS video modes,
  393. and should simply not be used under such multitaskers/emulators.
  394. Mode-X is not considered a standard DOS mode, but is supported in
  395. most modern operating systems, since it uses only standard VGA
  396. I/O ports and memory. (Exception: older multitaskers such as Desqview).
  397. NOT IMPLEMENTED YET.
  398. \Errors
  399. None.
  400. \SeeAlso
  401. \seef{GetDirectVideo}
  402. \end{procedure}
  403. ----------------------------
  404. \begin{function}{GetDirectVideo}
  405. \Declaration
  406. Function GetDirectVideo : boolean;
  407. \Description
  408. Returns the state of the of DirectAccess flag. If this value returns
  409. TRUE, then in the case where it is possible, the video memory is directly
  410. accessed to plot graphics points, otherwise operating system calls
  411. are used.
  412. \Errors
  413. None.
  414. \SeeAlso
  415. \seep{SetDirectVideo}
  416. \end{procedure}
  417. ----------------------------
  418. \section{Reference}
  419. \section{Constants, Types and Variables}
  420. \subsection{Types}
  421. \begin{verbatim}
  422. ArcCoordsType = record
  423. X,Y,Xstart,Ystart,Xend,Yend : smallint;
  424. end;
  425. FillPatternType = Array [1..8] of Byte;
  426. FillSettingsType = Record
  427. Pattern,Color : Word
  428. end;
  429. LineSettingsType = Record
  430. LineStyle,Pattern, Width : Word;
  431. end;
  432. PointType = Record
  433. X,Y : smallint;
  434. end;
  435. TextSettingsType = Record
  436. Font,Direction, CharSize, Horiz, Vert : Word
  437. end;
  438. ViewPortType = Record
  439. X1,Y1,X2,Y2 : smallint;
  440. Clip : Boolean
  441. end;
  442. \end{verbatim}
  443. \begin{verbatim}
  444. PaletteType = Record
  445. Size : longint;
  446. Colors : array[0..MaxColors] of RGBRec;
  447. end;
  448. \end{verbatim}
  449. This record is used by \textit{SetAllPalette} , \textit{GetPalette} and
  450. \textit{GetDefaultPalette}. \textit{Size} indicated the number of RGB
  451. entries in this record, followed by the RGB records for each color. It
  452. is to note, that contrary to Turbo Pascal, the RGB components are in
  453. the LSB's of the RGB component records. This makes easier compatibility
  454. across different hardware platforms.
  455. \section{Functions and procedures}
  456. \begin{procedure}{Arc}
  457. \Declaration
  458. Procedure Arc (X,Y : smallint; stAngle,Endangle, radius : Word);
  459. \Description
  460. \var{Arc} draws part of a circle with center at \var{(X,Y)}, radius
  461. \var{radius}, starting from angle \var{stAngle}, stopping at angle \var{EndAngle}.
  462. These angles are measured counterclockwise. Information about the last call
  463. to \var{Arc} can be retrieved by \var{GetArcCoords}.
  464. \Errors
  465. None.
  466. \SeeAlso
  467. \seep{Circle},\seep{Ellipse}
  468. \seep{GetArcCoords},\seep{PieSlice}, \seep{Sector}
  469. \end{procedure}
  470. \begin{procedure}{Bar}
  471. \Declaration
  472. Procedure Bar (X1,Y1,X2,Y2 : smallint);
  473. \Description
  474. Draws a rectangle with corners at \var{(X1,Y1)} and \var{(X2,Y2)}
  475. and fills it with the current color and fill-style.
  476. \Errors
  477. None.
  478. \SeeAlso
  479. \seep{Bar3D},
  480. \seep{Rectangle}
  481. \end{procedure}
  482. \begin{procedure}{Bar3D}
  483. \Declaration
  484. Procedure Bar3D (X1,Y1,X2,Y2 : smallint; depth : Word; Top : Boolean);
  485. \Description
  486. Draws a 3-dimensional Bar with corners at \var{(X1,Y1)} and \var{(X2,Y2)}
  487. and fills it with the current color and fill-style.
  488. \var{Depth} specifies the number of pixels used to show the depth of the
  489. bar.
  490. If \var{Top} is true; then a 3-dimensional top is drawn.
  491. \Errors
  492. None.
  493. \SeeAlso
  494. \seep{Bar}, \seep{Rectangle}
  495. \end{procedure}
  496. \begin{procedure}{Circle}
  497. \Declaration
  498. Procedure Circle (X,Y : smallint; Radius : Word);
  499. \Description
  500. \var{Circle} draws part of a circle with center at \var{(X,Y)}, radius
  501. \var{radius} in the current color. Each graphics driver contains an
  502. aspect ratio used by \var{Circle}, \var{Arc} and \var{PieSlice}.
  503. \Errors
  504. None.
  505. \SeeAlso
  506. \seep{Ellipse},\seep{Arc}
  507. \seep{GetArcCoords},\seep{PieSlice}, \seep{Sector}
  508. \end{procedure}
  509. \begin{procedure}{ClearDevice}
  510. \Declaration
  511. Procedure ClearDevice ;
  512. \Description
  513. Clears the graphical screen (with the current
  514. background color), and sets the pointer at \var{(0,0)}
  515. \Errors
  516. None.
  517. \SeeAlso
  518. \seep{ClearViewPort}, \seep{SetBkColor}
  519. \end{procedure}
  520. \begin{procedure}{ClearViewPort}
  521. \Declaration
  522. Procedure ClearViewPort ;
  523. \Description
  524. Clears the current viewport. The current background color is used as filling
  525. color. The pointer is set at \var{(0,0)}
  526. \Errors
  527. None.
  528. \SeeAlso
  529. \seep{ClearDevice},\seep{SetViewPort}, \seep{SetBkColor}
  530. \end{procedure}
  531. \begin{procedure}{CloseGraph}
  532. \Declaration
  533. Procedure CloseGraph ;
  534. \Description
  535. Closes the graphical system, restores the
  536. screen mode which was active before the graphical mode was
  537. activated and frees up any memory allocated in InitGraph.
  538. \Errors
  539. None.
  540. \SeeAlso
  541. \seep{InitGraph}
  542. \end{procedure}
  543. \begin{procedure}{DetectGraph}
  544. \Declaration
  545. Procedure DetectGraph (Var Driver, Modus : smallint);
  546. \Description
  547. Checks the hardware in the PC and determines the driver and screen-modus to
  548. be used. These are returned in \var{Driver} and \var{Modus}, and can be fed
  549. to \var{InitGraph}.
  550. See the \var{InitGraph} for a list of drivers and modi.
  551. \Errors
  552. None.
  553. \SeeAlso
  554. \seep{InitGraph}
  555. \end{procedure}
  556. \begin{procedure}{DrawPoly}
  557. \Declaration
  558. Procedure DrawPoly (NumPoints : Word; Var PolyPoints);
  559. \Description
  560. Draws a polygon with \var{NumPoints} corner points, using the
  561. current color and linestyle. PolyPoints is an array of type \var{PointType}.
  562. If there are less the two points in \var{PolyPoints}, this routine
  563. returns \var{grError}.
  564. \Errors
  565. None.
  566. \SeeAlso
  567. \seep{Bar}, seep{Bar3D}, \seep{Rectangle}
  568. \end{procedure}
  569. \begin{procedure}{Ellipse}
  570. \Declaration
  571. Procedure Ellipse (X,Y : smallint; StAngle,EndAngle,XRadius,YRadius : Word);
  572. \Description
  573. \var{Ellipse} draws part of an ellipse with center at \var{(X,Y)}.
  574. \var{XRadius} and \var{Yradius} are the horizontal and vertical radii of the
  575. ellipse. \var{StAngle} and \var{EndAngle} are the starting and stopping angles of
  576. the part of the ellipse. They are measured counterclockwise from the X-axis.
  577. Information about the last call to \var{Ellipse} can be retrieved by
  578. \var{GetArcCoords}.
  579. \Errors
  580. None.
  581. \SeeAlso
  582. \seep{Arc} \seep{Circle}, \seep{FillEllipse}
  583. \end{procedure}
  584. \begin{procedure}{FillEllipse}
  585. \Declaration
  586. Procedure FillEllipse (X,Y : smallint; Xradius,YRadius: Word);
  587. \Description
  588. \var{Ellipse} draws an ellipse with center at \var{(X,Y)}.
  589. \var{XRadius} and \var{Yradius} are the horizontal and vertical radii of the
  590. ellipse. The ellipse is filled with the current color and fill style.
  591. \Errors
  592. None.
  593. \SeeAlso
  594. \seep{Arc} \seep{Circle},
  595. \seep{GetArcCoords},\seep{PieSlice}, \seep{Sector}
  596. \end{procedure}
  597. \begin{procedure}{FillPoly}
  598. \Declaration
  599. Procedure FillPoly (NumberPoints : Word; Var PolyPoints);
  600. \Description
  601. Draws a polygon with \var{NumPoints} corner points and fills it
  602. using the current color and fill style. The outline of the polygon
  603. is drawn in the current line style and color as set by \var{SetLineStyle}.
  604. PolyPoints is an array of type \var{PointType}.
  605. \Errors
  606. None.
  607. \SeeAlso
  608. \seep{Bar}, seep{Bar3D}, \seep{Rectangle}
  609. \end{procedure}
  610. \begin{procedure}{FloodFill}
  611. \Declaration
  612. Procedure FloodFill (X,Y : smallint; BorderColor : Word);
  613. \Description
  614. Fills the area containing the point \var{(X,Y)}, bounded by the color
  615. \var{BorderColor}. The flooding is done using the current fill style
  616. and fill color, as set by \var{SetFillStyle} or \var{SetFillPattern}.
  617. This routine is here for compatibility only, \var{FillPoly} should be
  618. used instead, since it is much faster.
  619. \Errors
  620. None
  621. \SeeAlso
  622. \seep{FillPoly},
  623. \end{procedure}
  624. \begin{procedure}{GetArcCoords}
  625. \Declaration
  626. Procedure GetArcCoords (Var ArcCoords : ArcCoordsType);
  627. \Description
  628. \var{GetArcCoords} returns the coordinates of the last \var{Arc} or
  629. \var{Ellipse} call. The values are useful for connecting a line to
  630. the end of an ellipse.
  631. \Errors
  632. None.
  633. \SeeAlso
  634. \seep{Arc}, \seep{Ellipse}
  635. \end{procedure}
  636. \begin{procedure}{GetAspectRatio}
  637. \Declaration
  638. Procedure GetAspectRatio (Var Xasp,Yasp : Word);
  639. \Description
  640. \var{GetAspectRatio} determines the effective resolution of the screen. The aspect ration can
  641. the be calculated as \var{Xasp/Yasp}.
  642. Each graphics driver uses this aspect ratio to make circles and any circular
  643. shape look round on the screen.
  644. \Errors
  645. None.
  646. \SeeAlso
  647. \seep{InitGraph},\seep{SetAspectRatio}
  648. \end{procedure}
  649. \begin{function}{GetDriverName}
  650. \Declaration
  651. Function GetDriverName : String;
  652. \Description
  653. \var{GetDriverName} returns a string containing the name of the
  654. current driver. This name can be anything under FPC, but it is
  655. usually indicative of the API and/or platform used to perform the
  656. graphics call.
  657. \Errors
  658. None.
  659. \SeeAlso
  660. \seef{GetModeName}, \seep{InitGraph}
  661. \end{function}
  662. \begin{procedure}{GetFillPattern}
  663. \Declaration
  664. Procedure GetFillPattern (Var FillPattern : FillPatternType);
  665. \Description
  666. \var{GetFillPattern} returns an array with the current fill pattern in \var{FillPattern}.
  667. If no user call has been made to \var{SetFillPattern}, the pattern will be
  668. filled with \var{$FF}.
  669. It is to note that the user fill pattern is reset to \var{$FF} each time
  670. \var{GraphDefaults} is called.
  671. \Errors
  672. None
  673. \SeeAlso
  674. \seep{SetFillPattern}, \seep{GraphDefaults}
  675. \end{procedure}
  676. \begin{procedure}{GetFillSettings}
  677. \Declaration
  678. Procedure GetFillSettings (Var FillInfo : FillSettingsType);
  679. \Description
  680. \var{GetFillSettings} returns the current fill-settings in
  681. \var{FillInfo}
  682. \Errors
  683. None.
  684. \SeeAlso
  685. \seep{SetFillPattern}
  686. \end{procedure}
  687. \begin{function}{GetGraphMode}
  688. \Declaration
  689. Function GetGraphMode : smallint;
  690. \Description
  691. \var{GetGraphMode} returns the current graphical mode. This value is
  692. entirely dependant on the hardware platform. To look up what this
  693. mode number represents from a capabilities standpoint, you should
  694. call either \var{QueryAdapterInfo} or \var{GetModeName} with the
  695. value returned by this function.
  696. \Errors
  697. None.
  698. \SeeAlso
  699. \seep{InitGraph}, \seep{QueryAdapterInfo}, \seep{GetModeName}
  700. \end{function}
  701. \begin{procedure}{GetImage}
  702. \Declaration
  703. Procedure GetImage (X1,Y1,X2,Y2 : smallint, Var Bitmap);
  704. \Description
  705. \var{GetImage}
  706. Places a copy of the screen area \var{(X1,Y1)} to \var{X2,Y2} in \var{BitMap}.
  707. \var{Bitmap} is an untyped parameter that must be equal to 12 plus the size
  708. of the screen area to save. The first two longints of \var{Bitmap} store
  709. the width and height of the region. The third longint is reserved and should
  710. not be modified.
  711. To make access to the screen faster, it is recommended that the starting
  712. points and ending point coordinates be modulo 4 and that the width to
  713. save be also modulo 4.
  714. To get the size of the bitmap required to save the area, you should call
  715. \var{ImageSize}.
  716. \Errors
  717. Bitmap must have enough room to contain the image.
  718. \SeeAlso
  719. \seef{ImageSize},
  720. \seep{PutImage}
  721. \end{procedure}
  722. \begin{procedure}{GetLineSettings}
  723. \Declaration
  724. Procedure GetLineSettings (Var LineInfo : LineSettingsType);
  725. \Description
  726. \var{GetLineSettings} returns the current Line settings in
  727. \var{LineInfo}
  728. \Errors
  729. None.
  730. \SeeAlso
  731. \seep{SetLineStyle}
  732. \end{procedure}
  733. \begin{function}{GetMaxColor}
  734. \Declaration
  735. Function GetMaxColor : Word;
  736. \Description
  737. \var{GetMaxColor} returns the maximum color-number which can
  738. be set with \var{SetColor}. This value is zero based, so a screen
  739. which supports 16 colors, would return 15.
  740. \Errors
  741. None.
  742. \SeeAlso
  743. \seep{SetColor},
  744. \seef{GetPaletteSize}
  745. \end{function}
  746. \begin{function}{GetMaxMode}
  747. \Declaration
  748. Function GetMaxMode : Word;
  749. \Description
  750. \var{GetMaxMode} returns the highest mode for the current driver. Normally
  751. the higher the mode number, the resolution it will be, but this might not
  752. always be the case.
  753. \Errors
  754. None.
  755. \SeeAlso
  756. \seep{InitGraph}
  757. \end{function}
  758. \begin{function}{GetMaxX}
  759. \Declaration
  760. Function GetMaxX : Word;
  761. \Description
  762. \var{GetMaxX} returns the maximum horizontal screen
  763. length (zero based from 0..\var{MaxX}).
  764. \Errors
  765. None.
  766. \SeeAlso
  767. \seef{GetMaxY}
  768. \end{function}
  769. \begin{function}{GetMaxY}
  770. \Declaration
  771. Function GetMaxY : Word;
  772. \Description
  773. \var{GetMaxY} returns the maximum number of screen
  774. lines. (zero based from 0..\var{MaxY}).
  775. \Errors
  776. None.
  777. \SeeAlso
  778. \seef{GetMaxY}
  779. \end{function}
  780. \begin{procedure}{GetModeRange}
  781. \Declaration
  782. Procedure GetModeRange (GraphDriver : smallint; var LoMode, HiMode: smallint);
  783. \Description
  784. \var{GetModeRange} returns the Lowest and Highest mode of the currently
  785. installed driver. If the value of \var{GraphDriver} is invalid, \var{LoMode}
  786. and var{HiMode} are set to -1.
  787. \Errors
  788. None.
  789. \SeeAlso
  790. \seep{InitGraph}, \seep{GetModeName}
  791. \end{procedure}
  792. \begin{function}{GetPaletteSize}
  793. \Declaration
  794. Function GetPaletteSize : Word;
  795. \Description
  796. \var{GetPaletteSize} returns the maximum number of entries which
  797. can be set in the current palette. In direct color mode, this simply
  798. returns the maximum possible of colors on screen.
  799. Usually this has the value \var{GetMaxColor} + 1.
  800. \Errors
  801. None.
  802. \SeeAlso
  803. \seep{GetPalette},
  804. \seep{SetPalette}
  805. \seep{GetMaxColor}
  806. \end{function}
  807. \begin{function}{GetPixel}
  808. \Declaration
  809. Function GetPixel (X,Y : smallint) : Word;
  810. \Description
  811. \var{GetPixel} returns the color
  812. of the point at \var{(X,Y)} The coordinates, as all coordinates
  813. are viewport relative.
  814. In direct color mode, the value returned is the direct RGB components of
  815. the color. In palette based modes, this indicates the palette entry number.
  816. \Errors
  817. None.
  818. \SeeAlso
  819. \end{function}
  820. \begin{procedure}{GetTextSettings}
  821. \Declaration
  822. Procedure GetTextSettings (Var TextInfo : TextSettingsType);
  823. \Description
  824. \var{GetTextSettings} returns the current text style settings : The font,
  825. direction, size and placement as set with \var{SetTextStyle} and
  826. \var{SetTextJustify}.
  827. \Errors
  828. None.
  829. \SeeAlso
  830. \seep{SetTextStyle}, \seep{SetTextJustify}
  831. \end{procedure}
  832. \begin{procedure}{GetViewSettings}
  833. \Declaration
  834. Procedure GetViewSettings (Var ViewPort : ViewPortType);
  835. \Description
  836. \var{GetViewSettings} returns the current view-port and clipping settings in
  837. \var{ViewPort}.
  838. \Errors
  839. None.
  840. \SeeAlso
  841. \seep{SetViewPort}
  842. \end{procedure}
  843. \begin{function}{GetX}
  844. \Declaration
  845. Function GetX : smallint;
  846. \Description
  847. \var{GetX} returns the X-coordinate of the current pointer. This value is
  848. viewport relative.
  849. \Errors
  850. None.
  851. \SeeAlso
  852. \seef{GetY}
  853. \end{function}
  854. \begin{function}{GetY}
  855. \Declaration
  856. Function GetY : smallint;
  857. \Description
  858. \var{GetY} returns the Y-coordinate of the current pointer. This value is
  859. viewport relative.
  860. \Errors
  861. None.
  862. \SeeAlso
  863. \seef{GetX}
  864. \end{function}
  865. \begin{procedure}{GraphDefaults}
  866. \Declaration
  867. Procedure GraphDefaults ;
  868. \Description
  869. \var{GraphDefaults} homes the current pointer, and resets the graphics
  870. system to the default values for:
  871. \begin{itemize}
  872. \item Active Line style is reset to normal width and filled line.
  873. \item The current fill color is set to the maximum palette color.
  874. \item The current fill style is set to \var{solidfill}.
  875. \item The user fill pattern is reset to \var{$FF}.
  876. \item The current drawing color is set to white.
  877. \item The current background color is reset to black.
  878. \item The viewport is reset to (0,0,\var{GetMaxX},\var{GetMaxY}).
  879. \item Clipping is enabled.
  880. \item The active write mode is set to normalput.
  881. \item Text settings are reset to : default font, \var{HorizDir},
  882. \var{LeftText} and \var{TopText}.
  883. \end{itemize}
  884. This routine is called by \var{SetGraphMode}.
  885. \Errors
  886. None.
  887. \SeeAlso
  888. \seep{SetViewPort}, \seep{SetFillStyle}, \seep{SetColor},
  889. \seep{SetBkColor}, \seep{SetLineStyle}, \seep{SetGraphMode}
  890. \end{procedure}
  891. \begin{function}{GraphErrorMsg}
  892. \Declaration
  893. Function GraphErrorMsg (ErrorCode : smallint) : String;
  894. \Description
  895. \var{GraphErrorMsg}
  896. returns a string describing the error \var{Errorcode}. This string can be
  897. used to let the user know what went wrong.
  898. \Errors
  899. None.
  900. \SeeAlso
  901. \seef{GraphResult}
  902. \end{function}
  903. \begin{function}{GraphResult}
  904. \Declaration
  905. Function GraphResult : smallint;
  906. \Description
  907. \var{GraphResult} returns an error-code for
  908. the last graphical operation. If the returned value is zero, all went well.
  909. A value different from zero means an error has occurred.
  910. Note that \var{GraphResult} is reset to zero after it has been called.
  911. Therefore the value should be saved into a temporary location if you wish
  912. to use it later.
  913. To see which routine might return errors, see the introduction section at
  914. the start of this reference.
  915. \Errors
  916. None.
  917. \SeeAlso
  918. \seef{GraphErrorMsg}
  919. \end{function}
  920. \begin{function}{ImageSize}
  921. \Declaration
  922. Function ImageSize (X1,Y1,X2,Y2 : smallint) : longint;
  923. \Description
  924. \var{ImageSize} returns the number of bytes needed to store the image
  925. by \var{GetImage} in the rectangle defined by \var{(X1,Y1)} and \var{(X2,Y2)}.
  926. The image size includes space for several words. The first three longints
  927. are reserved for use by \var{GetImage}, the first longint containing the
  928. width of the region, the second containing the height, and the third being
  929. reserved,the following words contains the bitmap itself.
  930. \textit{Compatibility:}
  931. The value returned by this function is a 32-bit value,
  932. and not a 16-bit value.
  933. \Errors
  934. None.
  935. \SeeAlso
  936. \seep{GetImage}
  937. \end{function}
  938. \begin{procedure}{InitGraph}
  939. \Declaration
  940. Procedure InitGraph (var GraphDriver,GraphModus : smallint;\\
  941. const PathToDriver : string);
  942. \Description
  943. \var{InitGraph} initializes the \var{graph} package.
  944. \var{GraphDriver} has two valid values: \var{GraphDriver=Detect} which
  945. performs an auto detect and initializes the highest possible mode with the most
  946. colors. This is dependant on the platform, and many of the non-standard
  947. modes amy not be detected automatically. \var{graphMode} is the mode you
  948. wish to use.
  949. \var{PathToDriver} is only needed, if you use the BGI fonts from
  950. Borland, which are fully supported under FPC.
  951. The exact rundown of \var{InitGraph} is as follows: First it calls
  952. \var{QueryAdapterInfo} to get the possible modes supported by the hardware.
  953. It then saves the video state, initalizes some global variables, then if
  954. auto-detection was requested, calls \var{GetModeRange} to get the highest
  955. possible mode available and supported, otherwise it searches if the requested
  956. mode is available in the database. Finally , in either case it calls
  957. \var{SetGraphMode}.
  958. If the requested driver or mode is invalid, this function returns either
  959. \var{grError} or \var{grInvalidMode}.
  960. Before calling this function, you should call QueryAdapterInfo, and
  961. go through the list of supported modes to determine which mode suites
  962. your needs. As stated in the introduction, each graph unit implementation
  963. should support a 320x200 color mode.
  964. \Errors
  965. None.
  966. \SeeAlso
  967. Introduction, (page \pageref{se:Introduction}),
  968. \seep{DetectGraph}, \seep{CloseGraph}, \seef{GraphResult},
  969. \seef{QueryAdapterInfo}
  970. \end{procedure}
  971. Example:
  972. \begin{verbatim}
  973. var
  974. gd,gm : smallint;
  975. PathToDriver : string;
  976. begin
  977. gd:=detect; { highest possible resolution }
  978. gm:=0; { not needed, auto detection }
  979. PathToDriver:='C:\PP\BGI'; { path to BGI fonts,
  980. drivers aren't needed }
  981. InitGraph(gd,gm,PathToDriver);
  982. if GraphResult<>grok then
  983. halt; ..... { whatever you need }
  984. CloseGraph; { restores the old graphics mode }
  985. end.
  986. \end{verbatim}
  987. \begin{function}{InstallUserDriver}
  988. \Declaration
  989. Function InstallUserDriver (DriverPath : String; AutoDetectPtr: Pointer) : smallint;
  990. \Description
  991. This routine is not supported in FPC, it is here only for compatiblity and
  992. always returns \var{grError}.
  993. \Errors
  994. None.
  995. \SeeAlso
  996. \seep{InitGraph}, \seef{InstallUserFont}
  997. \end{function}
  998. \begin{function}{InstallUserFont}
  999. \Declaration
  1000. Function InstallUserFont (FontPath : String) : smallint;
  1001. \Description
  1002. \var{InstallUserFont} adds the font in \var{FontPath} to the list of fonts
  1003. available to the text system. If the maximum number of allocated fonts has
  1004. been reached, this routine sets \var{GraphResult} to \var{grError}.
  1005. \Errors
  1006. None.
  1007. \SeeAlso
  1008. \seep{InitGraph}, \seef{InstallUserDriver}
  1009. \end{function}
  1010. \begin{procedure}{Line}
  1011. \Declaration
  1012. Procedure Line (X1,Y1,X2,Y2 : smallint);
  1013. \Description
  1014. \var{Line} draws a line starting from
  1015. \var{(X1,Y1} to \var{(X2,Y2)}, in the current line style and color.
  1016. The current pointer is not updated after this call.
  1017. This is the base routine which is called by several other routines
  1018. in this unit. This routine is somewhat faster then the other
  1019. LineXXX routines contained herein.
  1020. \Errors
  1021. None.
  1022. \SeeAlso
  1023. \seep{LineRel},\seep{LineTo}
  1024. \end{procedure}
  1025. \begin{procedure}{LineRel}
  1026. \Declaration
  1027. Procedure LineRel (DX,DY : smallint);
  1028. \Description
  1029. \var{LineRel} draws a line starting from
  1030. the current pointer position to the point\var{(DX,DY}, \textbf{relative} to the
  1031. current position, in the current line style and color. The Current Position
  1032. is set to the endpoint of the line.
  1033. \Errors
  1034. None.
  1035. \SeeAlso
  1036. \seep{Line}, \seep{LineTo}
  1037. \end{procedure}
  1038. \begin{procedure}{LineTo}
  1039. \Declaration
  1040. Procedure LineTo (DX,DY : smallint);
  1041. \Description
  1042. \var{LineTo} draws a line starting from
  1043. the current pointer position to the point\var{(DX,DY}, \textbf{relative} to the
  1044. current position, in the current line style and color. The Current position
  1045. is set to the end of the line.
  1046. \Errors
  1047. None.
  1048. \SeeAlso
  1049. \seep{LineRel},\seep{Line}
  1050. \end{procedure}
  1051. \begin{procedure}{MoveRel}
  1052. \Declaration
  1053. Procedure MoveRel (DX,DY : smallint;
  1054. \Description
  1055. \var{MoveRel} moves the current pointer to the
  1056. point \var{(DX,DY)}, relative to the current pointer
  1057. position
  1058. \Errors
  1059. None.
  1060. \SeeAlso
  1061. \seep{MoveTo}
  1062. \end{procedure}
  1063. \begin{procedure}{MoveTo}
  1064. \Declaration
  1065. Procedure MoveTo (X,Y : smallint);
  1066. \Description
  1067. \var{MoveTo} moves the current pointer to the
  1068. point \var{(X,Y)}.
  1069. \Errors
  1070. None.
  1071. \SeeAlso
  1072. \seep{MoveRel}
  1073. \end{procedure}
  1074. \begin{procedure}{OutText}
  1075. \Declaration
  1076. Procedure OutText (Const TextString : String);
  1077. \Description
  1078. \var{OutText} puts \var{TextString} on the screen, at the current pointer
  1079. position, using the current font and text settings. The current pointer is
  1080. updated only if the text justification is set to left and is horizontal.
  1081. The text is truncated according to the current viewport settings if it
  1082. cannot fit.
  1083. In order to maintain compatibility when using several fonts, use \var{TextWidth}
  1084. and \var{TextHeight} calls to determine the dimensions of the string.
  1085. \Errors
  1086. None.
  1087. \SeeAlso
  1088. \seep{OutTextXY}
  1089. \end{procedure}
  1090. \begin{procedure}{OutTextXY}
  1091. \Declaration
  1092. Procedure OutTextXY (X,Y : smallint; Const TextString : String);
  1093. \Description
  1094. \var{OutText} puts \var{TextString} on the screen, at position \var{(X,Y)},
  1095. using the current font and text settings.
  1096. Contrary to \var{OutText} , this routine does not update the current pointer.
  1097. In order to maintain compatibility when using several fonts, use \var{TextWidth}
  1098. and \var{TextHeight} calls to determine the dimensions of the string.
  1099. \Errors
  1100. None.
  1101. \SeeAlso
  1102. \seep{OutText}
  1103. \end{procedure}
  1104. \begin{procedure}{PieSlice}
  1105. \Declaration
  1106. Procedure PieSlice (X,Y,stangle,endAngle:smallint;Radius: Word);
  1107. \Description
  1108. \var{PieSlice}
  1109. draws and fills a sector of a circle with center \var{(X,Y)} and radius
  1110. \var{Radius}, starting at angle \var{StAngle} and ending at angle \var{EndAngle}
  1111. using the current fill style and fill pattern. The pie slice is outlined
  1112. with the current line style and current active color.
  1113. \Errors
  1114. None.
  1115. \SeeAlso
  1116. \seep{Arc}, \seep{Circle}, \seep{Sector}
  1117. \end{procedure}
  1118. \begin{procedure}{PutImage}
  1119. \Declaration
  1120. Procedure PutImage (X,Y: smallint; var Bitmap; BitBlt: Word);
  1121. \Description
  1122. \var{PutImage}
  1123. Places the bitmap in \var{Bitmap} on the screen at upper left
  1124. corner \var{(X, Y)}. \var{BitBlt} determines how the bitmap
  1125. will be placed on the screen. Possible values are :
  1126. \begin{itemize}
  1127. \item CopyPut
  1128. \item XORPut
  1129. \item ORPut
  1130. \item AndPut
  1131. \item NotPut
  1132. \end{itemize}
  1133. \textit{Compatibility}
  1134. Contrary to the Borland graph unit, putimage \textit{is} clipped to the
  1135. viewport boundaries.
  1136. \Errors
  1137. None
  1138. \SeeAlso
  1139. \seef{ImageSize},\seep{GetImage}
  1140. \end{procedure}
  1141. \begin{procedure}{PutPixel}
  1142. \Declaration
  1143. Procedure PutPixel (X,Y : smallint; Color : Word);
  1144. \Description
  1145. Puts a point at
  1146. \var{(X,Y)} using color \var{Color}. This routine is viewport
  1147. relative.
  1148. \Errors
  1149. None.
  1150. \SeeAlso
  1151. \seef{GetPixel}
  1152. \end{procedure}
  1153. \begin{procedure}{Rectangle}
  1154. \Declaration
  1155. Procedure Rectangle (X1,Y1,X2,Y2 : smallint);
  1156. \Description
  1157. Draws a rectangle with
  1158. corners at \var{(X1,Y1)} and \var{(X2,Y2)}, using the current color and
  1159. the current line style.
  1160. \Errors
  1161. None.
  1162. \SeeAlso
  1163. \seep{Bar}, \seep{Bar3D}
  1164. \end{procedure}
  1165. \begin{function}{RegisterBGIDriver}
  1166. \Declaration
  1167. Function RegisterBGIDriver (Driver : Pointer) : smallint;
  1168. \Description
  1169. This routine is not supported in FPC. It is here for compatibility and it
  1170. always returns \var{grError}.
  1171. \Errors
  1172. None.
  1173. \SeeAlso
  1174. \seef{InstallUserDriver},
  1175. \seef{RegisterBGIFont}
  1176. \end{function}
  1177. \begin{function}{RegisterBGIFont}
  1178. \Declaration
  1179. Function RegisterBGIFont (Font : Pointer) : smallint;
  1180. \Description
  1181. This routine permits the user to add a font to the list of known fonts
  1182. by the graph unit. \var{Font} is a pointer to image of the loaded font.
  1183. The value returned is either a negative error number (\var{grInvalidFont}),
  1184. or the font number you need to use when accessing it via \var{SetTextStyle}.
  1185. This routine may be called before \var{InitGraph}.
  1186. \textit{Compatibility}
  1187. Watch out for the byte endian when using this routine. This might work
  1188. on little endian machines, and not on big endian machines and vice-versa.
  1189. \Errors
  1190. None.
  1191. \SeeAlso
  1192. \seef{InstallUserFont},
  1193. \seef{RegisterBGIDriver}
  1194. \end{function}
  1195. \begin{procedure}{RestoreCRTMode}
  1196. \Declaration
  1197. Procedure RestoreCRTMode ;
  1198. \Description
  1199. Restores the screen mode which was active before
  1200. the graphical mode was started. Can be used to switch back and forth
  1201. between text and graphics mode.
  1202. \Errors
  1203. None.
  1204. \SeeAlso
  1205. \seep{InitGraph}
  1206. \end{procedure}
  1207. Example:
  1208. \begin{verbatim}
  1209. uses Graph;
  1210. var
  1211. Gd, Gm: smallint;
  1212. Mode: smallint;
  1213. begin
  1214. Gd := Detect;
  1215. InitGraph(Gd, Gm, ' ');
  1216. if GraphResult <> grOk then
  1217. Halt(1);
  1218. OutText('<ENTER> to leave graphics:');
  1219. Readln;
  1220. RestoreCrtMode;
  1221. Writeln('Now in text mode');
  1222. Write('<ENTER> to enter graphics mode:');
  1223. Readln;
  1224. SetGraphMode(GetGraphMode);
  1225. OutTextXY(0, 0, 'Back in graphics mode');
  1226. OutTextXY(0, TextHeight('H'), '<ENTER> to quit:');
  1227. Readln;
  1228. CloseGraph;
  1229. end.
  1230. \end{verbatim}
  1231. \begin{procedure}{Sector}
  1232. \Declaration
  1233. Procedure Sector (X,Y : smallint; StAngle,EndAngle,XRadius,YRadius : Word);
  1234. \Description
  1235. \var{Sector}
  1236. draws and fills a sector of an ellipse with center \var{(X,Y)} and radii
  1237. \var{XRadius} and \var{YRadius}, starting at angle \var{StAngle} and ending at angle
  1238. \var{EndAngle}. The sector is outlined in the current color and filled with
  1239. the pattern and color defined by \var{SetFillStyle} or \var{SetFillPattern}.
  1240. \Errors
  1241. None.
  1242. \SeeAlso
  1243. \seep{Arc}, \seep{Circle}, \seep{PieSlice}
  1244. \end{procedure}
  1245. \begin{procedure}{SetActivePage}
  1246. \Declaration
  1247. Procedure SetActivePage (Page : Word);
  1248. \Description
  1249. Sets \var{Page} as the active page
  1250. for all graphical output. This means that all drawing will be done on this
  1251. graphics, be it visible or not.
  1252. The usual way to make fast animation, is to draw to a non visible active page
  1253. and the simply call make that active page the visible page by calling
  1254. \var{SetVisualPage}.
  1255. \textit{Compatibility}:
  1256. Not all systems and graphics mode support multiple graphics pages, to
  1257. determine how many pages are available see \var{QueryAdapterInfo}.
  1258. Multiple pages are currently not supported with DOS VESA modes.
  1259. \Errors
  1260. None.
  1261. \SeeAlso
  1262. \seep{SetVisualPage}, \seep{QueryAdapterInfo}
  1263. \end{procedure}
  1264. \begin{procedure}{SetAllPallette}
  1265. \Declaration
  1266. Procedure SetAllPallette (Var Palette);
  1267. \Description
  1268. Sets the current palette to
  1269. \var{Palette}. \var{Palette} is an untyped variable, usually pointing to a
  1270. record of type \var{PaletteType} which contains the Red, Green and Blue
  1271. components of the RGB components to change for each color entry. If
  1272. the Red, Green and Blue components are equal to -1 for a specific color
  1273. entry, then that palette entry will not be changed. The size should
  1274. contain the size of the palette to change (indexed at zero).
  1275. \textit{Compatibility}:
  1276. This call is not the same as in Turbo Pascal. RGB components should be
  1277. set in LSB if each of the components has less then 16-bits resolution.
  1278. This call is not supported in direct color modes.
  1279. \Errors
  1280. None.
  1281. \SeeAlso
  1282. \seep{GetPalette}
  1283. \end{procedure}
  1284. \begin{procedure}{SetAspectRatio}
  1285. \Declaration
  1286. Procedure SetAspectRatio (Xasp,Yasp : Word);
  1287. \Description
  1288. Sets the aspect ratio of the
  1289. current screen to \var{Xasp/Yasp}. The value of the aspect ratio is used
  1290. by certain routines herein to draw circles which will actually appear round
  1291. depending on the screen mode.
  1292. \Errors
  1293. None
  1294. \SeeAlso
  1295. \seep{InitGraph}, \seep{GetAspectRatio}
  1296. \end{procedure}
  1297. \begin{procedure}{SetBkColor}
  1298. \Declaration
  1299. Procedure SetBkColor (Color : Word);
  1300. \Description
  1301. Sets the background color to
  1302. \var{Color}.
  1303. The behaviour of this routine depends if we are in a direct color
  1304. mode or not. In direct color mode, this value represents the direct
  1305. RGB values to plot to the screen. In non direct color mode, the value
  1306. represents an index to the color palette entry on the hardware.
  1307. \Errors
  1308. None.
  1309. \SeeAlso
  1310. \seef{GetBkColor}, \seep{SetColor}
  1311. \end{procedure}
  1312. \begin{procedure}{SetColor}
  1313. \Declaration
  1314. Procedure SetColor (Color : Word);
  1315. \Description
  1316. Sets the foreground color to
  1317. \var{Color}.
  1318. The behaviour of this routine depends if we are in a direct color
  1319. mode or not. In direct color mode, this value represents the direct
  1320. RGB values to plot to the screen. In non direct color mode, the value
  1321. represents an index to the color palette entry on the hardware.
  1322. \Errors
  1323. None.
  1324. \SeeAlso
  1325. \seef{GetColor}, \seep{SetBkColor}
  1326. \end{procedure}
  1327. \begin{procedure}{SetFillPattern}
  1328. \Declaration
  1329. Procedure SetFillPattern (Pattern : FillPatternType, Color : Word);
  1330. \Description
  1331. \var{SetFillPattern} sets the current fill-pattern to \var{Pattern}, and
  1332. the filling color to \var{Color}. If invalid input is passed to
  1333. \var{SetFillPattern}, \var{GraphResult} will return \var{grError}.
  1334. The pattern is an 8x8 raster, corresponding to the 64 bits in
  1335. \var{FillPattern}. Whenever a bit in a pattern byte is valued at 1,
  1336. a pixel will be plotted. The pattern and color is used by \var{Bar},
  1337. \var{FillPoly}, \var{FloodFill}, \var{bar3d}, \var{FillEllipse},
  1338. \var{Sector}, and \var{PieSlice}.
  1339. \Errors
  1340. None
  1341. \SeeAlso
  1342. \seep{GetFillPattern}, \seep{SetFillStyle}
  1343. \end{procedure}
  1344. \begin{procedure}{SetFillStyle}
  1345. \Declaration
  1346. Procedure SetFillStyle (Pattern, Color : word);
  1347. \Description
  1348. \var{SetFillStyle} sets the filling pattern and color to one of the
  1349. predefined filling patterns. \var{Pattern} can be one of the following predefined
  1350. constants :
  1351. \begin{itemize}
  1352. \item \var{EmptyFill } Uses backgroundcolor.
  1353. \item \var{SolidFill } Uses filling color
  1354. \item \var{LineFill } Fills with horizontal lines.
  1355. \item \var{ltSlashFill} Fills with lines from left-under to top-right.
  1356. \item \var{SlashFill } Idem as previous, thick lines.
  1357. \item \var{BkSlashFill} Fills with thick lines from left-Top to bottom-right.
  1358. \item \var{LtBkSlashFill} Idem as previous, normal lines.
  1359. \item \var{HatchFill} Fills with a hatch-like pattern.
  1360. \item \var{XHatchFill} Fills with a hatch pattern, rotated 45 degrees.
  1361. \item \var{InterLeaveFill}
  1362. \item \var{WideDotFill} Fills with dots, wide spacing.
  1363. \item \var{CloseDotFill} Fills with dots, narrow spacing.
  1364. \item \var{UserFill} Fills with a user-defined pattern.
  1365. \end{itemize}
  1366. If invalid input is passed to \var{SetFillStyle},
  1367. \var{GraphResult} will return \var{grError}.
  1368. \Errors
  1369. None.
  1370. \SeeAlso
  1371. \seep{SetFillPattern}
  1372. \end{procedure}
  1373. \begin{procedure}{SetGraphBufSize}
  1374. \Declaration
  1375. Procedure SetGraphBufSize (BufSize : Word);
  1376. \Description
  1377. This routine does nothing in FPC, and is here for compatibility.
  1378. \Errors
  1379. None.
  1380. \SeeAlso
  1381. \end{procedure}
  1382. \begin{procedure}{SetGraphMode}
  1383. \Declaration
  1384. Procedure SetGraphMode (Mode : smallint);
  1385. \Description
  1386. \var{SetGraphMode} sets the
  1387. graphical mode and clears the screen. \var{Mode} must be a valid mode,
  1388. which can be queried by \var{QueryAdapterInfo}.
  1389. If invalid input is passed to \var{SetGraphMode}, or if the mode cannot
  1390. be set for a reason, \var{GraphResult} returns \var{grInvalidMode}.
  1391. \var{SetGraphMode} resets all graphics variables to their default
  1392. settings (such as if \var{GraphDefaults} was called, the active page
  1393. is reset to page zero, the visual page is reset to page zero, and the viewport
  1394. is set to the entire screen.
  1395. \Errors
  1396. None.
  1397. \SeeAlso
  1398. \seep{InitGraph}, \seep{QueryAdapterInfo}
  1399. \end{procedure}
  1400. \begin{procedure}{SetLineStyle}
  1401. \Declaration
  1402. Procedure SetLineStyle (LineStyle, Pattern, Thickness : Word);
  1403. \Description
  1404. \var{SetLineStyle}
  1405. sets the drawing style for lines. You can specify a \var{LineStyle} which is
  1406. one of the following pre-defined constants:
  1407. \begin{itemize}
  1408. \item \var{Solidln=0;} draws a solid line.
  1409. \item \var{Dottedln=1;} Draws a dotted line.
  1410. \item \var{Centerln=2;} draws a non-broken centered line.
  1411. \item \var{Dashedln=3;} draws a dashed line.
  1412. \item \var{UserBitln=4;} Draws a User-defined bit pattern.
  1413. \end{itemize}
  1414. If \var{UserBitln} is specified then \var{Pattern} contains the bit pattern to
  1415. use for drawing the line. A bit of 1 specified a pixel which is on.
  1416. In all another cases, \var{Pattern} is ignored. The parameter \var{Thickness}
  1417. indicates how thick the line should be. You can specify one of the following
  1418. pre-defined constants:
  1419. \begin{itemize}
  1420. \item \var{NormWidth=1}
  1421. \item \var{ThickWidth=3}
  1422. \end{itemize}
  1423. If invalid input is passed to \var{SetLineStyle} , \var{GraphResult} will
  1424. return \var{grError}.
  1425. \Errors
  1426. None.
  1427. \SeeAlso
  1428. \seep{GetLineSettings}
  1429. \end{procedure}
  1430. \begin{procedure}{SetPalette}
  1431. \Declaration
  1432. Procedure SetPalette (ColorNum : Word; Color : Shortint);
  1433. \Description
  1434. \var{SetPalette} changes the \var{ColorNum}-th entry in the palette to
  1435. \var{Color}. For examples, \var{SetPalette(0, LightCyan)} makes the first
  1436. color in the palette light cyan. \var{Color} only accepts certain default
  1437. colors, as specified in the \var{Color constants} section. If invalid
  1438. input is passed to \var{SetPalette}, \var{GraphResult} returns a value
  1439. of \var{grError} and the palette remains intact.
  1440. Changes made to the palette are immediately visible on the screen.
  1441. This routine returns \var{grError} if called in a direct color mode.
  1442. \Errors
  1443. None.
  1444. \SeeAlso
  1445. \seep{SetAllPallette},\seep{SetRGBPalette}
  1446. \end{procedure}
  1447. \begin{procedure}{SetRGBPalette}
  1448. \Declaration
  1449. Procedure SetRGBPalette (ColorNum,Red,Green,Blue : smallint);
  1450. \Description
  1451. \var{SetRGBPalette} sets the \var{ColorNum}-th entry in the palette to the
  1452. color with RGB values \var{Red, Green Blue}. The Red , Green and Blue values
  1453. must be in LSB format. If the palette entry could not be changed for a
  1454. reason, the routine returns \var{grError}.
  1455. This routine returns \var{grError} if called in a direct color mode.
  1456. \Errors
  1457. None.
  1458. \SeeAlso
  1459. \seep{SetAllPallette},
  1460. \seep{SetPalette}
  1461. \seep{GetRGBPalette}
  1462. \end{procedure}
  1463. \begin{procedure}{SetTextJustify}
  1464. \Declaration
  1465. Procedure SetTextJustify (Horiz, Vert : Word);
  1466. \Description
  1467. \var{SetTextJustify} controls the placement of new text, relative to the
  1468. (graphical) cursor position. \var{Horiz} controls horizontal placement, and can be
  1469. one of the following pre-defined constants:
  1470. \begin{itemize}
  1471. \item \var{LeftText=0;} Text is set left of the current pointer.
  1472. \item \var{CenterText=1;} Text is set centered horizontally on the current pointer.
  1473. \item \var{RightText=2;} Text is set to the right of the current pointer.
  1474. \end{itemize}
  1475. \var{Vertical} controls the vertical placement of the text, relative to the
  1476. (graphical) cursor position. Its value can be one of the following
  1477. pre-defined constants :
  1478. \begin{itemize}
  1479. \item \var{BottomText=0;} Text is placed under the current pointer.
  1480. \item \var{CenterText=1;} Text is placed centered vertically on the current pointer.
  1481. \item \var{TopText=2;}Text is placed above the current pointer.
  1482. \end{itemize}
  1483. If invalid input is passed \var{SetTextJustify} , \var{GraphResult} returns
  1484. \var{grError}.
  1485. \Errors
  1486. None.
  1487. \SeeAlso
  1488. \seep{OutText}, \seep{OutTextXY}
  1489. \end{procedure}
  1490. \begin{procedure}{SetTextStyle}
  1491. \Declaration
  1492. Procedure SetTextStyle (Font,Direction,Magnitude : Word);
  1493. \Description
  1494. \var{SetTextStyle} controls the style of text to be put on the screen.
  1495. pre-defined constants for \var{Font} are:
  1496. \begin{itemize}
  1497. \item \var{DefaultFont=0;}
  1498. \item \var{TriplexFont=2;}
  1499. \item \var{SmallFont=2;}
  1500. \item \var{SansSerifFont=3;}
  1501. \item \var{GothicFont=4;}
  1502. \end{itemize}
  1503. Pre-defined constants for \var{Direction} are :
  1504. \begin{itemize}
  1505. \item \var{HorizDir=0;}
  1506. \item \var{VertDir=1;}
  1507. \end{itemize}
  1508. Charsize indicated the magnification factor to use when drawing the fonts
  1509. to the screen. When using the default internal font, this value can be
  1510. any value equal or greater to one. In the case of stroked fonts, the
  1511. value should always be equal or greater then 4.
  1512. Stroked fonts are usually loaded from disk once onto the heap when a call
  1513. is made to \var{SetTextStyle}.
  1514. If there is an error when using this routine, \var{GraphResult} might return
  1515. \var{grFontNotFound}, \var{grNoFontMem}, \var{grError}, \var{grIoError},
  1516. \var{grInvalidFont}, or \var{grInvalidFontNum}.
  1517. \Errors
  1518. None.
  1519. \SeeAlso
  1520. \seep{GetTextSettings}
  1521. \end{procedure}
  1522. \begin{procedure}{SetUserCharSize}
  1523. \Declaration
  1524. Procedure SetUserCharSize (Xasp1,Xasp2,Yasp1,Yasp2 : Word);
  1525. \Description
  1526. Sets the width and height of vector-fonts. The horizontal size is given
  1527. by \var{Xasp1/Xasp2}, and the vertical size by \var{Yasp1/Yasp2}.
  1528. \Errors
  1529. None.
  1530. \SeeAlso
  1531. \seep{SetTextStyle}
  1532. \end{procedure}
  1533. \begin{procedure}{SetViewPort}
  1534. \Declaration
  1535. Procedure SetViewPort (X1,Y1,X2,Y2 : smallint; Clip : Boolean);
  1536. \Description
  1537. Sets the current graphical view-port (window) to the rectangle defined by
  1538. the top-left corner \var{(X1,Y1)} and the bottom-right corner \var{(X2,Y2)}.
  1539. If \var{Clip} is true, anything drawn outside the view-port (window) will be
  1540. clipped (i.e. not drawn). Coordinates specified after this call are relative
  1541. to the top-left corner of the view-port.
  1542. \Errors
  1543. None.
  1544. \SeeAlso
  1545. \seep{GetViewSettings}
  1546. \end{procedure}
  1547. \begin{procedure}{SetVisualPage}
  1548. \Declaration
  1549. Procedure SetVisualPage (Page : Word);
  1550. \Description
  1551. \var{SetVisualPage} sets the video page to page number \var{Page}.
  1552. \Errors
  1553. None
  1554. \SeeAlso
  1555. \seep{SetActivePage}
  1556. \end{procedure}
  1557. \begin{procedure}{SetWriteMode}
  1558. \Declaration
  1559. Procedure SetWriteMode (Mode : smallint);
  1560. \Description
  1561. \var{SetWriteMode} controls the drawing of lines on the screen. It controls
  1562. the binary operation used when drawing lines on the screen. \var{Mode} can
  1563. be one of the following pre-defined constants:
  1564. \begin{itemize}
  1565. \item CopyPut=0;
  1566. \item XORPut=1;
  1567. \end{itemize}
  1568. If you specify another mode, it is mapped to one of the above acoording to
  1569. the following table (for TP compatibility, may be changed in the future):
  1570. \begin{itemize}
  1571. \item Notput, Orput: CopyPut
  1572. \item AndPut: XorPut
  1573. \end{itemize}
  1574. \Errors
  1575. None.
  1576. \SeeAlso
  1577. \end{procedure}
  1578. \begin{function}{TextHeight}
  1579. \Declaration
  1580. Function TextHeight (S : String) : Word;
  1581. \Description
  1582. \var{TextHeight} returns the height (in pixels) of the string \var{S} in
  1583. the current font and text-size.
  1584. \Errors
  1585. None.
  1586. \SeeAlso
  1587. \seef{TextWidth}
  1588. \end{function}
  1589. \begin{function}{TextWidth}
  1590. \Declaration
  1591. Function TextWidth (S : String) : Word;
  1592. \Description
  1593. \var{TextHeight} returns the width (in pixels) of the string \var{S} in
  1594. the current font and text-size.
  1595. \Errors
  1596. None.
  1597. \SeeAlso
  1598. \seef{TextHeight}
  1599. \end{function}