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 */
uint32 compression
compression method (0 = none, 1 = 8-bit RLE, 2 = 4-bit RLE)
Definition: bmp.h:23
bool os2_bmp
true if OS/2 1.x or windows 2.x bitmap
Definition: bmp.h:21
Definition: bmp.h:27
Definition: bmp.h:34
Definition: bmp.h:17
uint32 palette_size
number of colours in palette
Definition: bmp.h:24
uint32 height
bitmap height
Definition: bmp.h:20
uint32 width
bitmap width
Definition: bmp.h:19
uint16 bpp
bits per pixel
Definition: bmp.h:22
Structure to access the alpha, red, green, and blue channels from a 32 bit number.
Definition: gfx_type.h:164
uint32 offset
offset of bitmap data from .bmp file begining
Definition: bmp.h:18
Types related to the graphics and/or input devices.