OpenTTD Source  20240919-master-gdf0233f4c2
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 */
BmpInfo::height
uint32_t height
bitmap height
Definition: bmp.h:19
BmpInfo
Definition: bmp.h:16
BmpInfo::bpp
uint16_t bpp
bits per pixel
Definition: bmp.h:21
random_access_file_type.h
BmpInfo::offset
size_t offset
offset of bitmap data from .bmp file beginning
Definition: bmp.h:17
BmpInfo::palette_size
uint32_t palette_size
number of colours in palette
Definition: bmp.h:23
BmpInfo::os2_bmp
bool os2_bmp
true if OS/2 1.x or windows 2.x bitmap
Definition: bmp.h:20
BmpData
Definition: bmp.h:26
gfx_type.h
BmpInfo::width
uint32_t width
bitmap width
Definition: bmp.h:18
BmpInfo::compression
uint32_t compression
compression method (0 = none, 1 = 8-bit RLE, 2 = 4-bit RLE)
Definition: bmp.h:22
RandomAccessFile
A file from which bytes, words and double words are read in (potentially) a random order.
Definition: random_access_file_type.h:22