| 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) |
| 28 | typedef struct |
| 29 | { |
| 30 | uint16_t ; |
| 31 | uint32_t ; |
| 32 | uint16_t ; |
| 33 | uint16_t ; |
| 34 | uint32_t ; |
| 35 | } , *, *; |
| 36 | #pragma pack(pop) |
| 37 | |
| 38 | typedef struct |
| 39 | { |
| 40 | uint32_t ; |
| 41 | int32_t ; |
| 42 | int32_t ; |
| 43 | uint16_t ; |
| 44 | uint16_t ; |
| 45 | uint32_t ; |
| 46 | uint32_t ; |
| 47 | int32_t ; |
| 48 | int32_t ; |
| 49 | uint32_t ; |
| 50 | uint32_t ; |
| 51 | } , *, *; |
| 52 | |
| 53 | typedef 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 | |
| 65 | class CBitmapInfo |
| 66 | { |
| 67 | public: |
| 68 | CBitmapInfo(); |
| 69 | void Default(); |
| 70 | |
| 71 | public: |
| 72 | BITMAPFILEHEADER Head; |
| 73 | BITMAPINFOHEADER Info; |
| 74 | |
| 75 | int FileBitsOffset(); |
| 76 | }; |
| 77 | |
| 78 | class CBitmap256Info : public CBitmapInfo |
| 79 | { |
| 80 | public: |
| 81 | CBitmap256Info(); |
| 82 | RGBQUAD Colors[256]; |
| 83 | |
| 84 | public: |
| 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 | |