gdevsgi.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * This file is distributed with Ghostscript, but its author,
  3. * Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov) hereby places it in the
  4. * public domain.
  5. *
  6. * The contents of this file were derived (indeed, largely copied) from
  7. * the file image.h on SGI's file server; there is no copyright on that file.
  8. */
  9. /*$Id: gdevsgi.h,v 1.1 2000/03/09 08:40:41 lpd Exp $*/
  10. /* SGI raster file definitions */
  11. #ifndef gdevsgi_INCLUDED
  12. # define gdevsgi_INCLUDED
  13. #define IMAGIC 0732
  14. /* colormap of images */
  15. #define CM_NORMAL 0
  16. #define CM_DITHERED 1
  17. #define CM_SCREEN 2
  18. #define CM_COLORMAP 3
  19. #define TYPEMASK 0xff00
  20. #define BPPMASK 0x00ff
  21. #define ITYPE_VERBATIM 0x0000
  22. #define ITYPE_RLE 0x0100
  23. #define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE)
  24. #define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM)
  25. #define BPP(type) ((type) & BPPMASK)
  26. #define RLE(bpp) (ITYPE_RLE | (bpp))
  27. #define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp))
  28. #define IBUFSIZE(pixels) ((pixels+(pixels>>6))<<2)
  29. #define RLE_NOP 0x00
  30. #define ierror(p) (((p)->flags&_IOERR)!=0)
  31. #define ifileno(p) ((p)->file)
  32. #define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
  33. #define putpix(p,x) (--(p)->cnt>=0 \
  34. ? ((int)(*(p)->ptr++=(unsigned)(x))) \
  35. : iflsbuf(p,(unsigned)(x)))
  36. typedef struct {
  37. unsigned short imagic; /* stuff saved on disk . . */
  38. unsigned short type;
  39. unsigned short dim;
  40. unsigned short xsize;
  41. unsigned short ysize;
  42. unsigned short zsize;
  43. unsigned long min_color;
  44. unsigned long max_color;
  45. unsigned long wastebytes;
  46. char name[80];
  47. unsigned long colormap;
  48. long file; /* stuff used in core only */
  49. unsigned short flags;
  50. short dorev;
  51. short x;
  52. short y;
  53. short z;
  54. short cnt;
  55. unsigned short *ptr;
  56. unsigned short *base;
  57. unsigned short *tmpbuf;
  58. unsigned long offset;
  59. unsigned long rleend; /* for rle images */
  60. unsigned long *rowstart; /* for rle images */
  61. long *rowsize; /* for rle images */
  62. } IMAGE;
  63. #endif /* gdevsgi_INCLUDED */