home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / IFF2PBM.ZIP / ACKIFF.H < prev    next >
C/C++ Source or Header  |  1994-01-10  |  3KB  |  99 lines

  1. #ifndef NULL
  2. #define NULL 0
  3. #endif
  4.  
  5. #ifndef FALSE
  6. #define FALSE 0
  7. #define TRUE  1
  8. #endif
  9.  
  10. #define LONG unsigned long
  11. #define ULONG unsigned long
  12. #define UBYTE unsigned char
  13. #define UWORD unsigned short
  14. #define DWORD unsigned long
  15.  
  16. void ByteFlipLong(long *);
  17.  
  18. /* this returns back a bitmap with a picture in it*/
  19. unsigned char far * AckReadIff(char *);
  20.  
  21. /* An ID is four printable ASCII chars like FORM or DPPV */
  22. typedef LONG ID; 
  23.  
  24. #define MakeID(d,c,b,a) ((DWORD)(a)<<24 | (DWORD)(b)<<16 | (DWORD)(c)<<8 | (DWORD)(d) )
  25.  
  26. #define FORM MakeID('F','O','R','M')
  27. #define PROP MakeID('P','R','O','P')
  28. #define LIST MakeID('L','I','S','T')
  29. #define CAT  MakeID('C','A','T',' ')
  30. #define FILLER MakeID(' ',' ',' ',' ')
  31.  
  32. typedef struct
  33.     {
  34.     ID    type;
  35.     long  cksize;
  36.     ID    subtype;
  37.     } form_chunk;
  38.  
  39. typedef struct {
  40.     ID     ckID;
  41.     LONG  ckSize;
  42.     } ChunkHeader;
  43.  
  44. typedef struct {
  45.     ID     ckID;
  46.     LONG  ckSize;
  47.     UBYTE ckData[ 1 /*REALLY: ckSize*/ ];
  48.     } Chunk;
  49.  
  50. #define ID_PBM  MakeID('P','B','M',' ')
  51. #define ID_ILBM MakeID('I','L','B','M')
  52. #define ID_BMHD MakeID('B','M','H','D')
  53. #define ID_CMAP MakeID('C','M','A','P')
  54. #define ID_GRAB MakeID('G','R','A','B')
  55. #define ID_DEST MakeID('D','E','S','T')
  56. #define ID_SPRT MakeID('S','P','R','T')
  57. #define ID_CAMG MakeID('C','A','M','G')
  58. #define ID_BODY MakeID('B','O','D','Y')
  59.  
  60. /* ---------- BitMapHeader ---------------------------------------------*/
  61.  
  62. typedef UBYTE Masking;     /* Choice of masking technique.*/
  63. #define mskNone                 0
  64. #define mskHasMask              1
  65. #define mskHasTransparentColor  2
  66. #define mskLasso                3
  67.  
  68. #define cmpNone      0
  69. #define cmpByteRun1  1
  70.  
  71. /* A BitMapHeader is stored in a BMHD chunk. */
  72. typedef struct {
  73.     UWORD w, h;                     /* raster width & height in pixels      */
  74.     UWORD  x, y;                    /* position for this image              */
  75.     UBYTE nPlanes;                  /* # source bitplanes                   */
  76.     UBYTE masking;                  /* masking technique                    */
  77.     UBYTE compression;              /* compression algoithm                 */
  78.     UBYTE pad1;                     /* UNUSED.  For consistency, put 0 here.*/
  79.     UWORD transparentColor;         /* transparent "color number"           */
  80.     UBYTE xAspect, yAspect;         /* aspect ratio, a rational number x/y  */
  81.     UWORD  pageWidth, pageHeight;   /* source "page" size in pixels         */
  82. } BitMapHeader;
  83.  
  84. /* RowBytes computes the number of bytes in a row, from the width in pixels.*/
  85. #define RowBytes(w)   (((w) + 15) >> 4 << 1)
  86.  
  87. /* A CMAP chunk is a packed array of ColorRegisters (3 bytes each). */
  88. typedef struct {
  89.     UBYTE red, green, blue;   /* MUST be UBYTEs so ">> 4" won't sign extend.*/
  90. } ColorRegister;
  91.  
  92. /* Use this constant instead of sizeof(ColorRegister). */
  93. #define sizeofColorRegister  3
  94.  
  95. void ByteFlipLong(long *);
  96. void ByteFlipShort(short *);
  97. int swab(unsigned short);
  98.  
  99.