home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / svgabg52 / vgademo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-09-05  |  48.7 KB  |  1,791 lines

  1. program BGIDemo;
  2. {
  3.  
  4.   Turbo Pascal Borland Graphics Interface (BGI) demonstration
  5.   program. This program shows how to use many features of
  6.   the Graph unit.
  7.  
  8.   Copyright (c) 1985-89 by Borland International, Inc.
  9.  
  10. }
  11.  
  12. uses
  13.   Crt, Dos, Graph;
  14.  
  15.  
  16. const
  17.   { The five fonts available }
  18.   Fonts : array[0..4] of string[13] =
  19.   ('DefaultFont', 'TriplexFont', 'SmallFont', 'SansSerifFont', 'GothicFont');
  20.  
  21.   { The five predefined line styles supported }
  22.   LineStyles : array[0..4] of string[9] =
  23.   ('SolidLn', 'DottedLn', 'CenterLn', 'DashedLn', 'UserBitLn');
  24.  
  25.   { The twelve predefined fill styles supported }
  26.   FillStyles : array[0..11] of string[14] =
  27.   ('EmptyFill', 'SolidFill', 'LineFill', 'LtSlashFill', 'SlashFill',
  28.    'BkSlashFill', 'LtBkSlashFill', 'HatchFill', 'XHatchFill',
  29.    'InterleaveFill', 'WideDotFill', 'CloseDotFill');
  30.  
  31.   { The two text directions available }
  32.   TextDirect : array[0..1] of string[8] = ('HorizDir', 'VertDir');
  33.  
  34.   { The Horizontal text justifications available }
  35.   HorizJust  : array[0..2] of string[10] = ('LeftText', 'CenterText', 'RightText');
  36.  
  37.   { The vertical text justifications available }
  38.   VertJust   : array[0..2] of string[10] = ('BottomText', 'CenterText', 'TopText');
  39.  
  40. var
  41.   GraphDriver : integer;  { The Graphics device driver }
  42.   GraphMode   : integer;  { The Graphics mode value }
  43.   MaxX, MaxY  : word;     { The maximum resolution of the screen }
  44.   ErrorCode   : integer;  { Reports any graphics errors }
  45.   MaxColor    : word;     { The maximum color value available }
  46.   OldExitProc : Pointer;  { Saves exit procedure address }
  47.  
  48. function RealDrawColor(Color : Word) : Word;
  49. begin
  50.   if (GetMaxColor > 32768) then
  51.     SetRgbPalette(1024,(Color SHR 11) AND 31,(Color SHR 5)AND 63,Color AND 31)
  52.   else if (GetMaxColor > 256) then
  53.     SetRgbPalette(1024,(Color SHR 10) AND 31,(Color SHR 5)AND 31,Color AND 31);
  54.   RealDrawColor := Color;
  55. end;
  56.  
  57. function RealFillColor(Color : Word) : Word;
  58. begin
  59.   if (GetMaxColor > 32768) then
  60.     SetRgbPalette(1025,(Color SHR 11) AND 31,(Color SHR 5)AND 63,Color AND 31)
  61.   else if (GetMaxColor > 256) then
  62.     SetRgbPalette(1025,(Color SHR 10) AND 31,(Color SHR 5)AND 31,Color AND 31);
  63.   RealFillColor := Color;
  64. end;
  65.  
  66. function RealColor(Color : Word) : Word;
  67. begin
  68.   if (GetMaxColor > 32768) then
  69.     SetRgbPalette(1026,(Color SHR 11) AND 31,(Color SHR 5)AND 63,Color AND 31)
  70.   else if (GetMaxColor > 256) then
  71.     SetRgbPalette(1026,(Color SHR 10) AND 31,(Color SHR 5)AND 31,Color AND 31);
  72.   RealColor := Color;
  73. end;
  74.  
  75. function WhitePixel : Word;
  76. var Clr : Word;
  77. begin
  78.   if (GetMaxColor > 32768) then
  79.     Clr := 65535
  80.   else if (GetMaxColor > 256) then
  81.     Clr := 32767
  82.   else
  83.     Clr := 15;
  84.   WhitePixel := Clr;
  85. end;
  86.  
  87. function BluePixel : Word;
  88. var Clr : Word;
  89. begin
  90.   if (GetMaxColor > 256) then
  91.     Clr := 31
  92.   else
  93.     Clr := 1;
  94.   BluePixel := Clr;
  95. end;
  96.  
  97. function GreenPixel : Word;
  98. var Clr : Word;
  99. begin
  100.   if (GetMaxColor > 32768) then
  101.     Clr := 63 SHL 5
  102.   else if (GetMaxColor > 256) then
  103.     Clr := 31 SHL 5
  104.   else
  105.     Clr := 2;
  106.   GreenPixel := Clr;
  107. end;
  108.  
  109.  
  110. {$F+}
  111. procedure MyExitProc;
  112. begin
  113.   ExitProc := OldExitProc; { Restore exit procedure address }
  114.   CloseGraph;              { Shut down the graphics system }
  115. end; { MyExitProc }
  116. {$F-}
  117.  
  118. {$F+}
  119. function DetectVGA256 : integer;
  120. { Detects VGA or MCGA video cards }
  121. var
  122.   DetectedDriver : integer;
  123.   SuggestedMode  : integer;
  124. begin
  125.   DetectGraph(DetectedDriver, SuggestedMode);
  126.   if (DetectedDriver = VGA) or (DetectedDriver = MCGA) then
  127.   begin
  128.     Writeln('Which video mode would you like to use?');
  129.     Writeln('  0) 320x200x256');
  130.     Writeln('  1) 640x400x256');
  131.     Writeln('  2) 640x480x256');
  132.     Writeln('  3) 800x600x256');
  133.     Writeln('  4) 1024x768x256');
  134.     Writeln('  5) 640x350x256');
  135.     Writeln('  6) 1280x1024x256');
  136.     Write('> ');
  137.     Readln(SuggestedMode);
  138.     DetectVGA256 := SuggestedMode;
  139.   end
  140.   else
  141.     DetectVGA256 := grError; { Couldn't detect hardware }
  142. end; { DetectVGA256 }
  143. {$F-}
  144.  
  145. {$F+}
  146. function DetectVGA32k : integer;
  147. { Detects VGA or MCGA video cards }
  148. var
  149.   DetectedDriver : integer;
  150.   SuggestedMode  : integer;
  151. begin
  152.   DetectGraph(DetectedDriver, SuggestedMode);
  153.   if (DetectedDriver = VGA) or (DetectedDriver = MCGA) then
  154.   begin
  155.     Writeln('Which video mode would you like to use?');
  156.     Writeln('  0) 320x200x32k');
  157.     Writeln('  1) 640x350x32k');
  158.     Writeln('  2) 640x400x32k');
  159.     Writeln('  3) 640x480x32k');
  160.     Writeln('  4) 800x600x32k');
  161.     Writeln('  5) 1024x768x32k');
  162.     Writeln('  6) 1280x1024x32k');
  163.     Write('> ');
  164.     Readln(SuggestedMode);
  165.     DetectVGA32k := SuggestedMode;
  166.   end
  167.   else
  168.     DetectVGA32k := grError; { Couldn't detect hardware }
  169. end; { DetectVGA32k }
  170. {$F-}
  171.  
  172. {$F+}
  173. function DetectVGA64k : integer;
  174. { Detects VGA or MCGA video cards }
  175. var
  176.   DetectedDriver : integer;
  177.   SuggestedMode  : integer;
  178. begin
  179.   DetectGraph(DetectedDriver, SuggestedMode);
  180.   if (DetectedDriver = VGA) or (DetectedDriver = MCGA) then
  181.   begin
  182.     Writeln('Which video mode would you like to use?');
  183.     Writeln('  0) 320x200x64k');
  184.     Writeln('  1) 640x350x64k');
  185.     Writeln('  2) 640x400x64k');
  186.     Writeln('  3) 640x480x64k');
  187.     Writeln('  4) 800x600x64k');
  188.     Writeln('  5) 1024x768x64k');
  189.     Writeln('  6) 1280x1024x64k');
  190.     Write('> ');
  191.     Readln(SuggestedMode);
  192.     DetectVGA64k := SuggestedMode;
  193.   end
  194.   else
  195.     DetectVGA64k := grError; { Couldn't detect hardware }
  196. end; { DetectVGA32k }
  197. {$F-}
  198.  
  199.  
  200. {$F+}
  201. function DetectTwk256 : integer;
  202. { Detects VGA or MCGA video cards }
  203. var
  204.   DetectedDriver : integer;
  205.   SuggestedMode  : integer;
  206. begin
  207.   DetectGraph(DetectedDriver, SuggestedMode);
  208.   if (DetectedDriver = VGA) or (DetectedDriver = MCGA) then
  209.   begin
  210.     Writeln('Which video mode would you like to use?');
  211.     Writeln('  0) 320x400x256');
  212.     Writeln('  1) 320x480x256');
  213.     Writeln('  2) 360x480x256');
  214.     Writeln('  3) 376x564x256');
  215.     Writeln('  4) 400x564x256');
  216.     Writeln('  5) 400x600x256');
  217.     Writeln('  6) 320x240x256');
  218.     Write('> ');
  219.     Readln(SuggestedMode);
  220.     DetectTwk256 := SuggestedMode;
  221.   end
  222.   else
  223.     DetectTwk256 := grError; { Couldn't detect hardware }
  224. end; { DetectVGA256 }
  225. {$F-}
  226.  
  227. {$F+}
  228. function DetectVGA16 : integer;
  229. { Detects VGA or MCGA video cards }
  230. var
  231.   DetectedDriver : integer;
  232.   SuggestedMode  : integer;
  233. begin
  234.   DetectGraph(DetectedDriver, SuggestedMode);
  235.   if (DetectedDriver = EGA) or (DetectedDriver = VGA) then
  236.   begin
  237.     Writeln('Which video mode would you like to use?');
  238.     Writeln('  0) 320x200x16');
  239.     Writeln('  1) 640x200x16');
  240.     Writeln('  2) 640x350x16');
  241.     Writeln('  3) 640x480x16');
  242.     Writeln('  4) 800x600x16');
  243.     Writeln('  5) 1024x768x16');
  244.     Writeln('  6) 1280x1024x16');
  245.     Write('> ');
  246.     Readln(SuggestedMode);
  247.     DetectVGA16 := SuggestedMode;
  248.   end
  249.   else
  250.     DetectVGA16 := grError; { Couldn't detect hardware }
  251. end; { DetectVGA256 }
  252. {$F-}
  253.  
  254. {$F+}
  255. function DetectTwk16 : integer;
  256. { Detects VGA or MCGA video cards }
  257. var
  258.   DetectedDriver : integer;
  259.   SuggestedMode  : integer;
  260. begin
  261.   DetectGraph(DetectedDriver, SuggestedMode);
  262.   if (DetectedDriver = VGA) then
  263.   begin
  264.     Writeln('Which video mode would you like to use?');
  265.     Writeln('  0) 704x528x16');
  266.     Writeln('  1) 720x540x16');
  267.     Writeln('  2) 736x552x16');
  268.     Writeln('  3) 752x564x16');
  269.     Writeln('  4) 768x576x16');
  270.     Writeln('  5) 784x588x16');
  271.     Writeln('  6) 800x600x16');
  272.     Write('> ');
  273.     Readln(SuggestedMode);
  274.     DetectTwk16 := SuggestedMode;
  275.   end
  276.   else
  277.     DetectTwk16 := grError; { Couldn't detect hardware }
  278. end; { DetectVGA256 }
  279. {$F-}
  280.  
  281. {$F+}
  282. function DetectText : integer;
  283. begin
  284.   DetectText := 0;
  285. end;
  286. {$F-}
  287.  
  288. {$F+}
  289. function DetectS3 : integer;
  290. { Detects VGA or MCGA video cards }
  291. var
  292.   DetectedDriver : integer;
  293.   SuggestedMode  : integer;
  294. begin
  295.   DetectGraph(DetectedDriver, SuggestedMode);
  296.   if (DetectedDriver = VGA) then
  297.   begin
  298.     Writeln('Which video mode would you like to use?');
  299.     Writeln('  0) 640x480x256');
  300.     Writeln('  1) 800x600x256');
  301.     Writeln('  2) 1024x768x256');
  302.     Writeln('  3) 800x600x16');
  303.     Writeln('  4) 1024x768x16');
  304.     Writeln('  5) 1280x960x16');
  305.     Writeln('  6) 1280x1024x16');
  306.     Writeln('  7) 640x480x32k');
  307.     Write('> ');
  308.     Readln(SuggestedMode);
  309.     DetectS3 := SuggestedMode;
  310.   end
  311.   else
  312.     DetectS3 := grError; { Couldn't detect hardware }
  313. end; { DetectVGA256 }
  314. {$F-}
  315.  
  316. var
  317.   AutoDetectPointer : pointer;
  318.  
  319. procedure Initialize;
  320. { Initialize graphics and report any errors that may occur }
  321. var
  322.   InGraphicsMode : boolean; { Flags initialization of graphics mode }
  323.   PathToDriver   : string;  { Stores the DOS path to *.BGI & *.CHR }
  324.   UseWhichDriver : integer;
  325. begin
  326.   { when using Crt and graphics, turn off Crt's memory-mapped writes }
  327.   DirectVideo := False;
  328.   OldExitProc := ExitProc;                { save previous exit proc }
  329.   ExitProc := @MyExitProc;                { insert our exit proc in chain }
  330.   PathToDriver := '';
  331.   repeat
  332.     Writeln('Which driver to use?');
  333.     Writeln('  0) Svga256');
  334.     Writeln('  1) Svga16');
  335.     Writeln('  2) Svga32k');
  336.     Writeln('  3) Tweak256');
  337.     Writeln('  4) Tweak16');
  338.     Writeln('  5) S3');
  339.     Writeln('  6) Svga64k');
  340.     Writeln('  7) Tweak Text');
  341.     Write('>');
  342.     Readln(UseWhichDriver);
  343.     if (UseWhichDriver = 0) then
  344.     begin
  345.       AutoDetectPointer := @DetectVGA256;
  346.       GraphDriver := InstallUserDriver('Svga256',AutoDetectPointer);
  347.     end
  348.     else if (UseWhichDriver=1) then
  349.     begin
  350.       AutoDetectPointer := @DetectVGA16;   { Point to detection routine }
  351.       GraphDriver := InstallUserDriver('SVGA16', AutoDetectPointer);
  352.     end
  353.     else if (UseWhichDriver=2) then
  354.     begin
  355.       AutoDetectPointer := @DetectVGA32k;
  356.       GraphDriver := InstallUserDriver('Svga32k',AutoDetectPointer);
  357.     end
  358.     else if (UseWhichDriver=3) then
  359.     begin
  360.       AutoDetectPointer := @DetectTwk256;
  361.       GraphDriver := InstallUserDriver('Twk256',AutoDetectPointer);
  362.     end
  363.     else if (UseWhichDriver=4) then
  364.     begin
  365.       AutoDetectPointer := @DetectTwk16;
  366.       GraphDriver := InstallUserDriver('Twk16',AutoDetectPointer);
  367.     end
  368.     else if (UseWhichDriver=5) then
  369.     begin
  370.       AutoDetectPointer := @DetectS3;
  371.       GraphDriver := InstallUserDriver('SvgaS3',AutoDetectPointer);
  372.     end
  373.     else if (UseWhichDriver=6) then
  374.     begin
  375.       AutoDetectPointer := @DetectVGA64k;
  376.       GraphDriver := InstallUserDriver('Svga64k',AutoDetectPointer);
  377.     end
  378.     else if (UseWhichDriver=7) then
  379.     begin
  380.       AutoDetectPointer := @DetectText;
  381.       GraphDriver := InstallUserDriver('Twktext',AutoDetectPointer);
  382.     end;
  383.     GraphDriver := Detect;
  384.     InitGraph(GraphDriver, GraphMode, PathToDriver);
  385.     ErrorCode := GraphResult;             { preserve error return }
  386.     if ErrorCode <> grOK then             { error? }
  387.     begin
  388.       Writeln('Graphics error: ', GraphErrorMsg(ErrorCode));
  389.       if ErrorCode = grFileNotFound then  { Can't find driver file }
  390.       begin
  391.         Writeln('Enter full path to BGI driver or type <Ctrl-Break> to quit:');
  392.         Readln(PathToDriver);
  393.         Writeln;
  394.       end
  395.       else
  396.         Halt(1);                          { Some other error: terminate }
  397.     end;
  398.   until ErrorCode = grOK;
  399.   Randomize;                { init random number generator }
  400.   MaxColor := GetMaxColor;  { Get the maximum allowable drawing color }
  401.   MaxX := GetMaxX;          { Get screen resolution values }
  402.   MaxY := GetMaxY;
  403. end; { Initialize }
  404.  
  405. function Int2Str(L : LongInt) : string;
  406. { Converts an integer to a string for use with OutText, OutTextXY }
  407. var
  408.   S : string;
  409. begin
  410.   Str(L, S);
  411.   Int2Str := S;
  412. end; { Int2Str }
  413.  
  414. function RandColor : word;
  415. { Returns a Random non-zero color value that is within the legal
  416.   color range for the selected device driver and graphics mode.
  417.   MaxColor is set to GetMaxColor by Initialize }
  418. begin
  419.   RandColor := Random(MaxColor)+1;
  420. end; { RandColor }
  421.  
  422. procedure DefaultColors;
  423. { Select the maximum color in the Palette for the drawing color }
  424. begin
  425.   SetColor(RealDrawColor(WhitePixel));
  426. end; { DefaultColors }
  427.  
  428. procedure DrawBorder;
  429. { Draw a border around the current view port }
  430. var
  431.   ViewPort : ViewPortType;
  432. begin
  433.   DefaultColors;
  434.   SetLineStyle(SolidLn, 0, NormWidth);
  435.   GetViewSettings(ViewPort);
  436.   with ViewPort do
  437.     Rectangle(0, 0, x2-x1, y2-y1);
  438. end; { DrawBorder }
  439.  
  440. procedure FullPort;
  441. { Set the view port to the entire screen }
  442. begin
  443.   SetViewPort(0, 0, MaxX, MaxY, ClipOn);
  444. end; { FullPort }
  445.  
  446. procedure MainWindow(Header : string);
  447. { Make a default window and view port for demos }
  448. begin
  449.   DefaultColors;                           { Reset the colors }
  450.   ClearDevice;                             { Clear the screen }
  451.   SetTextStyle(DefaultFont, HorizDir, 1);  { Default text font }
  452.   SetTextJustify(CenterText, TopText);     { Left justify text }
  453.   FullPort;                                { Full screen view port }
  454.   OutTextXY(MaxX div 2, 2, Header);        { Draw the header }
  455.   { Draw main window }
  456.   SetViewPort(0, TextHeight('M')+4, MaxX, MaxY-(TextHeight('M')+4), ClipOn);
  457.   DrawBorder;                              { Put a border around it }
  458.   { Move the edges in 1 pixel on all sides so border isn't in the view port }
  459.   SetViewPort(1, TextHeight('M')+5, MaxX-1, MaxY-(TextHeight('M')+5), ClipOn);
  460. end; { MainWindow }
  461.  
  462. procedure StatusLine(Msg : string);
  463. { Display a status line at the bottom of the screen }
  464. begin
  465.   FullPort;
  466.   DefaultColors;
  467.   SetTextStyle(DefaultFont, HorizDir, 1);
  468.   SetTextJustify(CenterText, TopText);
  469.   SetLineStyle(SolidLn, 0, NormWidth);
  470.   SetFillStyle(EmptyFill, RealFillColor(0));
  471.   Bar(0, MaxY-(TextHeight('M')+4), MaxX, MaxY);      { Erase old status line }
  472.   Rectangle(0, MaxY-(TextHeight('M')+4), MaxX, MaxY);
  473.   OutTextXY(MaxX div 2, MaxY-(TextHeight('M')+2), Msg);
  474.   { Go back to the main window }
  475.   SetViewPort(1, TextHeight('M')+5, MaxX-1, MaxY-(TextHeight('M')+5), ClipOn);
  476. end; { StatusLine }
  477.  
  478. procedure WaitToGo;
  479. { Wait for the user to abort the program or continue }
  480. const
  481.   Esc = #27;
  482. var
  483.   Ch : char;
  484. begin
  485.   StatusLine('Esc aborts or press a key...');
  486.   repeat until KeyPressed;
  487.   Ch := ReadKey;
  488.   if Ch = Esc then
  489.     Halt(0)                           { terminate program }
  490.   else
  491.     ClearDevice;                      { clear screen, go on with demo }
  492. end; { WaitToGo }
  493.  
  494. procedure GetDriverAndMode(var DriveStr, ModeStr : string);
  495. { Return strings describing the current device driver and graphics mode
  496.   for display of status report }
  497. begin
  498.   DriveStr := GetDriverName;
  499.   ModeStr := GetModeName(GetGraphMode);
  500. end; { GetDriverAndMode }
  501.  
  502. procedure ReportStatus;
  503. { Display the status of all query functions after InitGraph }
  504. const
  505.   X = 10;
  506. var
  507.   ViewInfo   : ViewPortType;     { Parameters for inquiry procedures }
  508.   LineInfo   : LineSettingsType;
  509.   FillInfo   : FillSettingsType;
  510.   TextInfo   : TextSettingsType;
  511.   Palette    : PaletteType;
  512.   DriverStr  : string;           { Driver and mode strings }
  513.   ModeStr    : string;
  514.   Y          : word;
  515.  
  516. procedure WriteOut(S : string);
  517. { Write out a string and increment to next line }
  518. begin
  519.   OutTextXY(X, Y, S);
  520.   Inc(Y, TextHeight('M')+2);
  521. end; { WriteOut }
  522.  
  523. begin { ReportStatus }
  524.   GetDriverAndMode(DriverStr, ModeStr);   { Get current settings }
  525.   GetViewSettings(ViewInfo);
  526.   GetLineSettings(LineInfo);
  527.   GetFillSettings(FillInfo);
  528.   GetTextSettings(TextInfo);
  529.   GetPalette(Palette);
  530.  
  531.   Y := 4;
  532.   MainWindow('Status report after InitGraph');
  533.   SetTextJustify(LeftText, TopText);
  534.   WriteOut('Graphics device    : '+DriverStr);
  535.   WriteOut('Graphics mode      : '+ModeStr);
  536.   WriteOut('Screen resolution  : (0, 0, '+Int2Str(GetMaxX)+', '+Int2Str(GetMaxY)+')');
  537.   with ViewInfo do
  538.   begin
  539.     WriteOut('Current view port  : ('+Int2Str(x1)+', '+Int2Str(y1)+', '+Int2Str(x2)+', '+Int2Str(y2)+')');
  540.     if ClipOn then
  541.       WriteOut('Clipping           : ON')
  542.     else
  543.       WriteOut('Clipping           : OFF');
  544.   end;
  545.   WriteOut('Current position   : ('+Int2Str(GetX)+', '+Int2Str(GetY)+')');
  546.   WriteOut('Palette entries    : '+Int2Str(Palette.Size));
  547.   WriteOut('GetMaxColor        : '+Int2Str(GetMaxColor));
  548.   WriteOut('Current color      : '+Int2Str(GetColor));
  549.   with LineInfo do
  550.   begin
  551.     WriteOut('Line style         : '+LineStyles[LineStyle]);
  552.     WriteOut('Line thickness     : '+Int2Str(Thickness));
  553.   end;
  554.   with FillInfo do
  555.   begin
  556.     WriteOut('Current fill style : '+FillStyles[Pattern]);
  557.     WriteOut('Current fill color : '+Int2Str(Color));
  558.   end;
  559.   with TextInfo do
  560.   begin
  561.     WriteOut('Current font       : '+Fonts[Font]);
  562.     WriteOut('Text direction     : '+TextDirect[Direction]);
  563.     WriteOut('Character size     : '+Int2Str(CharSize));
  564.     WriteOut('Horizontal justify : '+HorizJust[Horiz]);
  565.     WriteOut('Vertical justify   : '+VertJust[Vert]);
  566.   end;
  567.   WaitToGo;
  568. end; { ReportStatus }
  569.  
  570. procedure FillEllipsePlay;
  571. { Random filled ellipse demonstration }
  572. const
  573.   MaxFillStyles = 12; { patterns 0..11 }
  574. var
  575.   MaxRadius : word;
  576.   FillColor : integer;
  577. begin
  578.   MainWindow('FillEllipse demonstration');
  579.   StatusLine('Esc aborts or press a key');
  580.   MaxRadius := MaxY div 10;
  581.   SetLineStyle(SolidLn, 0, NormWidth);
  582.   repeat
  583.     FillColor := RandColor;
  584.     SetColor(RealDrawColor(FillColor));
  585.     SetFillStyle(Random(MaxFillStyles), RealFillColor(FillColor));
  586.     FillEllipse(Random(MaxX), Random(MaxY),
  587.                 Random(MaxRadius), Random(MaxRadius));
  588.   until KeyPressed;
  589.   WaitToGo;
  590. end; { FillEllipsePlay }
  591.  
  592. procedure SectorPlay;
  593. { Draw random sectors on the screen }
  594. const
  595.   MaxFillStyles = 12; { patterns 0..11 }
  596. var
  597.   MaxRadius : word;
  598.   FillColor : integer;
  599.   EndAngle  : integer;
  600. begin
  601.   MainWindow('Sector demonstration');
  602.   StatusLine('Esc aborts or press a key');
  603.   MaxRadius := MaxY div 10;
  604.   SetLineStyle(SolidLn, 0, NormWidth);
  605.   repeat
  606.     FillColor := RandColor;
  607.     SetColor(RealDrawColor(FillColor));
  608.     SetFillStyle(Random(MaxFillStyles), RealFillColor(FillColor));
  609.     EndAngle := Random(360);
  610.     Sector(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle,
  611.            Random(MaxRadius), Random(MaxRadius));
  612.   until KeyPressed;
  613.   WaitToGo;
  614. end; { SectorPlay }
  615.  
  616. procedure WriteModePlay;
  617. { Demonstrate the SetWriteMode procedure for XOR lines }
  618. const
  619.   DelayValue = 50;  { milliseconds to delay }
  620. var
  621.   ViewInfo      : ViewPortType;
  622.   Color         : word;
  623.   Left, Top     : integer;
  624.   Right, Bottom : integer;
  625.   Step          : integer; { step for rectangle shrinking }
  626. begin
  627.   MainWindow('SetWriteMode demonstration');
  628.   StatusLine('Esc aborts or press a key');
  629.   GetViewSettings(ViewInfo);
  630.   Left := 0;
  631.   Top := 0;
  632.   with ViewInfo do
  633.   begin
  634.     Right := x2-x1;
  635.     Bottom := y2-y1;
  636.   end;
  637.   Step := Bottom div 50;
  638.   SetColor(RealDrawColor(WhitePixel));
  639.   Line(Left, Top, Right, Bottom);
  640.   Line(Left, Bottom, Right, Top);
  641.   SetWriteMode(XORPut);                    { Set XOR write mode }
  642.   repeat
  643.     Line(Left, Top, Right, Bottom);        { Draw XOR lines }
  644.     Line(Left, Bottom, Right, Top);
  645.     Rectangle(Left, Top, Right, Bottom);   { Draw XOR rectangle }
  646.     Delay(DelayValue);                     { Wait }
  647.     Line(Left, Top, Right, Bottom);        { Erase lines }
  648.     Line(Left, Bottom, Right, Top);
  649.     Rectangle(Left, Top, Right, Bottom);   { Erase rectangle }
  650.     if (Left+Step < Right) and (Top+Step < Bottom) then
  651.       begin
  652.         Inc(Left, Step);                  { Shrink rectangle }
  653.         Inc(Top, Step);
  654.         Dec(Right, Step);
  655.         Dec(Bottom, Step);
  656.       end
  657.     else
  658.       begin
  659.         Color := RandColor;                { New color }
  660.         SetColor(RealDrawColor(Color));
  661.         Left := 0;                         { Original large rectangle }
  662.         Top := 0;
  663.         with ViewInfo do
  664.         begin
  665.           Right := x2-x1;
  666.           Bottom := y2-y1;
  667.         end;
  668.       end;
  669.   until KeyPressed;
  670.   SetWriteMode(CopyPut);                   { back to overwrite mode }
  671.   WaitToGo;
  672. end; { WriteModePlay }
  673.  
  674. procedure AspectRatioPlay;
  675. { Demonstrate  SetAspectRatio command }
  676. var
  677.   ViewInfo   : ViewPortType;
  678.   CenterX    : integer;
  679.   CenterY    : integer;
  680.   Radius     : word;
  681.   Xasp, Yasp : word;
  682.   i          : integer;
  683.   RadiusStep : word;
  684. begin
  685.   MainWindow('SetAspectRatio demonstration');
  686.   GetViewSettings(ViewInfo);
  687.   with ViewInfo do
  688.   begin
  689.     CenterX := (x2-x1) div 2;
  690.     CenterY := (y2-y1) div 2;
  691.     Radius := 3*((y2-y1) div 5);
  692.   end;
  693.   RadiusStep := (Radius div 30);
  694.   Circle(CenterX, CenterY, Radius);
  695.   GetAspectRatio(Xasp, Yasp);
  696.   for i := 1 to 30 do
  697.   begin
  698.     SetAspectRatio(Xasp, Yasp+(I*GetMaxX));    { Increase Y aspect factor }
  699.     Circle(CenterX, CenterY, Radius);
  700.     Dec(Radius, RadiusStep);                   { Shrink radius }
  701.   end;
  702.   Inc(Radius, RadiusStep*30);
  703.   for i := 1 to 30 do
  704.   begin
  705.     SetAspectRatio(Xasp+(I*GetMaxX), Yasp);    { Increase X aspect factor }
  706.     if Radius > RadiusStep then
  707.       Dec(Radius, RadiusStep);                 { Shrink radius }
  708.     Circle(CenterX, CenterY, Radius);
  709.   end;
  710.   SetAspectRatio(Xasp, Yasp);                  { back to original aspect }
  711.   WaitToGo;
  712. end; { AspectRatioPlay }
  713.  
  714. procedure TextPlay;
  715. { Demonstrate text justifications and text sizing }
  716. var
  717.   Size : word;
  718.   W, H, X, Y : word;
  719.   ViewInfo : ViewPortType;
  720. begin
  721.   MainWindow('SetTextJustify / SetUserCharSize demo');
  722.   GetViewSettings(ViewInfo);
  723.   with ViewInfo do
  724.   begin
  725.     SetTextStyle(TriplexFont, VertDir, 4);
  726.     Y := (y2-y1) - 2;
  727.     SetTextJustify(CenterText, BottomText);
  728.     OutTextXY(2*TextWidth('M'), Y, 'Vertical');
  729.     SetTextStyle(TriplexFont, HorizDir, 4);
  730.     SetTextJustify(LeftText, TopText);
  731.     OutTextXY(2*TextWidth('M'), 2, 'Horizontal');
  732.     SetTextJustify(CenterText, CenterText);
  733.     X := (x2-x1) div 2;
  734.     Y := TextHeight('H');
  735.     for Size := 1 to 4 do
  736.     begin
  737.       SetTextStyle(TriplexFont, HorizDir, Size);
  738.       H := TextHeight('M');
  739.       W := TextWidth('M');
  740.       Inc(Y, H);
  741.       OutTextXY(X, Y, 'Size '+Int2Str(Size));
  742.     end;
  743.     Inc(Y, H div 2);
  744.     SetTextJustify(CenterText, TopText);
  745.     SetUserCharSize(5, 6, 3, 2);
  746.     SetTextStyle(TriplexFont, HorizDir, UserCharSize);
  747.     OutTextXY((x2-x1) div 2, Y, 'User defined size!');
  748.   end;
  749.   WaitToGo;
  750. end; { TextPlay }
  751.  
  752. procedure TextDump;
  753. { Dump the complete character sets to the screen }
  754. const
  755.   CGASizes  : array[0..4] of word = (1, 3, 7, 3, 3);
  756.   NormSizes : array[0..4] of word = (1, 4, 7, 4, 4);
  757. var
  758.   Font : word;
  759.   ViewInfo : ViewPortType;
  760.   Ch : char;
  761. begin
  762.   for Font := 0 to 4 do
  763.   begin
  764.     MainWindow(Fonts[Font]+' character set');
  765.     GetViewSettings(ViewInfo);
  766.     with ViewInfo do
  767.     begin
  768.       SetTextJustify(LeftText, TopText);
  769.       MoveTo(2, 3);
  770.       if Font = DefaultFont then
  771.         begin
  772.           SetTextStyle(Font, HorizDir, 1);
  773.           Ch := #0;
  774.           repeat
  775.             OutText(Ch);
  776.             if (GetX + TextWidth('M')) > (x2-x1) then
  777.               MoveTo(2, GetY + TextHeight('M')+3);
  778.             Ch := Succ(Ch);
  779.           until (Ch >= #255);
  780.         end
  781.       else
  782.         begin
  783.           if MaxY < 200 then
  784.             SetTextStyle(Font, HorizDir, CGASizes[Font])
  785.           else
  786.             SetTextStyle(Font, HorizDir, NormSizes[Font]);
  787.           Ch := '!';
  788.           repeat
  789.             OutText(Ch);
  790.             if (GetX + TextWidth('M')) > (x2-x1) then
  791.               MoveTo(2, GetY + TextHeight('M')+3);
  792.             Ch := Succ(Ch);
  793.           until (Ord(Ch) = Ord('~')+1);
  794.         end;
  795.     end; { with }
  796.     WaitToGo;
  797.   end; { for loop }
  798. end; { TextDump }
  799.  
  800. procedure LineToPlay;
  801. { Demonstrate MoveTo and LineTo commands }
  802. const
  803.   MaxPoints = 15;
  804. var
  805.   Points     : array[0..MaxPoints] of PointType;
  806.   ViewInfo   : ViewPortType;
  807.   I, J       : integer;
  808.   CenterX    : integer;   { The center point of the circle }
  809.   CenterY    : integer;
  810.   Radius     : word;
  811.   StepAngle  : word;
  812.   Xasp, Yasp : word;
  813.   Radians    : real;
  814.  
  815. function AdjAsp(Value : integer) : integer;
  816. { Adjust a value for the aspect ratio of the device }
  817. begin
  818.   AdjAsp := (LongInt(Value) * Xasp) div Yasp;
  819. end; { AdjAsp }
  820.  
  821. begin
  822.   MainWindow('MoveTo, LineTo demonstration');
  823.   GetAspectRatio(Xasp, Yasp);
  824.   GetViewSettings(ViewInfo);
  825.   with ViewInfo do
  826.   begin
  827.     CenterX := (x2-x1) div 2;
  828.     CenterY := (y2-y1) div 2;
  829.     Radius := CenterY;
  830.     while (CenterY+AdjAsp(Radius)) < (y2-y1)-20 do
  831.       Inc(Radius);
  832.   end;
  833.   StepAngle := 360 div MaxPoints;
  834.   for I := 0 to MaxPoints - 1 do
  835.   begin
  836.     Radians := (StepAngle * I) * Pi / 180;
  837.     Points[I].X := CenterX + round(Cos(Radians) * Radius);
  838.     Points[I].Y := CenterY - AdjAsp(round(Sin(Radians) * Radius));
  839.   end;
  840.   Circle(CenterX, CenterY, Radius);
  841.   for I := 0 to MaxPoints - 1 do
  842.   begin
  843.     for J := I to MaxPoints - 1 do
  844.     begin
  845.       MoveTo(Points[I].X, Points[I].Y);
  846.       LineTo(Points[J].X, Points[J].Y);
  847.     end;
  848.   end;
  849.   WaitToGo;
  850. end; { LineToPlay }
  851.  
  852. procedure LineRelPlay;
  853. { Demonstrate MoveRel and LineRel commands }
  854. const
  855.   MaxPoints = 12;
  856. var
  857.   Poly     : array[1..MaxPoints] of PointType; { Stores a polygon for filling }
  858.   CurrPort : ViewPortType;
  859.  
  860. procedure DrawTesseract;
  861. { Draw a Tesseract on the screen with relative move and
  862.   line drawing commands, also create a polygon for filling }
  863. const
  864.   CheckerBoard : FillPatternType = (0, $10, $28, $44, $28, $10, 0, 0);
  865. var
  866.   X, Y, W, H   : integer;
  867.  
  868. begin
  869.   GetViewSettings(CurrPort);
  870.   with CurrPort do
  871.   begin
  872.     W := (x2-x1) div 9;
  873.     H := (y2-y1) div 8;
  874.     X := ((x2-x1) div 2) - round(2.5 * W);
  875.     Y := ((y2-y1) div 2) - (3 * H);
  876.  
  877.     { Border around viewport is outer part of polygon }
  878.     Poly[1].X := 0;     Poly[1].Y := 0;
  879.     Poly[2].X := x2-x1; Poly[2].Y := 0;
  880.     Poly[3].X := x2-x1; Poly[3].Y := y2-y1;
  881.     Poly[4].X := 0;     Poly[4].Y := y2-y1;
  882.     Poly[5].X := 0;     Poly[5].Y := 0;
  883.     MoveTo(X, Y);
  884.  
  885.     { Grab the whole in the polygon as we draw }
  886.     MoveRel(0, H);      Poly[6].X := GetX;  Poly[6].Y := GetY;
  887.     MoveRel(W, -H);     Poly[7].X := GetX;  Poly[7].Y := GetY;
  888.     MoveRel(4*W, 0);    Poly[8].X := GetX;  Poly[8].Y := GetY;
  889.     MoveRel(0, 5*H);    Poly[9].X := GetX;  Poly[9].Y := GetY;
  890.     MoveRel(-W, H);     Poly[10].X := GetX; Poly[10].Y := GetY;
  891.     MoveRel(-4*W, 0);   Poly[11].X := GetX; Poly[11].Y := GetY;
  892.     MoveRel(0, -5*H);   Poly[12].X := GetX; Poly[12].Y := GetY;
  893.  
  894.     { Fill the polygon with a user defined fill pattern }
  895.     SetFillPattern(CheckerBoard, RealFillColor(GreenPixel));
  896.     FillPoly(12, Poly);
  897.  
  898.     MoveRel(W, -H);
  899.     LineRel(0, 5*H);   LineRel(2*W, 0);    LineRel(0, -3*H);
  900.     LineRel(W, -H);    LineRel(0, 5*H);    MoveRel(0, -5*H);
  901.     LineRel(-2*W, 0);  LineRel(0, 3*H);    LineRel(-W, H);
  902.     MoveRel(W, -H);    LineRel(W, 0);      MoveRel(0, -2*H);
  903.     LineRel(-W, 0);
  904.  
  905.     { Flood fill the center }
  906.     FloodFill((x2-x1) div 2, (y2-y1) div 2,RealColor(WhitePixel));
  907.   end;
  908. end; { DrawTesseract }
  909.  
  910. begin
  911.   MainWindow('LineRel / MoveRel demonstration');
  912.   GetViewSettings(CurrPort);
  913.   with CurrPort do
  914.     { Move the viewport out 1 pixel from each end }
  915.     SetViewPort(x1-1, y1-1, x2+1, y2+1, ClipOn);
  916.   DrawTesseract;
  917.   WaitToGo;
  918. end; { LineRelPlay }
  919.  
  920. procedure PiePlay;
  921. { Demonstrate  PieSlice and GetAspectRatio commands }
  922. var
  923.   ViewInfo   : ViewPortType;
  924.   CenterX    : integer;
  925.   CenterY    : integer;
  926.   Radius     : word;
  927.   Xasp, Yasp : word;
  928.   X, Y       : integer;
  929.  
  930. function AdjAsp(Value : integer) : integer;
  931. { Adjust a value for the aspect ratio of the device }
  932. begin
  933.   AdjAsp := (LongInt(Value) * Xasp) div Yasp;
  934. end; { AdjAsp }
  935.  
  936. procedure GetTextCoords(AngleInDegrees, Radius : word; var X, Y : integer);
  937. { Get the coordinates of text for pie slice labels }
  938. var
  939.   Radians : real;
  940. begin
  941.   Radians := AngleInDegrees * Pi / 180;
  942.   X := round(Cos(Radians) * Radius);
  943.   Y := round(Sin(Radians) * Radius);
  944. end; { GetTextCoords }
  945.  
  946. begin
  947.   MainWindow('PieSlice / GetAspectRatio demonstration');
  948.   GetAspectRatio(Xasp, Yasp);
  949.   GetViewSettings(ViewInfo);
  950.   with ViewInfo do
  951.   begin
  952.     CenterX := (x2-x1) div 2;
  953.     CenterY := ((y2-y1) div 2) + 20;
  954.     Radius := (y2-y1) div 3;
  955.     while AdjAsp(Radius) < round((y2-y1) / 3.6) do
  956.       Inc(Radius);
  957.   end;
  958.   SetTextStyle(TriplexFont, HorizDir, 4);
  959.   SetTextJustify(CenterText, TopText);
  960.   OutTextXY(CenterX, 0, 'This is a pie chart!');
  961.  
  962.   SetTextStyle(TriplexFont, HorizDir, 3);
  963.  
  964.   SetFillStyle(SolidFill, RealFillColor(RandColor));
  965.   PieSlice(CenterX+10, CenterY-AdjAsp(10), 0, 90, Radius);
  966.   GetTextCoords(45, Radius, X, Y);
  967.   SetTextJustify(LeftText, BottomText);
  968.   OutTextXY(CenterX+10+X+TextWidth('H'), CenterY-AdjAsp(10+Y), '25 %');
  969.  
  970.   SetFillStyle(HatchFill, RealFillColor(RandColor));
  971.   PieSlice(CenterX, CenterY, 225, 360, Radius);
  972.   GetTextCoords(293, Radius, X, Y);
  973.   SetTextJustify(LeftText, TopText);
  974.   OutTextXY(CenterX+X+TextWidth('H'), CenterY-AdjAsp(Y), '37.5 %');
  975.  
  976.   SetFillStyle(InterleaveFill, RealFillColor(RandColor));
  977.   PieSlice(CenterX-10, CenterY, 135, 225, Radius);
  978.   GetTextCoords(180, Radius, X, Y);
  979.   SetTextJustify(RightText, CenterText);
  980.   OutTextXY(CenterX-10+X-TextWidth('H'), CenterY-AdjAsp(Y), '25 %');
  981.  
  982.   SetFillStyle(WideDotFill, RealFillColor(RandColor));
  983.   PieSlice(CenterX, CenterY, 90, 135, Radius);
  984.   GetTextCoords(112, Radius, X, Y);
  985.   SetTextJustify(RightText, BottomText);
  986.   OutTextXY(CenterX+X-TextWidth('H'), CenterY-AdjAsp(Y), '12.5 %');
  987.  
  988.   WaitToGo;
  989. end; { PiePlay }
  990.  
  991. procedure Bar3DPlay;
  992. { Demonstrate Bar3D command }
  993. const
  994.   NumBars   = 7;  { The number of bars drawn }
  995.   BarHeight : array[1..NumBars] of byte = (1, 3, 2, 5, 4, 2, 1);
  996.   YTicks    = 5;  { The number of tick marks on the Y axis }
  997. var
  998.   ViewInfo : ViewPortType;
  999.   H        : word;
  1000.   XStep    : real;
  1001.   YStep    : real;
  1002.   I, J     : integer;
  1003.   Depth    : word;
  1004.   Color    : word;
  1005. begin
  1006.   MainWindow('Bar3D / Rectangle demonstration');
  1007.   H := 3*TextHeight('M');
  1008.   GetViewSettings(ViewInfo);
  1009.   SetTextJustify(CenterText, TopText);
  1010.   SetTextStyle(TriplexFont, HorizDir, 4);
  1011.   OutTextXY(MaxX div 2, 6, 'These are 3D bars !');
  1012.   SetTextStyle(DefaultFont, HorizDir, 1);
  1013.   with ViewInfo do
  1014.     SetViewPort(x1+50, y1+40, x2-50, y2-10, ClipOn);
  1015.   GetViewSettings(ViewInfo);
  1016.   with ViewInfo do
  1017.   begin
  1018.     Line(H, H, H, (y2-y1)-H);
  1019.     Line(H, (y2-y1)-H, (x2-x1)-H, (y2-y1)-H);
  1020.     YStep := ((y2-y1)-(2*H)) / YTicks;
  1021.     XStep := ((x2-x1)-(2*H)) / NumBars;
  1022.     J := (y2-y1)-H;
  1023.     SetTextJustify(CenterText, CenterText);
  1024.  
  1025.     { Draw the Y axis and ticks marks }
  1026.     for I := 0 to Yticks do
  1027.     begin
  1028.       Line(H div 2, J, H, J);
  1029.       OutTextXY(0, J, Int2Str(I));
  1030.       J := Round(J-Ystep);
  1031.     end;
  1032.  
  1033.  
  1034.     Depth := trunc(0.25 * XStep);    { Calculate depth of bar }
  1035.  
  1036.     { Draw X axis, bars, and tick marks }
  1037.     SetTextJustify(CenterText, TopText);
  1038.     J := H;
  1039.     for I := 1 to Succ(NumBars) do
  1040.     begin
  1041.       SetColor(RealDrawColor(WhitePixel));
  1042.       Line(J, (y2-y1)-H, J, (y2-y1-3)-(H div 2));
  1043.       OutTextXY(J, (y2-y1)-(H div 2), Int2Str(I-1));
  1044.       if I <> Succ(NumBars) then
  1045.       begin
  1046.         Color := RandColor;
  1047.         SetFillStyle(I, RealFillColor(Color));
  1048.         SetColor(RealDrawColor(Color));
  1049.         Bar3D(J, round((y2-y1-H)-(BarHeight[I] * Ystep)),
  1050.                  round(J+Xstep-Depth), round((y2-y1)-H-1), Depth, TopOn);
  1051.         J := Round(J+Xstep);
  1052.       end;
  1053.     end;
  1054.  
  1055.   end;
  1056.   WaitToGo;
  1057. end; { Bar3DPlay }
  1058.  
  1059. procedure SolidBarPlay;
  1060. { Draw random solid bars on the screen }
  1061. var
  1062.   MaxWidth  : integer;
  1063.   MaxHeight : integer;
  1064.   ViewInfo  : ViewPortType;
  1065.   Color     : word;
  1066. begin
  1067.   MainWindow('Random Solid Bars');
  1068.   StatusLine('Esc aborts or press a key');
  1069.   GetViewSettings(ViewInfo);
  1070.   with ViewInfo do
  1071.   begin
  1072.     MaxWidth := x2-x1;
  1073.     MaxHeight := y2-y1;
  1074.   end;
  1075.   repeat
  1076.     Color := Random(GetMaxColor);  { RandColor }
  1077.     SetColor(RealDrawColor(Color));
  1078.     SetFillStyle(SolidFill, RealFillColor(Color));
  1079.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1080.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1081.   until KeyPressed;
  1082.   WaitToGo;
  1083. end; { SolidBarPlay }
  1084.  
  1085. procedure BarPlay;
  1086. { Demonstrate Bar command }
  1087. const
  1088.   NumBars   = 5;
  1089.   BarHeight : array[1..NumBars] of byte = (1, 3, 5, 2, 4);
  1090.   Styles    : array[1..NumBars] of byte = (1, 3, 10, 5, 9);
  1091. var
  1092.   ViewInfo  : ViewPortType;
  1093.   BarNum    : word;
  1094.   H         : word;
  1095.   XStep     : real;
  1096.   YStep     : real;
  1097.   I, J      : integer;
  1098.   Color     : word;
  1099. begin
  1100.   MainWindow('Bar / Rectangle demonstration');
  1101.   H := 3*TextHeight('M');
  1102.   GetViewSettings(ViewInfo);
  1103.   SetTextJustify(CenterText, TopText);
  1104.   SetTextStyle(TriplexFont, HorizDir, 4);
  1105.   OutTextXY(MaxX div 2, 6, 'These are 2D bars !');
  1106.   SetTextStyle(DefaultFont, HorizDir, 1);
  1107.   with ViewInfo do
  1108.     SetViewPort(x1+50, y1+30, x2-50, y2-10, ClipOn);
  1109.   GetViewSettings(ViewInfo);
  1110.   with ViewInfo do
  1111.   begin
  1112.     Line(H, H, H, (y2-y1)-H);
  1113.     Line(H, (y2-y1)-H, (x2-x1)-H, (y2-y1)-H);
  1114.     YStep := ((y2-y1)-(2*H)) / NumBars;
  1115.     XStep := ((x2-x1)-(2*H)) / NumBars;
  1116.     J := (y2-y1)-H;
  1117.     SetTextJustify(CenterText, CenterText);
  1118.  
  1119.     { Draw Y axis with tick marks }
  1120.     for I := 0 to NumBars do
  1121.     begin
  1122.       Line(H div 2, J, H, J);
  1123.       OutTextXY(0, J, Int2Str(i));
  1124.       J := Round(J-Ystep);
  1125.     end;
  1126.  
  1127.     { Draw X axis, bars, and tick marks }
  1128.     J := H;
  1129.     SetTextJustify(CenterText, TopText);
  1130.     for I := 1 to Succ(NumBars) do
  1131.     begin
  1132.       SetColor(RealDrawColor(WhitePixel));
  1133.       Line(J, (y2-y1)-H, J, (y2-y1-3)-(H div 2));
  1134.       OutTextXY(J, (y2-y1)-(H div 2), Int2Str(I));
  1135.       if I <> Succ(NumBars) then
  1136.       begin
  1137.         Color := RandColor;
  1138.         SetFillStyle(Styles[I], RealFillColor(Color));
  1139.         SetColor(RealDrawColor(Color));
  1140.         Bar(J, round((y2-y1-H)-(BarHeight[I] * Ystep)), round(J+Xstep), (y2-y1)-H-1);
  1141.         Rectangle(J, round((y2-y1-H)-(BarHeight[I] * Ystep)), round(J+Xstep), (y2-y1)-H-1);
  1142.       end;
  1143.       J := Round(J+Xstep);
  1144.     end;
  1145.  
  1146.   end;
  1147.   WaitToGo;
  1148. end; { BarPlay }
  1149.  
  1150. procedure CirclePlay;
  1151. { Draw random circles on the screen }
  1152. var
  1153.   MaxRadius : word;
  1154. begin
  1155.   MainWindow('Circle demonstration');
  1156.   StatusLine('Esc aborts or press a key');
  1157.   MaxRadius := MaxY div 10;
  1158.   SetLineStyle(SolidLn, 0, NormWidth);
  1159.   repeat
  1160.     SetColor(RealDrawColor(RandColor));
  1161.     Circle(Random(MaxX), Random(MaxY), Random(MaxRadius));
  1162.   until KeyPressed;
  1163.   WaitToGo;
  1164. end; { CirclePlay }
  1165.  
  1166.  
  1167. procedure RandBarPlay;
  1168. { Draw random bars on the screen }
  1169. var
  1170.   MaxWidth  : integer;
  1171.   MaxHeight : integer;
  1172.   ViewInfo  : ViewPortType;
  1173.   Color     : word;
  1174. begin
  1175.   MainWindow('Random Bars');
  1176.   StatusLine('Esc aborts or press a key');
  1177.   GetViewSettings(ViewInfo);
  1178.   with ViewInfo do
  1179.   begin
  1180.     MaxWidth := x2-x1;
  1181.     MaxHeight := y2-y1;
  1182.   end;
  1183.   repeat
  1184.     Color := RandColor;
  1185.     SetColor(RealDrawColor(Color));
  1186.     SetFillStyle(Random(CloseDotFill)+1, RealFillColor(Color));
  1187.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1188.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1189.   until KeyPressed;
  1190.   WaitToGo;
  1191. end; { RandBarPlay }
  1192.  
  1193. procedure ArcPlay;
  1194. { Draw random arcs on the screen }
  1195. var
  1196.   MaxRadius : word;
  1197.   EndAngle : word;
  1198.   ArcInfo : ArcCoordsType;
  1199. begin
  1200.   MainWindow('Arc / GetArcCoords demonstration');
  1201.   StatusLine('Esc aborts or press a key');
  1202.   MaxRadius := MaxY div 10;
  1203.   repeat
  1204.     SetColor(RealDrawColor(RandColor));
  1205.     EndAngle := Random(360);
  1206.     SetLineStyle(SolidLn, 0, NormWidth);
  1207.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1208.     GetArcCoords(ArcInfo);
  1209.     with ArcInfo do
  1210.     begin
  1211.       Line(X, Y, XStart, YStart);
  1212.       Line(X, Y, Xend, Yend);
  1213.     end;
  1214.   until KeyPressed;
  1215.   WaitToGo;
  1216. end; { ArcPlay }
  1217.  
  1218. procedure PutPixelPlay;
  1219. { Demonstrate the PutPixel and GetPixel commands }
  1220. const
  1221.   Seed   = 1962; { A seed for the random number generator }
  1222.   NumPts = 2000; { The number of pixels plotted }
  1223.   Esc    = #27;
  1224. var
  1225.   I : word;
  1226.   X, Y, Color : word;
  1227.   XMax, YMax  : integer;
  1228.   ViewInfo    : ViewPortType;
  1229. begin
  1230.   MainWindow('PutPixel / GetPixel demonstration');
  1231.   StatusLine('Esc aborts or press a key...');
  1232.  
  1233.   GetViewSettings(ViewInfo);
  1234.   with ViewInfo do
  1235.   begin
  1236.     XMax := (x2-x1-1);
  1237.     YMax := (y2-y1-1);
  1238.   end;
  1239.  
  1240.   while not KeyPressed do
  1241.   begin
  1242.     { Plot random pixels }
  1243.     RandSeed := Seed;
  1244.     I := 0;
  1245.     while (not KeyPressed) and (I < NumPts) do
  1246.     begin
  1247.       Inc(I);
  1248.       PutPixel(Random(XMax)+1, Random(YMax)+1, RealColor(RandColor));
  1249.     end;
  1250.  
  1251.     { Erase pixels }
  1252.     RandSeed := Seed;
  1253.     I := 0;
  1254.     while (not KeyPressed) and (I < NumPts) do
  1255.     begin
  1256.       Inc(I);
  1257.       X := Random(XMax)+1;
  1258.       Y := Random(YMax)+1;
  1259.       Color := GetPixel(X,Y);
  1260.       inline($89/$56/<Color);  (* Used to load 15-bit color value *)
  1261.       if Color = RandColor then
  1262.         PutPixel(X, Y, RealColor(0))
  1263.       else
  1264.         PutPixel(1024,32,0);
  1265.     end;
  1266.   end;
  1267.   WaitToGo;
  1268. end; { PutPixelPlay }
  1269.  
  1270. procedure PutImagePlay;
  1271. { Demonstrate the GetImage and PutImage commands }
  1272.  
  1273. const
  1274.   r  = 20;
  1275.   StartX = 100;
  1276.   StartY = 150;
  1277.  
  1278. var
  1279.   CurPort : ViewPortType;
  1280.  
  1281. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1282. var
  1283.   Step : integer;
  1284. begin
  1285.   Step := Random(2*r);
  1286.   if Odd(Step) then
  1287.     Step := -Step;
  1288.   X := X + Step;
  1289.   Step := Random(r);
  1290.   if Odd(Step) then
  1291.     Step := -Step;
  1292.   Y := Y + Step;
  1293.  
  1294.   { Make saucer bounce off viewport walls }
  1295.   with CurPort do
  1296.   begin
  1297.     if (x1 + X + Width - 1 > x2) then
  1298.       X := x2-x1 - Width + 1
  1299.     else
  1300.       if (X < 0) then
  1301.         X := 0;
  1302.     if (y1 + Y + Height - 1 > y2) then
  1303.       Y := y2-y1 - Height + 1
  1304.     else
  1305.       if (Y < 0) then
  1306.         Y := 0;
  1307.   end;
  1308. end; { MoveSaucer }
  1309.  
  1310. var
  1311.   Pausetime : word;
  1312.   Saucer    : pointer;
  1313.   X, Y      : integer;
  1314.   ulx, uly  : word;
  1315.   lrx, lry  : word;
  1316.   Size      : word;
  1317.   I         : word;
  1318. begin
  1319.   ClearDevice;
  1320.   FullPort;
  1321.  
  1322.   { PaintScreen }
  1323.   ClearDevice;
  1324.   MainWindow('GetImage / PutImage Demonstration');
  1325.   StatusLine('Esc aborts or press a key...');
  1326.   GetViewSettings(CurPort);
  1327.  
  1328.   { DrawSaucer }
  1329.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1330.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1331.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1332.   Circle(StartX+10, StartY-12, 2);
  1333.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1334.   Circle(StartX-10, StartY-12, 2);
  1335.   SetFillStyle(SolidFill, RealFillColor(BluePixel));
  1336.   FloodFill(StartX+1, StartY+4, RealColor(WhitePixel));
  1337.  
  1338.   { ReadSaucerImage }
  1339.   ulx := StartX-(r+1);
  1340.   uly := StartY-14;
  1341.   lrx := StartX+(r+1);
  1342.   lry := StartY+(r div 3)+3;
  1343.  
  1344.   Size := ImageSize(ulx, uly, lrx, lry);
  1345.   GetMem(Saucer, Size);
  1346.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1347.   PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1348.   { Plot some "stars" }
  1349.   for I := 1 to 1000 do
  1350.     PutPixel(Random(MaxX), Random(MaxY), RealColor(RandColor));
  1351.   X := MaxX div 2;
  1352.   Y := MaxY div 2;
  1353.   PauseTime := 70;
  1354.  
  1355.   { Move the saucer around }
  1356.   repeat
  1357.     X := (X div 8)*8;
  1358.     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1359.     Delay(PauseTime);
  1360.     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1361.     MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1362.   until KeyPressed;
  1363.   FreeMem(Saucer, size);
  1364.   WaitToGo;
  1365. end; { PutImagePlay }
  1366.  
  1367. procedure PolyPlay;
  1368. { Draw random polygons with random fill styles on the screen }
  1369. const
  1370.   MaxPts = 5;
  1371. type
  1372.   PolygonType = array[1..MaxPts] of PointType;
  1373. var
  1374.   Poly : PolygonType;
  1375.   I, Color : word;
  1376. begin
  1377.   MainWindow('FillPoly demonstration');
  1378.   StatusLine('Esc aborts or press a key...');
  1379.   repeat
  1380.     Color := RandColor;
  1381.     SetFillStyle(Random(11)+1, RealFillColor(Color));
  1382.     SetColor(RealDrawColor(Color));
  1383.     for I := 1 to MaxPts do
  1384.       with Poly[I] do
  1385.       begin
  1386.         X := Random(MaxX);
  1387.         Y := Random(MaxY);
  1388.       end;
  1389.     FillPoly(MaxPts, Poly);
  1390.   until KeyPressed;
  1391.   WaitToGo;
  1392. end; { PolyPlay }
  1393.  
  1394. procedure FillStylePlay;
  1395. { Display all of the predefined fill styles available }
  1396. var
  1397.   Style    : word;
  1398.   Width    : word;
  1399.   Height   : word;
  1400.   X, Y     : word;
  1401.   I, J     : word;
  1402.   ViewInfo : ViewPortType;
  1403.  
  1404. procedure DrawBox(X, Y : word);
  1405. begin
  1406.   SetFillStyle(Style, RealFillColor(WhitePixel));
  1407.   with ViewInfo do
  1408.     Bar(X, Y, X+Width, Y+Height);
  1409.   Rectangle(X, Y, X+Width, Y+Height);
  1410.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1411.   Inc(Style);
  1412. end; { DrawBox }
  1413.  
  1414. begin
  1415.   MainWindow('Pre-defined fill styles');
  1416.   GetViewSettings(ViewInfo);
  1417.   with ViewInfo do
  1418.   begin
  1419.     Width := 2 * ((x2+1) div 13);
  1420.     Height := 2 * ((y2-10) div 10);
  1421.   end;
  1422.   X := Width div 2;
  1423.   Y := Height div 2;
  1424.   Style := 0;
  1425.   for J := 1 to 3 do
  1426.   begin
  1427.     for I := 1 to 4 do
  1428.     begin
  1429.       DrawBox(X, Y);
  1430.       Inc(X, (Width div 2) * 3);
  1431.     end;
  1432.     X := Width div 2;
  1433.     Inc(Y, (Height div 2) * 3);
  1434.   end;
  1435.   SetTextJustify(LeftText, TopText);
  1436.   WaitToGo;
  1437. end; { FillStylePlay }
  1438.  
  1439. procedure FillPatternPlay;
  1440. { Display some user defined fill patterns }
  1441. const
  1442.   Patterns : array[0..11] of FillPatternType = (
  1443.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55),
  1444.   ($33, $33, $CC, $CC, $33, $33, $CC, $CC),
  1445.   ($F0, $F0, $F0, $F0, $F, $F, $F, $F),
  1446.   (0, $10, $28, $44, $28, $10, 0, 0),
  1447.   (0, $70, $20, $27, $25, $27, $4, $4),
  1448.   (0, 0, 0, $18, $18, 0, 0, 0),
  1449.   (0, 0, $3C, $3C, $3C, $3C, 0, 0),
  1450.   (0, $7E, $7E, $7E, $7E, $7E, $7E, 0),
  1451.   (0, 0, $22, $8, 0, $22, $1C, 0),
  1452.   ($FF, $7E, $3C, $18, $18, $3C, $7E, $FF),
  1453.   (0, $10, $10, $7C, $10, $10, 0, 0),
  1454.   (0, $42, $24, $18, $18, $24, $42, 0));
  1455. var
  1456.   Style    : word;
  1457.   Width    : word;
  1458.   Height   : word;
  1459.   X, Y     : word;
  1460.   I, J     : word;
  1461.   ViewInfo : ViewPortType;
  1462.  
  1463. procedure DrawBox(X, Y : word);
  1464. begin
  1465.   SetFillPattern(Patterns[Style], RealFillColor(WhitePixel));
  1466.   with ViewInfo do
  1467.     Bar(X, Y, X+Width, Y+Height);
  1468.   Rectangle(X, Y, X+Width, Y+Height);
  1469.   Inc(Style);
  1470. end; { DrawBox }
  1471.  
  1472. begin
  1473.   MainWindow('User defined fill styles');
  1474.   GetViewSettings(ViewInfo);
  1475.   with ViewInfo do
  1476.   begin
  1477.     Width := 2 * ((x2+1) div 13);
  1478.     Height := 2 * ((y2-10) div 10);
  1479.   end;
  1480.   X := Width div 2;
  1481.   Y := Height div 2;
  1482.   Style := 0;
  1483.   for J := 1 to 3 do
  1484.   begin
  1485.     for I := 1 to 4 do
  1486.     begin
  1487.       DrawBox(X, Y);
  1488.       Inc(X, (Width div 2) * 3);
  1489.     end;
  1490.     X := Width div 2;
  1491.     Inc(Y, (Height div 2) * 3);
  1492.   end;
  1493.   SetTextJustify(LeftText, TopText);
  1494.   WaitToGo;
  1495. end; { FillPatternPlay }
  1496.  
  1497. procedure ColorPlay;
  1498. { Display all of the colors available for the current driver and mode }
  1499. var
  1500.   Color    : word;
  1501.   Width    : word;
  1502.   Height   : word;
  1503.   X, Y     : word;
  1504.   I, J     : word;
  1505.   ViewInfo : ViewPortType;
  1506.  
  1507. procedure DrawBox(X, Y : word);
  1508. begin
  1509.   SetFillStyle(SolidFill, RealFillColor(Color));
  1510.   SetColor(RealDrawColor(Color));
  1511.   with ViewInfo do
  1512.     Bar(X, Y, X+Width, Y+Height);
  1513.   Rectangle(X, Y, X+Width, Y+Height);
  1514.   if Color = 0 then
  1515.   begin
  1516.     SetColor(RealDrawColor(WhitePixel));
  1517.     Rectangle(X, Y, X+Width, Y+Height);
  1518.   end;
  1519.   Color := Succ(Color);
  1520. end; { DrawBox }
  1521.  
  1522. begin
  1523.   begin
  1524.     MainWindow('256 Color demonstration');
  1525.     Color := $0;
  1526.     GetViewSettings(ViewInfo);
  1527.     with ViewInfo do
  1528.     begin
  1529.       Width := 2*((x2-x1+1) div 46);
  1530.       Height := 2*((y2-x1+1) div 47);
  1531.     end;
  1532.     X := Width div 3;
  1533.     Y := Height div 3;
  1534.     for J := 1 to 16 do
  1535.     begin
  1536.       for I := 1 to 16 do
  1537.       begin
  1538.         DrawBox(X, Y);
  1539.         Inc(X,(Width div 2)*3);
  1540.       end;
  1541.       X := Width div 3;
  1542.       Inc(Y,(Height div 2)*3);
  1543.     end;
  1544.   end;
  1545.   WaitToGo;
  1546. end; { ColorPlay }
  1547.  
  1548. procedure PalettePlay;
  1549. { Demonstrate the use of the SetRGBPalette command }
  1550. const
  1551.   XBars = 15;
  1552.   YBars = 10;
  1553. type
  1554.   RGBColor   = record
  1555.                  R, G, B : byte;
  1556.                end;
  1557.   VGAPalette = array[0..255] of RGBColor;
  1558.  
  1559. var
  1560.   I, J     : word;
  1561.   X, Y     : word;
  1562.   Color    : word;
  1563.   ViewInfo : ViewPortType;
  1564.   Width    : word;
  1565.   Height   : word;
  1566.   VGAPal   : VGAPalette;
  1567.   Rand     : integer;
  1568.  
  1569. procedure ReadDACBlock(Start, Count : integer; var Pal : VGAPalette);
  1570. var
  1571.   Regs : Registers;
  1572. begin
  1573.   with Regs do
  1574.   begin
  1575.     AH := $10;
  1576.     AL := $17;
  1577.     BX := Start;
  1578.     CX := Count;
  1579.     ES := Seg(Pal);
  1580.     DX := Ofs(Pal);
  1581.   end;
  1582.   Intr($10, Regs);
  1583. end;
  1584.  
  1585. procedure SetDACBlock(Start, Count : integer; var Pal : VGAPalette);
  1586. var
  1587.   Regs : Registers;
  1588. begin
  1589.   with Regs do
  1590.   begin
  1591.     AH := $10;
  1592.     AL := $12;
  1593.     BX := Start;
  1594.     CX := Count;
  1595.     ES := Seg(Pal);
  1596.     DX := Ofs(Pal);
  1597.   end;
  1598.   Intr($10, Regs);
  1599. end;
  1600.  
  1601. begin
  1602.   ReadDACBlock(0, 256, VGAPal);
  1603.   MainWindow('SetRGBPalette demonstration');
  1604.   StatusLine('Press any key...');
  1605.   GetViewSettings(ViewInfo);
  1606.   with ViewInfo do
  1607.   begin
  1608.     Width := (x2-x1) div XBars;
  1609.     Height := (y2-y1) div YBars;
  1610.   end;
  1611.   X := 0; Y := 0;
  1612.   Color := 0;
  1613.   for J := 1 to YBars do
  1614.   begin
  1615.     for I := 1 to XBars do
  1616.     begin
  1617.       SetFillStyle(SolidFill, RealFillColor(Color));
  1618.       Bar(X, Y, X+Width, Y+Height);
  1619.       Inc(X, Width+1);
  1620.       Inc(Color);
  1621.       Color := Color mod 16;
  1622.     end;
  1623.     X := 0;
  1624.     Inc(Y, Height+1);
  1625.   end;
  1626.   repeat
  1627.     {SetPalette(Random(16), VGAPal[Random(256)]);}
  1628.     with VGAPal[Random(16)] do
  1629.       SetRGBPalette(Random(16), R, G, B);
  1630.   until KeyPressed;
  1631.   SetDACBlock(0, 256, VGAPal);
  1632.   WaitToGo;
  1633. end; { PalettePlay }
  1634.  
  1635. procedure CrtModePlay;
  1636. { Demonstrate the use of RestoreCrtMode and SetGraphMode }
  1637. var
  1638.   ViewInfo : ViewPortType;
  1639.   Ch       : char;
  1640. begin
  1641.   MainWindow('SetGraphMode / RestoreCrtMode demo');
  1642.   GetViewSettings(ViewInfo);
  1643.   SetTextJustify(CenterText, CenterText);
  1644.   with ViewInfo do
  1645.   begin
  1646.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'Now you are in graphics mode');
  1647.     StatusLine('Press any key for text mode...');
  1648.     repeat until KeyPressed;
  1649.     Ch := ReadKey;
  1650.     RestoreCrtmode;
  1651.     Writeln('Now you are in text mode.');
  1652.     Write('Press any key to go back to graphics...');
  1653.     repeat until KeyPressed;
  1654.     Ch := ReadKey;
  1655.     SetGraphMode(GetGraphMode);
  1656.     MainWindow('SetGraphMode / RestoreCrtMode demo');
  1657.     SetTextJustify(CenterText, CenterText);
  1658.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'Back in graphics mode...');
  1659.   end;
  1660.   WaitToGo;
  1661. end; { CrtModePlay }
  1662.  
  1663. procedure LineStylePlay;
  1664. { Demonstrate the predefined line styles available }
  1665. var
  1666.   Style    : word;
  1667.   Step     : word;
  1668.   X, Y     : word;
  1669.   ViewInfo : ViewPortType;
  1670.  
  1671. begin
  1672.   ClearDevice;
  1673.   DefaultColors;
  1674.   MainWindow('Pre-defined line styles');
  1675.   GetViewSettings(ViewInfo);
  1676.   with ViewInfo do
  1677.   begin
  1678.     X := 35;
  1679.     Y := 10;
  1680.     Step := (x2-x1) div 11;
  1681.     SetTextJustify(LeftText, TopText);
  1682.     OutTextXY(X, Y, 'NormWidth');
  1683.     SetTextJustify(CenterText, TopText);
  1684.     for Style := 0 to 3 do
  1685.     begin
  1686.       SetLineStyle(Style, 0, NormWidth);
  1687.       Line(X, Y+20, X, Y2-40);
  1688.       OutTextXY(X, Y2-30, Int2Str(Style));
  1689.       Inc(X, Step);
  1690.     end;
  1691.     Inc(X, 2*Step);
  1692.     SetTextJustify(LeftText, TopText);
  1693.     OutTextXY(X, Y, 'ThickWidth');
  1694.     SetTextJustify(CenterText, TopText);
  1695.     for Style := 0 to 3 do
  1696.     begin
  1697.       SetLineStyle(Style, 0, ThickWidth);
  1698.       Line(X, Y+20, X, Y2-40);
  1699.       OutTextXY(X, Y2-30, Int2Str(Style));
  1700.       Inc(X, Step);
  1701.     end;
  1702.   end;
  1703.   SetTextJustify(LeftText, TopText);
  1704.   WaitToGo;
  1705. end; { LineStylePlay }
  1706.  
  1707. procedure UserLineStylePlay;
  1708. { Demonstrate user defined line styles }
  1709. var
  1710.   Style    : word;
  1711.   X, Y, I  : word;
  1712.   ViewInfo : ViewPortType;
  1713. begin
  1714.   MainWindow('User defined line styles');
  1715.   GetViewSettings(ViewInfo);
  1716.   with ViewInfo do
  1717.   begin
  1718.     X := 4;
  1719.     Y := 10;
  1720.     Style := 0;
  1721.     I := 0;
  1722.     while X < X2-4 do
  1723.     begin
  1724.       {$B+}
  1725.       Style := Style or (1 shl (I mod 16));
  1726.       {$B-}
  1727.       SetLineStyle(UserBitLn, Style, NormWidth);
  1728.       Line(X, Y, X, (y2-y1)-Y);
  1729.       Inc(X, 5);
  1730.       Inc(I);
  1731.       if Style = 65535 then
  1732.       begin
  1733.         I := 0;
  1734.         Style := 0;
  1735.       end;
  1736.     end;
  1737.   end;
  1738.   WaitToGo;
  1739. end; { UserLineStylePlay }
  1740.  
  1741.  
  1742. procedure SayGoodbye;
  1743. { Say goodbye and then exit the program }
  1744. var
  1745.   ViewInfo : ViewPortType;
  1746. begin
  1747.   MainWindow('');
  1748.   GetViewSettings(ViewInfo);
  1749.   SetTextStyle(TriplexFont, HorizDir, 4);
  1750.   SetTextJustify(CenterText, CenterText);
  1751.   with ViewInfo do
  1752.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1753.   StatusLine('Press any key to quit...');
  1754.   repeat until KeyPressed;
  1755. end; { SayGoodbye }
  1756.  
  1757. begin { program body }
  1758.   ClrScr;
  1759.   writeln('VGA BGI Demo Program  Copyright(c) 1987,1989 Borland International, Inc.');
  1760.   writeln;
  1761.   Initialize;
  1762.   ReportStatus;
  1763.   AspectRatioPlay;
  1764.   FillEllipsePlay;
  1765.   SectorPlay;
  1766.   WriteModePlay;
  1767.   ColorPlay;
  1768.   PalettePlay;
  1769.   PutPixelPlay;
  1770.   PutImagePlay;
  1771.   RandBarPlay;
  1772.   SolidBarPlay;
  1773.   BarPlay;
  1774.   Bar3DPlay;
  1775.   ArcPlay;
  1776.   CirclePlay;
  1777.   PiePlay;
  1778.   LineToPlay;
  1779.   LineRelPlay;
  1780.   LineStylePlay;
  1781.   UserLineStylePlay;
  1782.   TextDump;
  1783.   TextPlay;
  1784.   CrtModePlay;
  1785.   FillStylePlay;
  1786.   FillPatternPlay;
  1787.   PolyPlay;
  1788.   SayGoodbye;
  1789.   CloseGraph;
  1790. end.
  1791.