1/*
2 * LegacyClonk
3 *
4 * Copyright (c) 1998-2000, Matthes Bender (RedWolf Design)
5 * Copyright (c) 2017-2019, The LegacyClonk Team and contributors
6 *
7 * Distributed under the terms of the ISC license; see accompanying file
8 * "COPYING" for details.
9 *
10 * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11 * See accompanying file "TRADEMARK" for details.
12 *
13 * To redistribute this file separately, substitute the full license texts
14 * for the above references.
15 */
16
17/* A structure for handling 256-color bitmap files */
18
19#pragma once
20
21#ifdef _WIN32
22
23#include "C4Windows.h"
24
25#else
26
27#pragma pack(push, 2)
28typedef struct tagBITMAPFILEHEADER
29{
30 uint16_t bfType;
31 uint32_t bfSize;
32 uint16_t bfReserved1;
33 uint16_t bfReserved2;
34 uint32_t bfOffBits;
35} BITMAPFILEHEADER, *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;
36#pragma pack(pop)
37
38typedef struct tagBITMAPINFOHEADER
39{
40 uint32_t biSize;
41 int32_t biWidth;
42 int32_t biHeight;
43 uint16_t biPlanes;
44 uint16_t biBitCount;
45 uint32_t biCompression;
46 uint32_t biSizeImage;
47 int32_t biXPelsPerMeter;
48 int32_t biYPelsPerMeter;
49 uint32_t biClrUsed;
50 uint32_t biClrImportant;
51} BITMAPINFOHEADER, *LPBITMAPINFOHEADER, *PBITMAPINFOHEADER;
52
53typedef struct tagRGBQUAD
54{
55 uint8_t rgbBlue;
56 uint8_t rgbGreen;
57 uint8_t rgbRed;
58 uint8_t rgbReserved;
59} RGBQUAD, *LPRGBQUAD;
60
61#endif
62
63#pragma pack(push, def_pack, 1)
64
65class CBitmapInfo
66{
67public:
68 CBitmapInfo();
69 void Default();
70
71public:
72 BITMAPFILEHEADER Head;
73 BITMAPINFOHEADER Info;
74
75 int FileBitsOffset();
76};
77
78class CBitmap256Info : public CBitmapInfo
79{
80public:
81 CBitmap256Info();
82 RGBQUAD Colors[256];
83
84public:
85 void Default();
86 void Set(int iWdt, int iHgt, uint8_t *bypPalette);
87
88 int FileBitsOffset();
89};
90
91#pragma pack(pop, def_pack)
92