home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d114 / wblander.lha / WBLander / Source / jiff.h < prev    next >
C/C++ Source or Header  |  1987-11-22  |  3KB  |  113 lines

  1.  
  2. /************ I usually put these in a file called format.h ****/
  3.  
  4. #define MAXCOL 256    /* Max 8 bitplanes (I wish) */
  5.  
  6. /* EA handy make a long from 4 chars macros redone to work with Aztec*/
  7. #define MAKE_ID(a, b, c, d)\
  8.     ( ((long)(a)<<24) + ((long)(b)<<16) + ((long)(c)<<8) + (long)(d) )
  9.  
  10. /* these are the IFF types I deal with */
  11. #define FORM MAKE_ID('F', 'O', 'R', 'M')
  12. #define ILBM MAKE_ID('I', 'L', 'B', 'M')
  13. #define BMHD MAKE_ID('B', 'M', 'H', 'D')
  14. #define CMAP MAKE_ID('C', 'M', 'A', 'P')
  15. #define BODY MAKE_ID('B', 'O', 'D', 'Y')
  16. #define CAMG MAKE_ID('C', 'A', 'M', 'G')
  17.  
  18. /* and these are the IFF types I ignore but don't squawk about */
  19. #define GRAB MAKE_ID('G', 'R', 'A', 'B')
  20. #define DEST MAKE_ID('D', 'E', 'S', 'T')
  21. #define SPRT MAKE_ID('S', 'P', 'R', 'T')
  22. #define CRNG MAKE_ID('C', 'R', 'N', 'G')
  23. #define CCRT MAKE_ID('C', 'C', 'R', 'T')
  24.  
  25. /* Some macros for raster memory allocation ... redefine if you're
  26.    sensible and manage memory locally */
  27.  
  28. /* ralloc - raster alloc*/
  29. #define ralloc(amount)  (PLANEPTR)AllocMem((long)(amount), MEMF_CHIP)
  30. /* rfree - raster free*/
  31. #define rfree(pt, amount)    FreeMem( (pt), (long)(amount) )
  32.  
  33. /*line_bytes = the number of words * 2 (for bytes) a raster line takes up */
  34. #define line_bytes(width)    (((width+15)>>4)<<1)
  35.  
  36. /* psize - plane size in bytes (an even number) of a raster given
  37.    width and height */
  38. #define psize(width, height) ( line_bytes(width)*height)
  39.  
  40. /* the place to throw excess bits */
  41. #define bit_bucket(file, length) fseek(file, (long)(length), 1)
  42.  
  43.  
  44. union bytes4
  45.     {
  46.     char b4_name[4];
  47.     long b4_type;
  48.     };
  49.  
  50. struct iff_chunk
  51.     {
  52.     union bytes4 iff_type;
  53.     long iff_length;
  54.     };
  55.  
  56. struct form_chunk
  57.     {
  58.     union bytes4 fc_type; /* == FORM */
  59.     long fc_length;
  60.     union bytes4 fc_subtype;
  61.     };
  62.  
  63. struct BitMapHeader
  64.     {
  65.     UWORD w, h;
  66.     UWORD x, y;
  67.     UBYTE nPlanes;
  68.     UBYTE masking;
  69.     UBYTE compression;
  70.     UBYTE pad1;
  71.     UWORD transparentColor;
  72.     UBYTE xAspect, yAspect;
  73.     WORD pageWidth, pageHeight;
  74.     };
  75.  
  76. /*ILBM_info is the structure read_iff returns, and is hopefully all
  77.   you need to deal with out of the iff reader routines below*/
  78. struct ILBM_info
  79.     {
  80.     struct BitMapHeader header;
  81.     UBYTE cmap[256*3];
  82.     int colors;
  83.     long viewmode;
  84.     struct BitMap bitmap;
  85.     };
  86.  
  87.  
  88. /* I sure wish C function "prototypes" were real and not just ANSI */
  89. extern struct ILBM_info *read_iff();  /* read_iff( char *filename ); */
  90. extern void free_planes();        /* free_planes( struct BitMap *bitmap); */
  91. extern int write_iff();
  92. /* write_iff(char *name, unsigned char *colors, struct BitMap *bits,
  93.     short xoff, short yoff, short width, short compressed); */
  94.  
  95. extern char *AllocMem();
  96.  
  97.  
  98. /* Anyone know where some useful minterms are defined? */
  99. #define COPY_MINTERM        0xc0
  100.  
  101. /***
  102.  
  103.         A meditation for the guru from the Diamond Sutra -
  104.  
  105.         So shall you think of all this fleeting world:
  106.         A star at dawn, a bubble in a stream;
  107.         A flash of lightning in a summer cloud,
  108.         A flickering lamp, a phantom, and a dream.
  109.  
  110. ***/
  111.  
  112.  
  113.