/* C include file for the iff.library V16.1, 01-Dec-88	 by CHW */

#ifndef LIBRARIES_IFF_H
#define LIBRARIES_IFF_H
#ifndef EXEC_TYPES_H
#include "exec/types.h"
#endif

#define IFFNAME "iff.library"
#define IFFVERSION 16L		    /* Current library version */


/************** E R R O R - C O D E S ***********************************/

#define IFF_BADTASK -1		    /* IffError() called by wrong task */

#define IFF_CANTOPENFILE 16	    /* File not found */
#define IFF_READERROR 17	    /* Error reading file */
#define IFF_NOMEM 18		    /* Not enough memory */
#define IFF_NOTIFF 19		    /* File is not an IFF file */
#define IFF_WRITEERROR 20	    /* Error writing file */

#define IFF_NOILBM 24		    /* IFF file is not of type ILBM */
#define IFF_NOBMHD 25		    /* BMHD chunk not found */
#define IFF_NOBODY 26		    /* BODY chunk not found */
#define IFF_TOOMANYPLANES 27	    /* BODY has more planes than BitMap */
#define IFF_UNKNOWNCOMPRESSION 28   /* Unknown compression type */


/************** S T R U C T U R E S *************************************/

struct Chunk
{
   LONG  ckID;
   LONG  ckSize;
   UBYTE ckData[1];	/* should be UBYTE ckData[ckSize] */
};


struct BitMapHeader
{
   UWORD w,h;
   WORD  x,y;
   UBYTE nPlanes;
   UBYTE masking;
   UBYTE compression;
   UBYTE pad1;
   UWORD transparentColor;
   UBYTE xAspect,yAspect;
   WORD  pageWidth,pageHeight;
};


/************** F U N C T I O N   D E C L A R A T I O N S ***************/

APTR OldOpenIFF();
void CloseIFF();
struct Chunk *FindChunk();
LONG GetColorTab();
struct BitMapHeader *GetIFFBMHD();
BOOL DecodePic();
BOOL SaveBitMap();
BOOL SaveClip();
LONG IffError();
UWORD GetViewModes();
APTR NewOpenIFF();

#endif !LIBRARIES_IFF_H
