home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 311.lha / Wipedemo_v4.0 / jiff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1980-12-10  |  3.3 KB  |  135 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 6
  10. #define MAXCOL 64
  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 6
  19. #define MAXCOL 64
  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 SPRT MAKE_ID('S', 'P', 'R', 'T')
  38. #define CAMG MAKE_ID('C', 'A', 'M', 'G')
  39. #define CRNG MAKE_ID('C', 'R', 'N', 'G')
  40. #define CCRT MAKE_ID('C', 'C', 'R', 'T')
  41. #define DPPS MAKE_ID('D', 'P', 'P', 'S')
  42.  
  43. /* Some macros for raster memory allocation ... redefine if you're
  44.    sensible and manage memory locally */
  45.  
  46. /* ralloc - raster alloc*/
  47. #define ralloc(amount)  (PLANEPTR)AllocMem((long)(amount), MEMF_CHIP)
  48. /* rfree - raster free*/
  49. #define rfree(pt, amount)   FreeMem( (pt), (long)(amount) )
  50.  
  51. /*line_bytes = the number of words * 2 (for bytes) a raster line takes up */
  52. #define line_bytes(width)   (((width+15)>>4)<<1)
  53.  
  54. /* psize - plane size in bytes (an even number) of a raster given
  55.    width and height */
  56. #define psize(width, height) ( line_bytes(width)*height)
  57.  
  58. /* the place to throw excess bits */
  59. #define bit_bucket(file, length) fseek(file, (long)(length), 1)
  60.  
  61.  
  62. union bytes4
  63.    {
  64.    char b4_name[4];
  65.    long b4_type;
  66.    };
  67.  
  68. struct iff_chunk
  69.    {
  70.    union bytes4 iff_type;
  71.    long iff_length;
  72.    };
  73.  
  74. struct form_chunk
  75.    {
  76.    union bytes4 fc_type; /* == FORM */
  77.    long fc_length;
  78.    union bytes4 fc_subtype;
  79.    };
  80.  
  81. struct BitMapHeader
  82.    {
  83.    UWORD w, h;
  84.    UWORD x, y;
  85.    UBYTE nPlanes;
  86.    UBYTE masking;
  87.    UBYTE compression;
  88.    UBYTE pad1;
  89.    UWORD transparentColor;
  90.    UBYTE xAspect, yAspect;
  91.    WORD pageWidth, pageHeight;
  92.    };
  93.  
  94. struct crng
  95.    {
  96.    WORD pad1,rate,active;
  97.    UBYTE low,high;
  98.    };
  99.  
  100. /*ILBM_info is the structure read_iff returns, and is hopefully all
  101.   you need to deal with out of the iff reader routines below*/
  102. struct ILBM_info
  103.    {
  104.    struct BitMapHeader header;
  105.    UBYTE cmap[MAXCOL*3];   /*say hey aztec don't like odd length structures*/
  106.    struct BitMap bitmap;
  107.    long camg;
  108.    struct crng crng[6];
  109.    };
  110.  
  111. /* I sure wish C function "prototypes" were real and not just ANSI */
  112. extern struct ILBM_info *read_iff();  /* read_iff( char *filename ); */
  113. extern void free_planes();      /* free_planes( struct BitMap *bitmap); */
  114. extern int write_iff();
  115. /* write_iff(char *name, unsigned char *colors, struct BitMap *bits,
  116.    short xoff, short yoff, short width, short compressed); */
  117.  
  118.  
  119.  
  120. /* Anyone know where some useful minterms are defined? */
  121. #define COPY_MINTERM      0xc0
  122.  
  123. /***
  124.  
  125.       A meditation for the guru from the Diamond Sutra -
  126.  
  127.       So shall you think of all this fleeting world:
  128.       A star at dawn, a bubble in a stream;
  129.       A flash of lightning in a summer cloud,
  130.       A flickering lamp, a phantom, and a dream.
  131.  
  132. ***/
  133.  
  134.  
  135.