Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Pcx.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: PCX.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  PCX image file loader
13 */
14 
15 #ifndef PCX_H
16 #define PCX_H
17 
18 // +--------------------------------------------------------------------+
19 
21 
22 struct PcxHeader
23 {
24  char manufacturer; // Always set to 10
25  char version; // Always 5 for 256-color files
26  char encoding; // Always set to 1
27  char bits_per_pixel; // Should be 8 for 256-color files
28  short xmin,ymin; // Coordinates for top left corner
29  short xmax,ymax; // Width and height of image
30  short hres; // Horizontal resolution of image
31  short vres; // Vertical resolution of image
32  char palette16[48]; // EGA palette; not used for 256-color files
33  char reserved; // Reserved for future use
34  char color_planes; // Color planes
35  short bytes_per_line; // Number of bytes in 1 line of pixels
36  short palette_type; // Should be 2 for color palette
37  char filler[58]; // Nothing but junk
38 };
39 
40 // +--------------------------------------------------------------------+
41 
42 struct PcxImage
43 {
44  static const char* TYPENAME() { return "PcxImage"; }
45 
46  PcxImage(short w, short h, unsigned long* hibits);
47  PcxImage(short w, short h, unsigned char* bits, unsigned char* colors);
48 
49  PcxImage();
50  ~PcxImage();
51 
52  int Load(char *filename);
53  int Save(char *filename);
54 
55  int LoadBuffer(unsigned char* buf, int len);
56 
58  unsigned char* bitmap;
59  unsigned long* himap;
60  unsigned char pal[768];
61  unsigned long imagebytes;
62  unsigned short width, height;
63 };
64 
65 // +--------------------------------------------------------------------+
66 
67 
68 #endif