home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d545
/
drawmap.lha
/
DrawMap
/
src.lzh
/
ILBM_lib.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-13
|
25KB
|
659 lines
/* C Include File for the dissidents ilbm.library */
/* Set your editor's TAB width to 3 for a ledgible reproduction */
/* This file is meant to replace all IFF include files for ILBM and
ANIM applications using the ilbm.library */
/* #define FDwAT */
#ifndef ILBMLIB_H
#define ILBMLIB_H
#ifndef GRAPHICS_GFX_H
#include <graphics/gfx.h>
#endif
#ifndef INTUITION_INTUITION_H
#include <intuition/intuition.h>
#endif
#ifndef LIBRARIES_DOS_H
#include "libraries/dos.h"
#endif
/* ======================== Chunk IDs =============================== */
typedef LONG ID; /* An ID is four printable ASCII chars but
stored as a LONG for efficient copy & compare.*/
/* Four-character IDentifier builder.*/
#define MakeID(a,b,c,d) ( (LONG)(a)<<24L | (LONG)(b)<<16L | (c)<<8 | (d) )
/* Standard group IDs. A chunk with one of these IDs contains a
SubTypeID followed by zero or more chunks.*/
#define FORM MakeID('F','O','R','M')
#define PROP MakeID('P','R','O','P')
#define LIST MakeID('L','I','S','T')
#define CAT MakeID('C','A','T',' ')
#define FILLER MakeID(' ',' ',' ',' ')
/* SubTypeIDs */
#define ID_ILBM MakeID('I','L','B','M')
#define ID_ANIM MakeID('A','N','I','M')
/* ILBM Chunk IDs */
#define ID_BMHD MakeID('B','M','H','D')
#define ID_CMAP MakeID('C','M','A','P')
#define ID_GRAB MakeID('G','R','A','B')
#define ID_DEST MakeID('D','E','S','T')
#define ID_SPRT MakeID('S','P','R','T')
#define ID_CAMG MakeID('C','A','M','G')
#define ID_BODY MakeID('B','O','D','Y')
#define ID_CRNG MakeID('C','R','N','G')
#define ID_CCRT MakeID('C','C','R','T')
/* ANIM Chunk IDs */
#define ID_DLTA MakeID('D','L','T','A')
#define ID_ANHD MakeID('A','N','H','D')
#define ID_ANFR MakeID('A','N','F','R')
#define ID_MAHD MakeID('M','A','H','D')
#define ID_MFHD MakeID('M','F','H','D')
#define ID_CM16 MakeID('C','M','1','6')
#define ID_ATXT MakeID('A','T','X','T')
#define ID_PTXT MakeID('P','T','X','T')
/* =========================== Chunk ============================== */
/* All chunks start with a type ID and a count of the data bytes that
follow--the chunk's "logical size" or "data size". If that number is odd,
a 0 pad byte is written, too. */
typedef struct {
ID ckID;
LONG ckSize;
} ChunkHeader;
typedef struct {
ID ckID;
LONG ckSize;
UBYTE ckData[ 1 /*REALLY: ckSize*/ ];
} Chunk;
/* Pass ckSize = szNotYetKnown to the writer to mean "compute the size".*/
#define szNotYetKnown 0x80000001L
/* Need to know whether a value is odd so we can word-align.*/
#define IS_ODD(a) ((a) & 1)
/* This macro rounds up to an even number. */
#define WordAlign(size) ((size+1)&~1)
/* ALL CHUNKS MUST BE PADDED TO EVEN NUMBER OF BYTES.
ChunkPSize computes the total "physical size" of a padded chunk from
its "data size" or "logical size". */
#define ChunkPSize(dataSize) (WordAlign(dataSize) + sizeof(ChunkHeader))
/* The Grouping chunks (LIST, FORM, PROP, & CAT) contain concatenations of
chunks after a subtype ID that identifies the content chunks.
"FORM type XXXX", "LIST of FORM type XXXX", "PROPerties associated
with FORM type XXXX", or "conCATenation of XXXX".*/
typedef struct {
ID ckID;
LONG ckSize; /* this ckSize includes "grpSubID".*/
ID grpSubID;
} GroupHeader;
typedef struct {
ID ckID;
LONG ckSize;
ID grpSubID;
UBYTE grpData[ 1 /*REALLY: ckSize-sizeof(grpSubID)*/ ];
} GroupChunk;
/* ======== IFFP Status code return from the Lib Functions ========= */
typedef LONG IFFP;
/* Status code result from an IFF procedure. A LONG, because must be
type compatible with ID for GetChunkHdr. Note that the error codes
below are not legal IDs. */
#define IFF_OKAY 0L /* Keep going...(not end of file, but we haven't found
our requested FORM or an error yet). Note that the
highest level routines use this to really mean that
everything went well. (see LoadIFFToWindow) */
#define END_MARK -1L /* Encountered the end of a group (i.e. FORM, LIST, etc).
The end of the entire file if you are at the top group.*/
#define IFF_DONE -2L /* Returns this when it has READ enough.
It means return to application. File is Okay. */
#define DOS_ERROR -3L /* AmigaDOS Read or Write error. */
#define NOT_IFF -4L /* Not an IFF file. */
#define NO_FILE -5L /* Tried to open file, AmigaDOS didn't find it. */
#define CLIENT_ERROR -6L
/* Application made invalid request, for instance, write
a negative size chunk. */
#define BAD_FORM -7L /* A read routine complains about FORM semantics
e.g. valid IFF file, but missing a required chunk such
as an ILBM without a BMHD chunk. */
#define SHORT_CHUNK -8L /* Application asked IFFReadBytes to read more bytes
than are left in the chunk. Could be an applic. bug
or bad file. */
#define BAD_IFF -9L /* mal-formed IFF file. Found half a chunk? A CAT with
a PROP in it? */
#define IFF_NOTFOUND -10L
/* The requested FORM not found within the IFF file
(Did you try to find an ILBM in an SMUS file?) */
#define IFF_NOMEM -11L /* Out of memory while loading file */
#define UNKNOWN_ERROR -12L /* This error is unknown (i.e. not 1 of the
preceding). The default lib routines will never
return this. Your custom routines could use this
to signal your calling code that the custom
routine was responsible for terminating. */
/* This MACRO is used to RETURN immediately when a termination condition is
found. This is a pretty weird macro. It requires the caller to declare a
local "IFFP iffp" and assign it. This wouldn't work as a subroutine since
it returns for it's caller. */
#define CheckIFFP() { if (iffp != IFF_OKAY) return(iffp); }
/* =================== Context STRUCTURE ===================== */
typedef struct _GroupContext {
struct _GroupContext *parent; /* Containing group; NULL => whole file. */
ULONG conUserData; /* For the application's use */
BPTR file; /* Byte-stream file handle. */
LONG position; /* The context's logical file position. */
LONG bound; /* File-absolute context bound
or szNotYetKnown (writer only). */
ChunkHeader ckHdr;
/* Current chunk header. ckHdr.ckSize = szNotYetKnown
means we need to go back and set the size (writer only).
See also Pseudo-IDs, above. */
ID subtype; /* Group's subtype ID when reading. */
LONG bytesSoFar; /* # bytes read/written of current chunk's data. */
} GroupContext;
/* Computes the number of bytes not yet read from the current chunk, given
a group read context gc. */
#define ChunkMoreBytes(gc) ((gc)->ckHdr.ckSize - (gc)->bytesSoFar)
/* =================== BitMapHeader (BMHD Chunk) ================== */
typedef UBYTE Masking; /* Choice of masking technique.*/
#define mskNone 0
#define mskHasMask 1
#define mskHasTransparentColor 2
#define mskLasso 3
typedef UBYTE Compression; /* Choice of compression algorithm applied to
* each row of the source and mask planes. "cmpByteRun1" is the byte run
* encoding generated by Mac's PackBits. */
#define cmpNone 0
#define cmpByteRun1 1
/* Aspect ratios: The proper fraction xAspect/yAspect represents the pixel
aspect ratio pixel_width/pixel_height.
For the 4 Amiga display modes:
320 x 200: 10/11 (these pixels are taller than they are wide)
320 x 400: 20/11
640 x 200: 5/11
640 x 400: 10/11 */
#define x320x200Aspect 10
#define y320x200Aspect 11
#define x320x400Aspect 20
#define y320x400Aspect 11
#define x640x200Aspect 5
#define y640x200Aspect 11
#define x640x400Aspect 10
#define y640x400Aspect 11
/* A BitMapHeader is stored in a BMHD chunk. */
typedef struct {
UWORD w, h; /* raster width & height in pixels */
WORD x, y; /* position for this image */
UBYTE nPlanes; /* # source bitplanes */
Masking masking; /* masking technique */
Compression compression; /* compression algoithm */
UBYTE pad1; /* UNUSED. For consistency, put 0 here.*/
UWORD transparentColor; /* transparent "color number" */
UBYTE xAspect, yAspect; /* aspect ratio, a rational number x/y */
WORD pageWidth, pageHeight; /* source "page" size in pixels */
} BitMapHeader;
/* RowBytes computes the number of bytes in a row, from the width in pixels.*/
#define RowBytes(w) (((w) + 15) >> 4 << 1)
/* ==================== ColorRegister ========================== */
/* A CMAP chunk is a packed array of ColorRegisters (3 bytes each). */
typedef struct {
UBYTE red, green, blue; /* MUST be UBYTEs so ">> 4" won't sign extend.*/
} ColorRegister;
/* Use this constant instead of sizeof(ColorRegister). */
#define sizeofColorRegister 3
typedef WORD Color4; /* Amiga RAM version of a color-register,
with 4 bits each RGB in low 12 bits.*/
/* Maximum number of bitplanes in RAM. Current Amiga max w/dual playfield. */
#define MaxAmDepth 6
/* Maximum number of color regs in amiga colorTable */
#define maxColorReg 32
/* ========================= Point2D ============================== */
/* A Point2D is stored in a GRAB chunk. */
typedef struct {
WORD x, y; /* coordinates (pixels) */
} Point2D;
/* ========================= DestMerge ============================ */
/* A DestMerge is stored in a DEST chunk. */
typedef struct {
UBYTE depth; /* # bitplanes in the original source */
UBYTE pad1; /* UNUSED; for consistency store 0 here */
UWORD planePick; /* how to scatter source bitplanes into destination */
UWORD planeOnOff; /* default bitplane data for planePick */
UWORD planeMask; /* selects which bitplanes to store into */
} DestMerge;
/* ====================== SpritePrecedence ======================== */
/* A SpritePrecedence is stored in a SPRT chunk. */
typedef UWORD SpritePrecedence;
/* ======================= Viewport Mode =========================== */
/* A Commodore Amiga ViewPort->Modes is stored in a CAMG chunk. The
chunk's content is declared as a LONG. */
typedef struct {
ULONG ViewModes;
} CamgChunk;
/* ======================== CRNG =============================== */
#define maxCycles 8
#define RNG_NORATE 36 /* Dpaint uses this rate to mean non-active */
typedef struct {
WORD pad1; /* future exp - store 0 here */
WORD rate; /* 60/sec=16384, 30/sec=8192, 1/sec=16384/60=273 */
WORD active; /* lo bit 0=no cycle, 1=yes; next bit 1=rvs */
UBYTE low; /* range lower */
UBYTE high; /* range upper */
} CrngChunk;
/* ======================== CCRT =============================== */
typedef struct {
WORD direction; /* 0=don't cycle, 1=forward, -1=backwards */
UBYTE start; /* range lower */
UBYTE end; /* range upper */
LONG seconds; /* seconds between cycling */
LONG microseconds; /* msecs between cycling */
WORD pad; /* future exp - store 0 here */
} CcrtChunk;
/* =========================== ANHD ============================== */
/* operation modes */
#define DirectSet 0
#define XOR 1
#define LongDelta 2
#define ShortDelta 3
#define ShortLong 4
#define ByteVertical 5
#define Juggler 74
/* Bits values */
#define ShortData 0
#define LongData 1
#define Set 0
#define Xor 2
#define SeparateInfo 0
#define OneInfoList 4
#define NotRLC 0
#define RLC 8
#define Horizontal 0
#define Vertical 16
#define ShortInfo 0
#define LongInfo 32
typedef struct {
UBYTE operation;
UBYTE mask;
UWORD w,h;
WORD x,y;
ULONG abstime;
ULONG reltime;
UBYTE interleave;
UBYTE AnhdPad0;
ULONG Bits;
UBYTE AnhdPad[16];
} AnhdChunk;
/* ===================== ILBMFrame STRUCTURE ===================== */
typedef struct {
UBYTE iFlags;
UBYTE iUserFlags;
BitMapHeader iBMHD;
ULONG iViewModes;
Color4 iColorTable[maxColorReg];
UBYTE iNumColors;
UBYTE iCycleCnt;
CrngChunk iCRNG[maxCycles];
struct Window *iWindow;
struct Screen *iScreen;
struct BitMap *iBMAP;
ULONG iBMSize;
} ILBMFrame;
/* definitions for iFlags field */
#define BMHDFLAG 1 /* if a BMHD chunk found in the file */
#define CAMGFLAG 2 /* if a CAMG chunk found */
#define ANHDFLAG 4 /* if an ANHD chunk found. This is for the use of your
custom CHUNKhandler or PROPhandler. */
/* definitions for iUserFlags. These must be initialized by you. */
#define MOUSEFLAG 1 /* no visible mouse pointer */
#define SCREENFLAG 2 /* hides screen title bar */
#define COLORFLAG 4 /* for "Don't use loaded colorMap. Preserve present map."*/
#define NOSCALE 8 /* "Don't scale a lower res pic to fill a higher res display */
#define ADJUSTVIEW 0x10 /* Do overscan if larger than Intuition view */
#define FORCEPARSE 0x20 /* Continue parsing after ANIM */
#define ANIMFLAG 0x80 /* if an ANIM file */
/* ================== ILBMPropFrame STRUCTURE =================== */
/* Defines for the ILBMPropFrame, because you'll reference from the
ILBMFrame field when using GetPROPStruct, SearchPROP, CopyILBMProp. */
#define iNext -10
#define iID -6
#define iPFSize -2
/* The ILBMPropFrame structure actually looks like this: */
typedef struct {
struct ILBMPropFrame *NextPropFrame;
LONG ifID;
UWORD PropFrameSize;
ILBMFrame PropFrame; /* The address of this field is returned
by the lib PROP routines so that you can
treat it just like an ordinary ILBMFrame */
} ILBMPropFrame;
/* =================== PROPList STRUCTURE =================== */
typedef struct {
struct ILBMPropFrame *FirstPropFrame;
UWORD NumPropFrames;
} PROPList;
/* =================== Vectors STRUCTURE ==================== */
/* When using mid-level load routines, you must allocate and initialize a
vector structure. This structure holds the addresses of whatever routines
you would like the lib to execute while parsing an IFF file. If the
vector address is 0, then the default lib routine is used. */
typedef IFFP ClientProc();
typedef struct _Vectors {
ClientProc *PROPhandler;
/* address of routine to handle nonILBM 'PROP's or an ILBM
PROP chunk that is "unknown" to the lib (i.e. ANHD,DEST,
GRAB,SPRT,DLTA). If NULL, skips nonILBM PROPs. */
ClientProc *FORMhandler;
/* If not NULL, replaces the lib's default 'FORM' handler. */
ClientProc *CHUNKhandler;
/* Called by lib's default 'FORM' handler when it encounters
"unknown" chunks inside an ILBM (see PROPhandler). If NULL,
unknown chunks are skipped. If you don't use the lib's
default 'FORM' handler, then this field is free to use. */
ClientProc *NonILBMhandler;
/* Called by lib's default 'FORM' handler when it encounters
a FORM other than ILBM (i.e. 8SVX, etc). If NULL,
nonILBM FORMs are skipped. If you don't use the lib's
default 'FORM' handler, then this field is free to use. */
} Vectors;
/* ================== Lib Reader Routines ================= */
#ifdef FDwAT
extern IFFP OpenRIFF( BPTR, GroupContext *, ULONG );
extern IFFP OpenRGroup( GroupContext *, GroupContext * );
extern IFFP CloseRGroup( GroupContext * );
extern ID GetChunkHdr( GroupContext * );
extern IFFP IFFReadBytes( LONG, GroupContext *, BYTE * );
extern ID GetFChunkHdr( GroupContext * );
extern ID GetF1ChunkHdr( GroupContext * );
extern ID GetPChunkHdr( GroupContext * );
extern IFFP SkipFwd( GroupContext *, LONG );
extern IFFP FileLength( BPTR );
extern void DecodeVKPlane( ULONG, WORD *, BYTE *, BYTE * );
extern void MakeYTable( ULONG, ULONG, WORD * );
extern void DecompDLTA( BYTE *, struct BitMap * );
extern void DecompBODY( BYTE *, BitMapHeader *, struct BitMap * );
extern void SetupBitmap( UWORD *, struct BitMap *, BitMapHeader * );
extern ULONG GetPROPStruct( ULONG, ID, PROPList * );
extern ULONG SearchPROP( ID, PROPList * );
extern void FreePROPStruct( PROPList * );
extern void CopyILBMPropF( ILBMFrame *, ILBMFrame * );
extern IFFP HandleCAMG( GroupContext *, ILBMFrame * );
extern IFFP HandleCCRT( GroupContext *, ILBMFrame * );
extern IFFP HandleCRNG( GroupContext *, ILBMFrame * );
extern IFFP GetCMAP( GroupContext *, WORD *, UBYTE * );
extern IFFP GetBODY( struct BitMap *, BYTE *, GroupContext *, BitMapHeader * );
/* GetBODY can handle a file with up to 16 planes plus a mask.*/
#define MaxSrcPlanes 16+1
/* This macro computes the worst case packed size of a "row" of bytes. */
#define MaxPackedSize(rowSize) ( (rowSize) + ( ((rowSize)+127) >> 7 ) )
extern BOOL UnPackRow( ULONG, ULONG, BYTE *, BYTE * );
extern IFFP LoadILBM( BPTR, Vectors *, ILBMFrame * );
extern IFFP LoadIFF( BPTR, Vectors *, ULONG );
extern IFFP LoadIFFToWindow( BPTR, ILBMFrame * );
/* Note: Just call IFFReadBytes to read a BMHD, GRAB, DEST, SPRT, or CAMG
chunk. As below. */
#define GetBMHD( context, bmHdr ) \
IFFReadBytes( sizeof(BitMapHeader), context, (BYTE *)bmHdr )
#define GetGRAB( context, point2D ) \
IFFReadBytes( sizeof(Point2D) ,context, (BYTE *)point2D )
#define GetDEST( context, destMerge ) \
IFFReadBytes( sizeof(DestMerge) ,context, (BYTE *)destMerge )
#define GetSPRT( context, spritePrec ) \
IFFReadBytes( sizeof(SpritePrecedence) ,context, (BYTE *)spritePrec )
#define GetCAMG( context, camg ) \
IFFReadBytes( sizeof(CamgChunk) ,context, (BYTE *)camg )
#define GetCRNG( context, crng ) \
IFFReadBytes( sizeof(CrngChunk) ,context, (BYTE *)crng )
#define GetCCRT( context, ccrt ) \
IFFReadBytes( sizeof(CcrtChunk) ,context, (BYTE *)ccrt )
#define GetANHD( context, anhd ) \
IFFReadBytes( sizeof(AnhdChunk) ,context, (BYTE *)anhd )
extern BOOL ScaleImage( struct Rectangle *, struct Rectangle *, struct BitMap *, struct RastPort * );
/* ================= Low Level IFF Writer ======================== */
extern IFFP OpenWIFF( LONG, BPTR, GroupContext * );
extern IFFP StartWGroup( ID, LONG, ID, GroupContext *, GroupContext * );
extern IFFP EndWGroup( GroupContext * );
extern IFFP OpenWGroup( GroupContext *, GroupContext * );
extern IFFP CloseWGroup( GroupContext * );
extern IFFP PutCk( ID, LONG, GroupContext *, BYTE * );
extern IFFP PutCkHdr( ID, LONG, GroupContext * );
extern IFFP IFFWriteBytes( LONG, GroupContext *, BYTE * );
extern IFFP PutCkEnd( GroupContext * );
extern ULONG PackRow( ULONG, BYTE *, BYTE * );
extern IFFP InitBMHdr( ULONG, ULONG, ULONG, ULONG, ULONG, BitMapHeader *, struct BitMap * );
extern IFFP PutCMAP( UBYTE, GroupContext *, WORD );
extern IFFP PutBODY( BYTE *, GroupContext *, BitMapHeader *, struct BitMap * );
extern IFFP SaveILBM( ULONG, ULONG, BPTR, BYTE *, UWORD *, struct BitMap *, Point2D *, ClientProc * );
extern IFFP SaveANIM( ULONG, ULONG, BPTR, BYTE *, UWORD *, struct BitMap *, Point2D *, ClientProc *, AnhdChunk * );
extern IFFP SaveWindowToIFF( BPTR, struct Window * );
/* Note: Just call PutCk to write a BMHD, GRAB, DEST, SPRT, or CAMG
chunk. As below. */
#define PutBMHD( context, bmHdr ) \
PutCk( ID_BMHD, sizeof(BitMapHeader), context, (BYTE *)bmHdr )
#define PutGRAB( context, point2D ) \
PutCk( ID_GRAB, sizeof(Point2D), context, (BYTE *)point2D )
#define PutDEST( context, destMerge ) \
PutCk( ID_DEST, sizeof(DestMerge), context, (BYTE *)destMerge )
#define PutSPRT( context, spritePrec ) \
PutCk( ID_SPRT, sizeof(SpritePrecedence), context, (BYTE *)spritePrec )
#define PutANHD( context, AnhdChunk ) \
PutCk( ID_ANHD, sizeof(AnhdChunk), context, (BYTE *)AnhdChunk )
#define PutCAMG( context, CamgChunk ) \
PutCk( ID_CAMG, sizeof(CamgChunk), context, (BYTE *)CamgChunk )
#define PutCRNG( context, CrngChunk ) \
PutCk( ID_CRNG, sizeof(CrngChunk), context, (BYTE *)CrngChunk )
#define PutCCRT( context, CcrtChunk ) \
PutCk( ID_CCRT, sizeof(CcrtChunk), context, (BYTE *)CcrtChunk )
extern APTR GetIFFPMsg( IFFP );
extern void BlankPointer( struct Window * );
#else
extern IFFP OpenRIFF();
extern IFFP OpenRGroup();
extern IFFP CloseRGroup();
extern ID GetChunkHdr();
extern IFFP IFFReadBytes();
extern ID GetFChunkHdr();
extern ID GetF1ChunkHdr();
extern ID GetPChunkHdr();
extern IFFP SkipFwd();
extern IFFP FileLength();
extern void DecodeVKPlane();
extern void MakeYTable();
extern void DecompDLTA();
extern void DecompBODY();
extern void SetupBitmap();
extern ULONG GetPROPStruct();
extern ULONG SearchPROP();
extern void FreePROPStruct();
extern void CopyILBMPropF();
extern IFFP HandleCAMG();
extern IFFP HandleCCRT();
extern IFFP HandleCRNG();
extern IFFP GetCMAP();
extern IFFP GetBODY();
/* GetBODY can handle a file with up to 16 planes plus a mask.*/
#define MaxSrcPlanes 16+1
/* This macro computes the worst case packed size of a "row" of bytes. */
#define MaxPackedSize(rowSize) ( (rowSize) + ( ((rowSize)+127) >> 7 ) )
extern BOOL UnPackRow();
extern IFFP LoadILBM();
extern IFFP LoadIFF();
extern IFFP LoadIFFToWindow();
/* Note: Just call IFFReadBytes to read a BMHD, GRAB, DEST, SPRT, or CAMG
chunk. As below. */
#define GetBMHD(context, bmHdr) \
IFFReadBytes(sizeof(BitMapHeader), context, (BYTE *)bmHdr)
#define GetGRAB(context, point2D) \
IFFReadBytes(sizeof(Point2D) ,context, (BYTE *)point2D)
#define GetDEST(context, destMerge) \
IFFReadBytes(sizeof(DestMerge) ,context, (BYTE *)destMerge)
#define GetSPRT(context, spritePrec) \
IFFReadBytes(sizeof(SpritePrecedence) ,context, (BYTE *)spritePrec)
#define GetCAMG(context, camg) \
IFFReadBytes(sizeof(CamgChunk) ,context, (BYTE *)camg)
#define GetCRNG(context, crng) \
IFFReadBytes(sizeof(CrngChunk) ,context, (BYTE *)crng)
#define GetCCRT(context, ccrt) \
IFFReadBytes(sizeof(CcrtChunk) ,context, (BYTE *)ccrt)
#define GetANHD(context, anhd) \
IFFReadBytes(sizeof(AnhdChunk) ,context, (BYTE *)anhd)
/* ================= Low Level IFF Writer ======================== */
extern IFFP OpenWIFF();
extern IFFP StartWGroup();
extern IFFP EndWGroup();
extern IFFP OpenWGroup();
extern IFFP CloseWGroup();
extern IFFP PutCk();
extern IFFP PutCkHdr();
extern IFFP IFFWriteBytes();
extern IFFP PutCkEnd();
extern ULONG PackRow();
extern IFFP InitBMHdr();
extern IFFP PutCMAP();
extern IFFP PutBODY();
extern IFFP SaveILBM();
extern IFFP SaveANIM();
extern IFFP SaveWindowToIFF();
extern BOOL ScaleImage();
/* Note: Just call PutCk to write a BMHD, GRAB, DEST, SPRT, or CAMG
chunk. As below. */
#define PutBMHD(context, bmHdr) \
PutCk(ID_BMHD, sizeof(BitMapHeader), context, (BYTE *)bmHdr)
#define PutGRAB(context, point2D) \
PutCk(ID_GRAB, sizeof(Point2D), context, (BYTE *)point2D)
#define PutDEST(context, destMerge) \
PutCk(ID_DEST, sizeof(DestMerge), context, (BYTE *)destMerge)
#define PutSPRT(context, spritePrec) \
PutCk(ID_SPRT, sizeof(SpritePrecedence), context, (BYTE *)spritePrec)
#define PutANHD(context, AnhdChunk) \
PutCk(ID_ANHD, sizeof(AnhdChunk), context, (BYTE *)AnhdChunk)
#define PutCAMG(context, CamgChunk) \
PutCk(ID_CAMG, sizeof(CamgChunk), context, (BYTE *)CamgChunk)
#define PutCRNG(context, CrngChunk) \
PutCk(ID_CRNG, sizeof(CrngChunk), context, (BYTE *)CrngChunk)
#define PutCCRT(context, CcrtChunk) \
PutCk(ID_CCRT, sizeof(CcrtChunk), context, (BYTE *)CcrtChunk)
extern APTR GetIFFPMsg();
extern void BlankPointer();
#endif
typedef UBYTE *UBytePtr;
#endif ILBMLIB_H