OpenTTD Source  20241120-master-g6d3adc6169
bmp.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * 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.
4  * 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.
5  * 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/>.
6  */
7 
10 #ifndef BMP_H
11 #define BMP_H
12 
13 #include "gfx_type.h"
15 
16 struct BmpInfo {
17  size_t offset;
18  uint32_t width;
19  uint32_t height;
20  bool os2_bmp;
21  uint16_t bpp;
22  uint32_t compression;
23  uint32_t palette_size;
24 };
25 
26 struct BmpData {
27  std::vector<Colour> palette;
28  std::vector<uint8_t> bitmap;
29 };
30 
31 bool BmpReadHeader(RandomAccessFile &file, BmpInfo &info, BmpData &data);
32 bool BmpReadBitmap(RandomAccessFile &file, BmpInfo &info, BmpData &data);
33 
34 #endif /* BMP_H */
A file from which bytes, words and double words are read in (potentially) a random order.
Types related to the graphics and/or input devices.
Class related to random access to files.
Definition: bmp.h:26
Definition: bmp.h:16
uint32_t height
bitmap height
Definition: bmp.h:19
uint32_t width
bitmap width
Definition: bmp.h:18
uint32_t compression
compression method (0 = none, 1 = 8-bit RLE, 2 = 4-bit RLE)
Definition: bmp.h:22
uint32_t palette_size
number of colours in palette
Definition: bmp.h:23
uint16_t bpp
bits per pixel
Definition: bmp.h:21
size_t offset
offset of bitmap data from .bmp file beginning
Definition: bmp.h:17
bool os2_bmp
true if OS/2 1.x or windows 2.x bitmap
Definition: bmp.h:20