//===========================================================================
// GETILBM_PROTO.H -- by Alex Matulich  matulich_alex@SEAA.NAVSEA.NAVY.MIL
//
// Prototypes for user-callable functions in getilbm.c.
// Include this file in all external modules needing the ILBM routines.
//
// For SAS C/C++ 6.xx.  Compile with IGNORE=51 to disable warnings for
// C++ comments (I got addicted to those C++ comments...)
//
// See the comments in getilbm.c for information on enabling or disabling
// certain features.
//===========================================================================

#ifndef GRAPHICS_GFX_H
#include <graphics/gfx.h>  // for struct BitMap definition
#endif
#ifndef EXEC_PORTS_H
#include <exec/ports.h>    // for struct MsgPort definition
#endif

// The following error code is set in loadilbmScreen() and loadilbmBitMap().
// The possible values used in AmigaDOS release 2.0 are:

// OSERR_NOMONITOR    (1) named monitor spec not available
// OSERR_NOCHIPS      (2) you need newer custom chips
// OSERR_NOMEM        (3) couldn't get normal memory
// OSERR_NOCHIPMEM    (4) couldn't get chip memory
// OSERR_PUBNOTUNIQUE (5) public screen name already used
// OSERR_UNKNOWNMODE  (6) don't recognize mode asked for

extern long li_errcode;  // for your use; defined in getilbm.c

typedef struct { ULONG r, g, b; } Color32;

//---------------------------------------------------------------------------

// FUNCTIONS FOR LOADING AN IFF ILBM FILE INTO A SCREEN
//
// loadilbmScreen() is passed the IFF file name, and it attempts to create
// a screen to fit the IFF file contents, loads the screen, and returns a
// pointer to it.  The screen will be HIDDEN.  You must call ScreenToFront()
// to make it visible.
//
// freeilbmScreen() deallocates a screen created by loadilbmScreen().
// The MsgPort parameter is normally passed as NULL, or as the original
// UserPort when loadilbmScreen() created the screen.

struct Screen *loadilbmScreen(char *filename);
void freeilbmScreen(struct Screen *, struct MsgPort *);

//---------------------------------------------------------------------------

// FUNCTIONS FOR LOADING AN IFF ILBM FILE INTO A BITMAP
//
// loadilbmBitMap() is passed the IFF file name, and pointers to three
// unsigned short integers.  The function creates a BitMap to hold the IFF
// file contents.  The 3 integers will be set to the dimensions of the
// BitMap, and a pointer to the BitMap is returned.
//
// freeBitmap() frees any BitMap.
// USE_FREEBM must be defined for it to exist.

struct BitMap
   *loadilbmBitMap(char *filename, USHORT *wide, USHORT *high, USHORT *deep);
void freeBitMap(struct BitMap *);

//---------------------------------------------------------------------------

// The following function is useful too.  It allocates a BitMap of any size.
// USE_GETBM must be #defined or getBitMap() won't exist.

struct BitMap *getBitMap(int wide, int high, int deep, short clear);

// The next function is user-supplied.  It gets called at various times
// during the ILBM loading process.  It is intended to let your program
// take care of time-critical things during a long load.
// #define TIMECHECK if you need it, or just make check_for_switch() an
// empty void function.

void check_for_switch(void);
