Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Bmp.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: Bmp.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  BMP image file loader
13 */
14 
15 #ifndef BMP_H
16 #define BMP_H
17 
18 // +--------------------------------------------------------------------+
19 
21 
23 {
24  WORD type;
25  DWORD size;
26  WORD rsvd1;
27  WORD rsvd2;
28  DWORD offset;
29 };
30 
32 {
33  DWORD hdr_size;
34  DWORD width;
35  DWORD height;
36  WORD planes;
37  WORD bit_count;
38  DWORD compression;
39  DWORD img_size;
42  DWORD colors_used;
44 };
45 
46 const int BMP_FILE_HDR_SIZE = 14;
47 const int BMP_INFO_HDR_SIZE = 40;
48 
49 // +--------------------------------------------------------------------+
50 
51 struct BmpImage
52 {
53  static const char* TYPENAME() { return "BmpImage"; }
54 
55  BmpImage(short w, short h, unsigned long* hibits);
56 
57  BmpImage();
58  ~BmpImage();
59 
60  int Load(char *filename);
61  int Save(char *filename);
62 
63  int LoadBuffer(unsigned char* buf, int len);
64 
67  DWORD palette[256];
68  DWORD* image;
69  WORD width;
70  WORD height;
71 };
72 
73 // +--------------------------------------------------------------------+
74 
75 
76 #endif BMP_H