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