home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / grafik / tiff / hercutil.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-07-18  |  2.3 KB  |  83 lines

  1. Program HercUtil_Demo;
  2.  
  3. {***************************************************************}
  4. {*      Demo-Programm zur Veranschaulichung der Funktionen     *}
  5. {*      TestGraph und GetPage                                  *}
  6. {*      von Christian Monien                                   *}
  7. {*      (c) Juli 1990 Verlag Heinz Heise Redaktion c't         *}
  8. {***************************************************************}
  9.  
  10. Uses Crt, Graph;
  11.  
  12. Const
  13.   BGIPath = 'c:\tp5\graph';     { ist für den eigenen Bedarf anzupassen }
  14.  
  15. Var
  16.   GraphDriver  : Integer;
  17.   GraphMode    : Integer;
  18.   ErrorCode    : Integer;
  19.   c            : Char;
  20.  
  21. {$L HercUtil.obj }
  22.  
  23. Function TestGraph : Boolean;  external;
  24. Function GetPage   : Byte;     external;
  25.  
  26. {***************************************************************}
  27.  
  28. Begin
  29.   GraphDriver:= HercMono;
  30.   GraphMode:= HercMonoHi;
  31.   InitGraph(GraphDriver, GraphMode, BGIPath);
  32.   ErrorCode:= GraphResult;
  33.   If ErrorCode <> grOK then
  34.   Begin
  35.     WriteLn('Graphics error:');
  36.     WriteLn(GraphErrorMsg(ErrorCode));
  37.     WriteLn('Program aborted...');
  38.     Halt(1);
  39.   End;
  40.  
  41.   Repeat
  42.     If TestGraph then
  43.     Begin
  44.       If GetPage = 0 then OutTextXY(100, 40, 'Grafikmodus, Seite 0')
  45.                      Else OutTextXY(100, 40, 'Grafikmodus, Seite 1');
  46.       OutTextXY(100, 60, '1 - Textmodus');
  47.       OutTextXY(100, 70, '2 - Grafikmodus, Seite 0');
  48.       OutTextXY(100, 80, '3 - Grafikmodus, Seite 1');
  49.       OutTextXY(100, 90, 'E - Ende');
  50.     End
  51.     Else
  52.     Begin
  53.       GotoXY(10, 3);  Write('Textmodus');
  54.       GotoXY(10, 5);  Write('1 - Textmodus');
  55.       GotoXY(10, 6);  Write('2 - Grafikmodus, Seite 0');
  56.       GotoXY(10, 7);  Write('3 - Grafikmodus, Seite 1');
  57.       GotoXY(10, 8);  Write('E - Ende');
  58.     End;
  59.  
  60.     Repeat
  61.       c:= UpCase(ReadKey);
  62.     Until c in ['1', '2', '3', 'E'];
  63.     Case c of
  64.       '1': Begin
  65.              RestoreCrtMode;
  66.              ClrScr;
  67.            End;
  68.       '2': Begin
  69.              SetGraphMode(GraphMode);
  70.              SetVisualPage(0);
  71.              SetActivePage(0);
  72.            End;
  73.       '3': Begin
  74.              SetGraphMode(GraphMode);
  75.              SetVisualPage(1);
  76.              SetActivePage(1);
  77.            End;
  78.     End;
  79.   Until c = 'E';
  80.   CloseGraph;
  81. End.
  82.  
  83.