]> icculus.org git repositories - btb/d2x.git/blob - include/iff.h
added function to create blend tables
[btb/d2x.git] / include / iff.h
1 /* $Id: iff.h,v 1.3 2003-10-04 03:14:47 btb Exp $ */
2 /*
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.
13 */
14
15 /*
16  *
17  * Header for IFF routines
18  *
19  * Old Log:
20  * Revision 1.2  1995/05/05  16:33:22  allender
21  * changed types.h to dtypes.h
22  *
23  * Revision 1.1  1995/05/05  08:59:45  allender
24  * Initial revision
25  *
26  * Revision 1.12  1994/11/07  21:26:53  matt
27  * Added new function iff_read_into_bitmap()
28  *
29  * Revision 1.11  1994/05/06  19:37:38  matt
30  * Improved error handling and checking
31  *
32  * Revision 1.10  1994/04/16  20:12:54  matt
33  * Made masked (stenciled) bitmaps work
34  *
35  * Revision 1.9  1994/04/13  23:46:00  matt
36  * Added function, iff_errormsg(), which returns ptr to error message.
37  *
38  * Revision 1.8  1994/04/13  23:27:10  matt
39  * Put in support for anim brushes (.abm files)
40  *
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
43  *
44  * Revision 1.6  1994/01/22  14:40:59  john
45  * Fixed bug with declareations.
46  *
47  * Revision 1.5  1994/01/22  14:23:13  john
48  * Added global vars to check transparency
49  *
50  * Revision 1.4  1993/10/27  12:47:42  john
51  * Extended the comments
52  *
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
55  * destination buffer.
56  *
57  * Revision 1.2  1993/09/08  19:23:25  matt
58  * Added additional return code, IFF_BAD_BM_TYPE
59  *
60  * Revision 1.1  1993/09/08  14:24:21  matt
61  * Initial revision
62  *
63  *
64  */
65
66 #ifndef _IFF_H
67 #define _IFF_H
68
69 #include "pstypes.h"
70 #include "gr.h"
71
72 //Prototypes for IFF library functions
73
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 );
85         //   exit(0)
86
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);
90
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);
95
96 // After a read
97 extern ubyte iff_transparent_color;
98 extern ubyte iff_has_transparency;      // 0=no transparency, 1=iff_transparent_color is valid
99
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.
103
104 //function to return pointer to error message
105 char *iff_errormsg(int error_number);
106
107
108 //Error codes for read & write routines
109
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
123
124 #endif
125