home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / das_buch / grafik / bitmaps.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-05-09  |  1.8 KB  |  62 lines

  1. {$A+,B-,D-,E-,F-,G-,I-,L-,N-,O-,P-,Q-,R-,S-,T-,V-,X-}
  2. {$M 16384,0,655360}
  3.  
  4. (*===================================================================*)
  5. (*                          BITMAPS.PAS                              *)
  6. (*            Demonstration von GetImage und PutImage                *)
  7. (*               (C) 1993 te-wi Verlag München                       *)
  8. (*===================================================================*)
  9.  
  10. PROGRAM BitMaps;
  11.  
  12. USES
  13.   Dos, Crt, Graph;
  14.  
  15. VAR
  16.   x, y, gd, gm     : INTEGER;
  17.   p1, p2           : Pointer;
  18.   size             : WORD;
  19.   TriplexScriptFont: INTEGER;
  20.  
  21. BEGIN
  22.   DetectGraph(gd, gm);
  23.   IF (NOT gd IN [EGA, EGA64, VGA]) THEN 
  24.   BEGIN
  25.     WriteLn('Dieses Programm benötigt EGA+.');
  26.     Halt;
  27.   END;
  28.   InitGraph(gd, gm, GetEnv('BGIPATH'));
  29.   TriplexScriptFont := InstallUserFont('TSCR');
  30.   SetTextJustify(LeftText, BottomText);
  31.   SetFillStyle(SolidFill, Cyan);
  32.   Bar(1, 1, 219, 69);
  33.   SetTextStyle(TriplexScriptFont, 0, 4);
  34.   x := 10; y := 36;
  35.   SetColor(White);
  36.   OutTextXY(x + 60, y, 'tewi');
  37.   OutTextXY(x + 61, y, 'tewi');
  38.   SetColor(Black);
  39.   y := y + TextHeight('Pp') DIV 2 + 5;
  40.   SetTextStyle(SmallFont, 0, 4);
  41.   OutTextXY(x + 15, y, 'Die etwas bessere PC-Literatur');
  42.   size := ImageSize(0, 0, 230, 70);
  43.   GetMem(p1, Size); GetMem(p2, Size);
  44.   GetImage(0, 0, 220, 70, p1^);
  45.   SetFillStyle(SolidFill, Black);
  46.   Bar(0, 0, 250, 70);
  47.   GetImage(0,0, 220, 70, p2^);
  48.   REPEAT
  49.     Randomize;
  50.     x := Random(GetMaxX - 221);
  51.     y := Random(GetMaxY - 71);
  52.     PutImage(x, y, p1^, NormalPut);
  53.     Delay(Random(1000) + 1000);
  54.     PutImage(x, y, p2^, NormalPut);
  55.   UNTIL KeyPressed; (* aus der Unit Crt *)
  56.   FreeMem(p1, Size);
  57.   FreeMem(p2, Size);
  58.   CloseGraph;
  59. END.
  60.  
  61. (*===================================================================*)
  62.