home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume5 / xldimage / part02 / sunraster.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-13  |  1.6 KB  |  48 lines

  1. /* sunraster.h
  2.  *
  3.  * this describes the header for Sun rasterfiles.  if you have SunOS, a
  4.  * better description is in /usr/include/rasterfile.h.  this is used
  5.  * instead to improve portability and to avoid distribution problems.
  6.  *
  7.  * Copyright 1989 Jim Frost.  See included file "copyright.h" for complete
  8.  * copyright information.
  9.  */
  10.  
  11. #include "copyright.h"
  12.  
  13. struct rheader {
  14.   unsigned char magic[4];   /* magic number */
  15.   unsigned char width[4];   /* width of image in pixels */
  16.   unsigned char height[4];  /* height of image in pixels */
  17.   unsigned char depth[4];   /* depth of each pixel */
  18.   unsigned char length[4];  /* length of the image in bytes */
  19.   unsigned char type[4];    /* format of file */
  20.   unsigned char maptype[4]; /* type of colormap */
  21.   unsigned char maplen[4];  /* length of colormap in bytes */
  22. };
  23.  
  24. /* following the header is the colormap (unless maplen is zero) then
  25.  * the image.  each row of the image is rounded to 2 bytes.
  26.  */
  27.  
  28. #define RMAGICNUMBER 0x59a66a95 /* magic number of this file type */
  29.  
  30. /* these are the possible file formats
  31.  */
  32.  
  33. #define ROLD       0 /* old format, see /usr/include/rasterfile.h */
  34. #define RSTANDARD  1 /* standard format */
  35. #define RRLENCODED 2 /* run length encoding to compress the image */
  36.  
  37. /* these are the possible colormap types.  if it's in RGB format,
  38.  * the map is made up of three byte arrays (red, green, then blue)
  39.  * that are each 1/3 of the colormap length.
  40.  */
  41.  
  42. #define RNOMAP  0 /* no colormap follows the header */
  43. #define RRGBMAP 1 /* rgb colormap */
  44. #define RRAWMAP 2 /* raw colormap; good luck */
  45.  
  46. #define RESC 128 /* run-length encoding escape character */
  47.  
  48.