home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / 2 / 24bittls.zip / IFF.H < prev    next >
C/C++ Source or Header  |  1991-10-28  |  2KB  |  71 lines

  1. /* iff.h; NewZAP support routines; (c) 1986-91 DJH (24-BIT) */
  2.  
  3. #include <functions.h>
  4. #include <exec/memory.h>
  5. #include <graphics/gfx.h>
  6. #include <graphics/view.h>
  7. #include <intuition/intuition.h>
  8. #include <libraries/dos.h>
  9.  
  10. #define LOWIDTH  376 /* includes OVERSCAN! */
  11. #define LOHEIGHT 242
  12. #define MAXCOLORS 256    /* enough for VGA */
  13.  
  14. struct PicMap {
  15.   long ViewModes;
  16.   UWORD colormap[MAXCOLORS];    /* Amiga-ized LoadRGB4() palette */
  17.   UBYTE palette[MAXCOLORS*3];    /* raw RGB palette */
  18.   struct BitMap BitMap;
  19.   PLANEPTR planes[24-8];    /* extra planes for 24-bit apps */
  20. };
  21.  
  22. typedef enum { DISK_MODE,RAM_MODE } LoadMode;
  23.  
  24. #define DISK_ERR   1  /* error processing */
  25. #define IFF_ERR    2
  26. #define OUT_OF_MEM 3
  27. #define EXPAND_ERR 4
  28. #define BAD_MODE   5
  29.  
  30. /* guaranteed to work right with 16 or 32 bit int's */
  31. #define MakeID(a,b,c,d) ( ((long)a)<<24 | ((long)b)<<16 | (c)<<8  | (d) )
  32.  
  33. #define ID_FORM MakeID('F','O','R','M')
  34. #define ID_ILBM MakeID('I','L','B','M')
  35. #define ID_BMHD MakeID('B','M','H','D')
  36. #define ID_CAMG MakeID('C','A','M','G')
  37. #define ID_CMAP MakeID('C','M','A','P')
  38. #define ID_BODY MakeID('B','O','D','Y')
  39.  
  40. #define mskNone 0
  41. #define mskHasMask 1
  42. #define cmpByteRun1 1
  43.  
  44. #define ROUNDODDUP(a) (((a)+1)&(~1L))
  45.  
  46. typedef struct {
  47.   long ckID,ckSize;
  48. } Chunk;
  49.  
  50. typedef struct {
  51.   short w,h,x,y;
  52.   char  nPlanes,masking,compression,pad1;
  53.   short transparentColor;
  54.   char  xAspect, yAspect;
  55.   short pageWidth,pageHeight;
  56. } BitMapHeader;
  57.  
  58.  
  59. #define SafeRead(a,b,c) if (ReadNEW(a,(char *)b,c)==-1L) \
  60.   { CloseNEW(a); return(DISK_ERR); }
  61.  
  62. /* function prototypes */
  63.  
  64. BPTR OpenNEW(unsigned char *name, long accessMode);
  65. long ReadNEW(BPTR file,char *buffer,long length);
  66. long SeekNEW(BPTR file,long position,long tmode);
  67. void CloseNEW(BPTR file);
  68. ReadILBM(char *fspec,LoadMode mode, struct PicMap *picmap);
  69. void FreeBitMap(struct BitMap *bitmap);
  70. Expand(BitMapHeader *bmhd, unsigned char *sourcebuf, struct BitMap *bitmap);
  71.