(svn r27985) -Codechange: Convert VA2 switches into ones with non-overlapping ranges...
[openttd.git] / src / bmp.h
blobcf2b538f39db9d61cb83ff4bdfc64d3b76dddac9
1 /* $Id$ */
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 */
10 /** @file bmp.h Read and write support for bmps. */
12 #ifndef BMP_H
13 #define BMP_H
15 #include "gfx_type.h"
17 struct BmpInfo {
18 uint32 offset; ///< offset of bitmap data from .bmp file begining
19 uint32 width; ///< bitmap width
20 uint32 height; ///< bitmap height
21 bool os2_bmp; ///< true if OS/2 1.x or windows 2.x bitmap
22 uint16 bpp; ///< bits per pixel
23 uint32 compression; ///< compression method (0 = none, 1 = 8-bit RLE, 2 = 4-bit RLE)
24 uint32 palette_size; ///< number of colours in palette
27 struct BmpData {
28 Colour *palette;
29 byte *bitmap;
32 #define BMP_BUFFER_SIZE 1024
34 struct BmpBuffer {
35 byte data[BMP_BUFFER_SIZE];
36 int pos;
37 int read;
38 FILE *file;
39 uint real_pos;
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);
47 #endif /* BMP_H */