home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / grafik / sprite / savescrn.lib < prev    next >
Encoding:
Text File  |  1986-02-15  |  3.4 KB  |  69 lines

  1.  
  2.      (* *************************************************************** *)
  3.      (*                                                                 *)
  4.      (*                         SAVESCRN.LIB                            *)
  5.      (*                                                                 *)
  6.      (*   If you $I include these procedures in your program you will   *)
  7.      (*   be able to save screens to disk in a format you can use for   *)
  8.      (*   your Turbo Pascal programs. You can use the LoadScreen pro-   *)
  9.      (*   cedure to load a screen saved by SaveScreen. By passing an    *)
  10.      (*   offset of 73, it is possible to load a PC Paint Screen that   *)
  11.      (*   has been saved in the uncompressed format (16 kbytes). The    *)
  12.      (*   files produced here contain no header information so all the  *)
  13.      (*   screen parameters must be set in advance. Usually this means  *)
  14.      (*   something like the following :                                *)
  15.      (*                                                                 *)
  16.      (*         GraphColorMode; GraphBackGround (0); Palette (0);       *)
  17.      (*         LoadScreen ('FILENAME.XXX',0);                          *)
  18.      (*                                                                 *)
  19.      (*   Try out the program Savescrn.Com which will allow you to      *)
  20.      (*   set the various parameters. If you have PC Paint try it with  *)
  21.      (*   the sample pictures on the disk. Vary the offset to see what  *)
  22.      (*   happens to the pictures. The program Savescrn.Com will load   *)
  23.      (*   a PC Paint program, strip its header, and write it to disk    *)
  24.      (*   in Turbo Pascal format. Haven't you always wanted to use a    *)
  25.      (*   a paint program to generate fancy screens for your Turbo      *)
  26.      (*   programs?                                                     *)
  27.      (*                                                                 *)
  28.      (*                                 Donald L. Pavia                 *)
  29.      (*                                 Department of Chemistry         *)
  30.      (*         February 1986           Western Washington University   *)
  31.      (*                                 Bellingham, Washington 98225    *)
  32.      (*                                                                 *)
  33.      (* *************************************************************** *)
  34.  
  35.  
  36. type  { Str14 = String[14]; }         { must be included in main program }
  37.       ScreenPointer = ^ScreenType;
  38.       ScreenType = array[0..16383] of byte;
  39.       ScreenFile = file of ScreenType;
  40.  
  41. var   Screen : ScreenPointer;
  42.  
  43. {-------------------------------------------------------}
  44. procedure SaveScreen (FileName : str14);
  45.  
  46.   var  FileToSave : ScreenFile;
  47.  
  48.   begin
  49.        Screen := ptr ($B800,$0000);
  50.        assign (FileToSave,FileName);
  51.        rewrite (FileToSave);
  52.        write (FileToSave,Screen^);
  53.        close (FileToSave);
  54.   end;
  55. {-------------------------------------------------------}
  56. procedure LoadScreen (FileName : str14; Offset : byte);
  57.  
  58.   var  DisplayFile : ScreenFile;        { normally, the offset }
  59.                                         { will be zero         }
  60.   begin
  61.        Screen := ptr ($B800,Offset);
  62.        assign (DisplayFile,FileName);
  63.        reset (DisplayFile);
  64.        read (DisplayFile,Screen^);
  65.        close (DisplayFile);
  66.   end;
  67. {------------------------------------------------}
  68.  
  69.