graph.tex 48 KB

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