home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / netpbma.zip / ppm / ilbm.h < prev    next >
C/C++ Source or Header  |  1993-11-29  |  4KB  |  153 lines

  1. /* ilbm.h - header file for IFF ILBM files
  2. */
  3.  
  4. #define RowBytes(cols)          ( ( ( (cols) + 15 ) / 16 ) * 2 )
  5.  
  6.  
  7. /* definitions for BMHD */
  8.  
  9. typedef struct {
  10.     unsigned short w, h;
  11.     short x, y;
  12.     unsigned char nPlanes, masking, compression, pad1;
  13.     unsigned short transparentColor;
  14.     unsigned char xAspect, yAspect;
  15.     short pageWidth, pageHeight;
  16. } BitMapHeader;
  17. #define BitMapHeaderSize    20
  18.  
  19. #define mskNone                 0
  20. #define mskHasMask              1
  21. #define mskHasTransparentColor  2
  22. #define mskLasso                3
  23.  
  24. #define cmpNone                 0
  25. #define cmpByteRun1             1
  26. #define cmpMAXKNOWN             cmpByteRun1
  27. static char *  cmpNAME[] = { "none", "byterun1" };
  28.  
  29. /* definitions for CMAP */
  30.  
  31. #if 0   /* not used */
  32. typedef struct {
  33.     unsigned char r, g, b;
  34. } ColorRegister;
  35. #endif
  36.  
  37.  
  38. /* definitions for CAMG */
  39.  
  40. #define CAMGChunkSize       4
  41.  
  42. #define vmLACE              0x0004  /* not used */
  43. #define vmEXTRA_HALFBRITE   0x0080
  44. #define vmHAM               0x0800
  45. #define vmHIRES             0x8000  /* not used */
  46.  
  47.  
  48. #define HAMCODE_CMAP      0     /* look up color in colormap */
  49. #define HAMCODE_BLUE      1     /* new blue component */
  50. #define HAMCODE_RED       2     /* new red component */
  51. #define HAMCODE_GREEN     3     /* new green component */
  52.  
  53.  
  54. /* unofficial DCOL chunk for direct-color */
  55.  
  56. typedef struct {
  57.     unsigned char r, g, b, pad1;
  58. } DirectColor;
  59. #define DirectColorSize     4
  60.  
  61.  
  62. /* multipalette PCHG chunk definitions */
  63.  
  64. /* get number of longwords in line mask from PCHG.LineCount */
  65. #define MaskLongWords(x)    (((x) + 31) / 32)
  66.  
  67. typedef struct {
  68.     unsigned short  Compression;
  69.     unsigned short  Flags;
  70.     short           StartLine;      /* may be negative */
  71.     unsigned short  LineCount;
  72.     unsigned short  ChangedLines;
  73.     unsigned short  MinReg;
  74.     unsigned short  MaxReg;
  75.     unsigned short  MaxChanges;
  76.     unsigned long   TotalChanges;
  77. } PCHGHeader;
  78. #define PCHGHeaderSize      20
  79.  
  80. /* Compression modes */
  81. #define PCHG_COMP_NONE      0
  82. #define PCHG_COMP_HUFFMAN   1
  83.  
  84. /* Flags */
  85. #define PCHGF_12BIT         (1 << 0)    /* use SmallLineChanges */
  86. #define PCHGF_32BIT         (1 << 1)    /* use BigLineChanges */
  87. #define PCHGF_USE_ALPHA     (1 << 2)    /* meaningful only if PCHG_32BIT is on:
  88.                                            use the Alpha channel info */
  89. typedef struct {
  90.     unsigned long   CompInfoSize;
  91.     unsigned long   OriginalDataSize;
  92. } PCHGCompHeader;
  93. #define PCHGCompHeaderSize  8
  94.  
  95. #if 0   /* not used */
  96. typedef struct {
  97.     unsigned char   ChangeCount16;
  98.     unsigned char   ChangeCount32;
  99.     unsigned short  *PaletteChange;
  100. } SmallLineChanges;
  101.  
  102. typedef struct {
  103.     unsigned short  Register;
  104.     unsigned char   Alpha, Red, Blue, Green;    /* ARBG, not ARGB */
  105. } BigPaletteChange;
  106.  
  107. typedef struct {
  108.     unsigned short      ChangeCount;
  109.     BigPaletteChange    *PaletteChange;
  110. } BigLineChanges;
  111. #endif /* 0 */
  112.  
  113. /* the next three structures are used internally by ilbmtoppm
  114.  * The PCHG BigLineChanges and SmallLineChanges are converted
  115.  * to these structures
  116.  */
  117. typedef struct {
  118.     unsigned short  Register;
  119.     pixval          Alpha, Red, Green, Blue;
  120. } PaletteChange;
  121.  
  122. typedef struct {
  123.     unsigned short  Count;
  124.     PaletteChange   *Palette;
  125. } LineChanges;
  126.  
  127. typedef struct {
  128.     PCHGHeader          *PCHG;
  129.     unsigned char       *LineMask;
  130.     LineChanges         *Change;
  131.     PaletteChange       *Palette;
  132.     pixval              maxval;     /* maxval of colors in Palette */
  133.     pixel *             colormap;   /* original colormap */
  134.     int                 colors;     /* colors in colormap */
  135. } PCHGInfo;
  136.  
  137.  
  138. /* other stuff */
  139.  
  140. #define ILBM_BIGRAW
  141.  
  142. #ifdef ILBM_BIGRAW
  143. #   define MAXPLANES   16
  144. typedef unsigned short  rawtype;
  145. #else
  146. #   define MAXPLANES   8
  147. typedef unsigned char   rawtype;
  148. #endif
  149.  
  150. #define MAXCMAPCOLORS   (1 << MAXPLANES)
  151. #define MAXCOLVAL       255     /* max value of color component */
  152.  
  153.