home *** CD-ROM | disk | FTP | other *** search
/ GRIPS 2: Government Rast…rocessing Software & Data / GRIPS_2.cdr / dos / seq / src / palsave9.c < prev    next >
C/C++ Source or Header  |  1990-01-07  |  987b  |  55 lines

  1. /*     palsave
  2. *
  3. *  Program to copy the contents of the hardware frame buffer's lookup table
  4. *  to a disk file.
  5. *  Tim Krauskopf   August 1987
  6. *  National Center for Supercomputing Applications
  7. *  University of Illinois
  8. *  This program is in the public domain
  9. *
  10. */
  11. #include "pixrect/pixrect_hs.h"
  12. #include "stdio.h"
  13.  
  14. char rmap[256],bmap[256],gmap[256];
  15.  
  16. struct pixrect *screen;
  17.  
  18. FILE *fp;
  19.  
  20. main(argc,argv)
  21.     int argc;
  22.     char *argv[];
  23.     {
  24.     register i;
  25.  
  26.     if (argc < 2) {
  27.         printf("\n Usage: %s file \n",argv[0]);
  28.         exit(1);
  29.     }
  30.  
  31.     screen = pr_open("/dev/fb");
  32.     pr_getcolormap(screen,0,256,rmap,gmap,bmap);
  33.     pr_close(screen);
  34.  
  35.     if (0 > creat(argv[1],0777)) {
  36.         puts("Error in creating new file");
  37.         exit(2);
  38.     }
  39.  
  40.     if (NULL == (fp = fopen(argv[1],"w"))) {
  41.         puts("Error on palette file open ");
  42.         exit(2);
  43.     }
  44.         fwrite(rmap,1,256,fp);
  45.         fwrite(gmap,1,256,fp);
  46.         fwrite(bmap,1,256,fp);
  47.  
  48.    fclose(fp);
  49.  
  50. }
  51.  
  52.  
  53.  
  54.  
  55.