1 /* $Id: iff.h,v 1.3 2003-10-04 03:14:47 btb Exp $ */
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
17 * Header for IFF routines
20 * Revision 1.2 1995/05/05 16:33:22 allender
21 * changed types.h to dtypes.h
23 * Revision 1.1 1995/05/05 08:59:45 allender
26 * Revision 1.12 1994/11/07 21:26:53 matt
27 * Added new function iff_read_into_bitmap()
29 * Revision 1.11 1994/05/06 19:37:38 matt
30 * Improved error handling and checking
32 * Revision 1.10 1994/04/16 20:12:54 matt
33 * Made masked (stenciled) bitmaps work
35 * Revision 1.9 1994/04/13 23:46:00 matt
36 * Added function, iff_errormsg(), which returns ptr to error message.
38 * Revision 1.8 1994/04/13 23:27:10 matt
39 * Put in support for anim brushes (.abm files)
41 * Revision 1.7 1994/04/06 23:08:02 matt
42 * Cleaned up code; added prototype (but no new code) for anim brush read
44 * Revision 1.6 1994/01/22 14:40:59 john
45 * Fixed bug with declareations.
47 * Revision 1.5 1994/01/22 14:23:13 john
48 * Added global vars to check transparency
50 * Revision 1.4 1993/10/27 12:47:42 john
51 * Extended the comments
53 * Revision 1.3 1993/09/22 19:17:20 matt
54 * Fixed handling of pad byte in ILBM/PPB body - was writing pad byte to
57 * Revision 1.2 1993/09/08 19:23:25 matt
58 * Added additional return code, IFF_BAD_BM_TYPE
60 * Revision 1.1 1993/09/08 14:24:21 matt
72 //Prototypes for IFF library functions
74 int iff_read_bitmap(char *ifilename,grs_bitmap *bm,int bitmap_type,ubyte *palette);
75 //reads an IFF file into a grs_bitmap structure. fills in palette if not null
76 //returns error codes - see IFF.H. see GR.H for bitmap_type
77 //MEM DETAILS: This routines assumes that you already have the grs_bitmap
78 //structure allocated, but that you don't have the data for this bitmap
79 //allocated. In other words, do this:
80 // grs_bitmap * MyPicture;
81 // MALLOC( MyPicture, grs_bitmap, 1);
82 // iff_read_bitmap( filename, MyPicture, BM_LINEAR, NULL );
83 // ...do whatever with your bitmap ...
84 // gr_free_bitmap( MyPicture );
87 //like iff_read_bitmap(), but reads into a bitmap that already exists,
88 //without allocating memory for the bitmap.
89 int iff_read_into_bitmap(char *ifilename,grs_bitmap *bm, sbyte *palette);
91 //read in animator brush (.abm) file
92 //fills in array of pointers, and n_bitmaps.
93 //returns iff error codes. max_bitmaps is size of array.
94 int iff_read_animbrush(char *ifilename,grs_bitmap **bm,int max_bitmaps,int *n_bitmaps,ubyte *palette);
97 extern ubyte iff_transparent_color;
98 extern ubyte iff_has_transparency; // 0=no transparency, 1=iff_transparent_color is valid
100 int iff_write_bitmap(char *ofilename,grs_bitmap *bm,ubyte *palette);
101 //writes an IFF file from a grs_bitmap structure. writes palette if not null
102 //returns error codes - see IFF.H.
104 //function to return pointer to error message
105 char *iff_errormsg(int error_number);
108 //Error codes for read & write routines
110 #define IFF_NO_ERROR 0 //everything is fine, have a nice day
111 #define IFF_NO_MEM 1 //not enough mem for loading or processing
112 #define IFF_UNKNOWN_FORM 2 //IFF file, but not a bitmap
113 #define IFF_NOT_IFF 3 //this isn't even an IFF file
114 #define IFF_NO_FILE 4 //cannot find or open file
115 #define IFF_BAD_BM_TYPE 5 //tried to save invalid type, like BM_RGB15
116 #define IFF_CORRUPT 6 //bad data in file
117 #define IFF_FORM_ANIM 7 //this is an anim, with non-anim load rtn
118 #define IFF_FORM_BITMAP 8 //this is not an anim, with anim load rtn
119 #define IFF_TOO_MANY_BMS 9 //anim read had more bitmaps than room for
120 #define IFF_UNKNOWN_MASK 10 //unknown masking type
121 #define IFF_READ_ERROR 11 //error reading from file
122 #define IFF_BM_MISMATCH 12 //bm being loaded doesn't match bm loaded into