home *** CD-ROM | disk | FTP | other *** search
/ World of Graphics / WOGRAPH.BIN / 070.EXAMPLE2.PAS < prev    next >
Pascal/Delphi Source File  |  1992-06-03  |  2KB  |  66 lines

  1. Program Example2;
  2. { This example code shows you how you might use the shortened PB256 units
  3.   that are included with 256 Paint.  These shortened units are:
  4.       SPB256_4    Unit for use by Turbo Pascal version 4.0 users.
  5.       SPB256_5    Unit for use by Turbo Pascal version 5.5 users.
  6.       SPB256_6    Unit for use by Turbo Pascal version 6.0 users.
  7.  
  8.   Note: I do not have version 5.0, one of the above may or may not work
  9.         with 5.0.
  10.  
  11.   You are welcomed to use the shortened versions of the units in your
  12.   Turbo Pascal programs.  If you have a sincere desire to avoid the
  13.   device drivers (hence, saving .EXE or disk space), we recommend that
  14.   you order the full counterparts of these shortened units.  For a
  15.   more detailed description of what these units include, please refer to
  16.   page 20 of the 256Paint.Doc documentaion file.}
  17.  
  18. {
  19. Here are the current declarations in the INTERFACE section of the
  20. shortened PB256 drivers.  The full versions will contain many more.
  21.  
  22. Type
  23.     ColorRec = record
  24.         r,g,b: byte;
  25.     end;
  26.     PalType = array[0..255] of ColorRec;
  27.     PalFileType = file of PalType;
  28.  
  29. Var
  30.     Pal: PalType;
  31.  
  32. procedure SetupVGAMode;
  33. procedure ReturnToTextMode;
  34. procedure Pixel(x,y: integer; color: byte);
  35. procedure SetPalette256;
  36.  
  37. function ImageSize(ux,uy,lx,ly: integer): word;
  38. procedure LoadImage256(var p:pointer; FName: string; var VGAImageSize: word; var HasPalette: boolean);
  39. Procedure PutImage256(ux,uy: integer; VarSegment,VarOffset: word);
  40. }
  41.  
  42.  
  43. Uses crt,SPB256_6;   { Insert correct .TPU version here!  }
  44.  
  45. Var
  46.     ch: char;
  47.     HadPalette: boolean;
  48.     VGAImageSize: word;
  49.     i: integer;
  50.     p: pointer;
  51.     FileName: String;
  52.  
  53. begin
  54.     FileName := '256Demo.vga';
  55.     SetUpVGAMode;
  56.     LoadImage256(p,FileName,VGAImageSize,HadPalette);
  57.     If HadPalette then
  58.         SetPalette256;
  59.     PutImage256(0,0,Seg(p^),Ofs(p^));
  60.     ch := readkey;
  61.     ReturnToTextMode;
  62.     If VGAImageSize > 6 then
  63.         FreeMem(p,VGAImageSize)
  64.     else
  65.         Writeln('Error (',VGAImageSize,') loading file: ',FileName);
  66. end.