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 <ae@cy.md> 12 */ 13 14 module ae.utils.graphics.bitmap; 15 16 /// Additional definitions for types used in the BMP header. 17 version (all) 18 { 19 alias int FXPT2DOT30; 20 struct CIEXYZ { FXPT2DOT30 ciexyzX, /***/ ciexyzY, /***/ ciexyzZ; /***/ } 21 struct CIEXYZTRIPLE { CIEXYZ ciexyzRed, /***/ciexyzGreen, /***/ciexyzBlue; /***/ } 22 enum { BI_BITFIELDS = 3 /***/ } 23 } 24 25 /// Instantiates to a struct representing 26 /// a BMP header at the given version. 27 align(1) 28 struct BitmapHeader(uint V) 29 { 30 enum VERSION = V; /// 31 32 align(1): 33 /// BITMAPFILEHEADER 34 version (all) 35 { 36 char[2] bfType = "BM"; 37 uint bfSize; 38 ushort bfReserved1; 39 ushort bfReserved2; 40 uint bfOffBits; 41 } 42 43 /// BITMAPCOREINFO 44 version (all) 45 { 46 uint bcSize = this.sizeof - bcSize.offsetof; 47 int bcWidth; 48 int bcHeight; 49 ushort bcPlanes; 50 ushort bcBitCount; 51 uint biCompression; 52 uint biSizeImage; 53 uint biXPelsPerMeter; 54 uint biYPelsPerMeter; 55 uint biClrUsed; 56 uint biClrImportant; 57 } 58 59 /// BITMAPV4HEADER 60 static if (V>=4) 61 { 62 uint bV4RedMask; 63 uint bV4GreenMask; 64 uint bV4BlueMask; 65 uint bV4AlphaMask; 66 uint bV4CSType; 67 CIEXYZTRIPLE bV4Endpoints; 68 uint bV4GammaRed; 69 uint bV4GammaGreen; 70 uint bV4GammaBlue; 71 } 72 73 /// BITMAPV5HEADER 74 static if (V>=5) 75 { 76 uint bV5Intent; 77 uint bV5ProfileData; 78 uint bV5ProfileSize; 79 uint bV5Reserved; 80 } 81 }