1 /**
2  * Windows Bitmap definitions.
3  *
4  * License:
5  *   This Source Code Form is subject to the terms of
6  *   the Mozilla Public License, v. 2.0. If a copy of
7  *   the MPL was not distributed with this file, You
8  *   can obtain one at http://mozilla.org/MPL/2.0/.
9  *
10  * Authors:
11  *   Vladimir Panteleev <vladimir@thecybershadow.net>
12  */
13 
14 module ae.utils.graphics.bitmap;
15 
16 alias int FXPT2DOT30;
17 struct CIEXYZ { FXPT2DOT30 ciexyzX, ciexyzY, ciexyzZ; }
18 struct CIEXYZTRIPLE { CIEXYZ ciexyzRed, ciexyzGreen, ciexyzBlue; }
19 enum { BI_BITFIELDS = 3 }
20 
21 align(1)
22 struct BitmapHeader(uint V)
23 {
24 	enum VERSION = V;
25 
26 align(1):
27 	// BITMAPFILEHEADER
28 	char[2] bfType = "BM";
29 	uint    bfSize;
30 	ushort  bfReserved1;
31 	ushort  bfReserved2;
32 	uint    bfOffBits;
33 
34 	// BITMAPCOREINFO
35 	uint   bcSize = this.sizeof - bcSize.offsetof;
36 	int    bcWidth;
37 	int    bcHeight;
38 	ushort bcPlanes;
39 	ushort bcBitCount;
40 	uint   biCompression;
41 	uint   biSizeImage;
42 	uint   biXPelsPerMeter;
43 	uint   biYPelsPerMeter;
44 	uint   biClrUsed;
45 	uint   biClrImportant;
46 
47 	// BITMAPV4HEADER
48 	static if (V>=4)
49 	{
50 		uint         bV4RedMask;
51 		uint         bV4GreenMask;
52 		uint         bV4BlueMask;
53 		uint         bV4AlphaMask;
54 		uint         bV4CSType;
55 		CIEXYZTRIPLE bV4Endpoints;
56 		uint         bV4GammaRed;
57 		uint         bV4GammaGreen;
58 		uint         bV4GammaBlue;
59 	}
60 
61 	// BITMAPV5HEADER
62 	static if (V>=5)
63 	{
64 		uint        bV5Intent;
65 		uint        bV5ProfileData;
66 		uint        bV5ProfileSize;
67 		uint        bV5Reserved;
68 	}
69 }