OpenTTD
bmp.h
Go to the documentation of this file.
1 /* $Id: bmp.h 17248 2009-08-21 20:21:05Z rubidium $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef BMP_H
13 #define BMP_H
14 
15 #include "gfx_type.h"
16 
17 struct BmpInfo {
18  uint32 offset;
19  uint32 width;
20  uint32 height;
21  bool os2_bmp;
22  uint16 bpp;
23  uint32 compression;
24  uint32 palette_size;
25 };
26 
27 struct BmpData {
28  Colour *palette;
29  byte *bitmap;
30 };
31 
32 #define BMP_BUFFER_SIZE 1024
33 
34 struct BmpBuffer {
35  byte data[BMP_BUFFER_SIZE];
36  int pos;
37  int read;
38  FILE *file;
39  uint real_pos;
40 };
41 
42 void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file);
43 bool BmpReadHeader(BmpBuffer *buffer, BmpInfo *info, BmpData *data);
44 bool BmpReadBitmap(BmpBuffer *buffer, BmpInfo *info, BmpData *data);
45 void BmpDestroyData(BmpData *data);
46 
47 #endif /* BMP_H */