home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / commodities / superdark / iff / jiff.h < prev   
C/C++ Source or Header  |  1992-09-20  |  3KB  |  131 lines

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