]> icculus.org git repositories - btb/d2x.git/blob - include/pcx.h
merged endlevel stuff to non-shareware, more fast i/o macros, use global Piggy_hamfil...
[btb/d2x.git] / include / pcx.h
1 /* $Id: pcx.h,v 1.2 2002-08-06 04:49:43 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-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14 /*
15  *
16  * Routines to read/write pcx images.
17  *
18  * Old Log:
19  * Revision 1.4  1995/01/21  17:07:34  john
20  * Added out of memory error.
21  *
22  * Revision 1.3  1994/11/29  02:53:10  john
23  * Added error messages; made call be more similiar to iff.
24  *
25  * Revision 1.2  1994/11/28  20:03:48  john
26  * Added PCX functions.
27  *
28  * Revision 1.1  1994/11/28  19:57:45  john
29  * Initial revision
30  *
31  *
32  */
33
34
35 #ifndef _PCX_H
36 #define _PCX_H
37
38 #include "cfile.h"
39
40 #define PCX_ERROR_NONE          0
41 #define PCX_ERROR_OPENING       1
42 #define PCX_ERROR_NO_HEADER     2
43 #define PCX_ERROR_WRONG_VERSION 3
44 #define PCX_ERROR_READING       4
45 #define PCX_ERROR_NO_PALETTE    5
46 #define PCX_ERROR_WRITING       6
47 #define PCX_ERROR_MEMORY        7
48
49 /* PCX Header data type */
50 typedef struct  {
51         ubyte           Manufacturer;
52         ubyte           Version;
53         ubyte           Encoding;
54         ubyte           BitsPerPixel;
55         short           Xmin;
56         short           Ymin;
57         short           Xmax;
58         short           Ymax;
59         short           Hdpi;
60         short           Vdpi;
61         ubyte           ColorMap[16][3];
62         ubyte           Reserved;
63         ubyte           Nplanes;
64         short           BytesPerLine;
65         ubyte           filler[60];
66 } PCXHeader;
67
68 // Reads filename into bitmap bmp, and fills in palette.  If bmp->bm_data==NULL,
69 // then bmp->bm_data is allocated and the w,h are filled.
70 // If palette==NULL the palette isn't read in.  Returns error code.
71
72 extern int pcx_read_bitmap( char * filename, grs_bitmap * bmp, int bitmap_type, ubyte * palette );
73
74 // Writes the bitmap bmp to filename, using palette. Returns error code.
75
76 extern int pcx_write_bitmap( char * filename, grs_bitmap * bmp, ubyte * palette );
77
78 extern char *pcx_errormsg(int error_number);
79
80 int pcx_read_fullscr(char * filename, ubyte * palette);
81
82 /*
83  * reads a PCXHeader structure from a CFILE
84  */
85 void PCXHeader_read(PCXHeader *ph, CFILE *fp);
86
87 #endif