
/* rgb handling */
#define R4(x)			((x >> 8) & 0xF)
#define G4(x)			((x >> 4) & 0xF)
#define B4(x)			(x & 0xF)
#define RGB4(r,g,b)	((r << 8) | (g << 4) | b)


/* XFA_PackMode flags / bitfields */
#define	XFA_MODE16		0x0L			/* 00 compressione 16 Bit */
#define	XFA_MODE16I		0x1L			/* 01 compressione 16 Bit Interlace */
#define	XFA_MODE32		0x2L			/* 10 compressione 32 Bit */
#define	XFA_MODE32I		0x3L			/* 11 compressione 32 Bit Interlace */
#define	XFA_MODEI		0x1L			/* 01 mask for lace cunning mode */

/* XFA close mode definitions */
#define	CLOSE_BLANK		0L			/* close animation with blank frame */
#define	CLOSE_LOOP		1L			/* close animation with loop frame */


/* IFF-XFA definitions */
#define	XFA_FORM		MAKE_ID('F','O','R','M')
#define	XFA_ID		MAKE_ID('X','F','A','0')
#define	XFA_HEAD		MAKE_ID('X','H','D','R')
#define	XFA_CMAP		MAKE_ID('X','P','A','L')
#define	XFA_DELTA	MAKE_ID('X','D','L','T')
#define	XFA_SOUND	MAKE_ID('X','S','N','D')


struct rgb					/* tripletta di colori RGB */
{
	SHORT	r;					/* valore a 16 bit allineato a destra */
	SHORT	g;					/* valore a 16 bit allineato a destra */
	SHORT	b;					/* valore a 16 bit allineato a destra */
};


struct Mem				/* struttura per indirizzare un chunk in memoria */
{
	VOID *Ptr;			/* puntatore al chunk */
	LONG Size;			/* dimensione in bytes */
};


struct XFA_Head			/* header del file IFF-XFA */
{
	SHORT	BytesPerRow;	/* numero di bytes per rasterline */
	SHORT	Rows;				/* numero di rasterlines della bitmap */
	LONG	ModeID;			/* modo grafico di visualizzazione */
	UBYTE	Depth;			/* numero di bitplanes della bitmap */
	UBYTE Flags;			/* XFA_PackMode modo di compressione */
	LONG	NFrames;			/* numero di frames dell'animazione */
};


struct XFA_CMap			/* colormap del file IFF-XFA */
{
	SHORT	NumCols;			/* numero di colori utilizzati */
	SHORT	FirstCol;		/* id del primo colore da settare */
	struct rgb Pal[256];	/* registri colore */
	LONG	Zero;				/* settare a 0 */
};

