home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / fgl / fglight / exc.arj / TEMP / 09-03.C < prev    next >
Text File  |  1995-01-20  |  950b  |  44 lines

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. void main()
  8. {
  9.    int i, j;
  10.    int mode, status;
  11.    int minx, maxx, miny, maxy;
  12.    unsigned char PCXpal[768];
  13.    unsigned char header[128];
  14.  
  15.    fg_initpm();
  16.    status = fg_pcxhead("CORAL.PCX",header);
  17.    if (status == -1)
  18.    {
  19.       printf("Can't open CORAL.PCX.\n");
  20.       exit(1);
  21.    }
  22.    else if (status == -2)
  23.    {
  24.       printf("CORAL.PCX is not a PCX file.\n");
  25.       exit(1);
  26.    }
  27.  
  28.    mode = fg_pcxmode(header);
  29.    printf("Optimal display mode is %d.\n",mode);
  30.  
  31.    fg_pcxrange(header,&minx,&maxx,&miny,&maxy);
  32.    printf("Image size is %d by %d pixels.\n",maxx-minx+1,maxy-miny+1);
  33.  
  34.    fg_pcxpal("CORAL.PCX",PCXpal);
  35.    printf("First 16 palette values are:\n");
  36.    j = 0;
  37.    for (i = 0; i < 16; i++)
  38.    {
  39.       printf("  color %2d: R=%2d G=%2d B=%2d\n",
  40.          i,PCXpal[j],PCXpal[j+1],PCXpal[j+2]);
  41.       j += 3;
  42.    }
  43. }
  44.