1 | /* $Id: bmp.h 85857 2020-08-21 09:10:49Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Bitmap (BMP) format defines.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef IPRT_INCLUDED_formats_bmp_h
|
---|
28 | #define IPRT_INCLUDED_formats_bmp_h
|
---|
29 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
30 | # pragma once
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include <iprt/types.h>
|
---|
34 | #include <iprt/assertcompile.h>
|
---|
35 |
|
---|
36 | #pragma pack(1)
|
---|
37 |
|
---|
38 | /** BMP File Format Bitmap Header. */
|
---|
39 | typedef struct
|
---|
40 | {
|
---|
41 | /** File Type Identifier. */
|
---|
42 | uint16_t Type;
|
---|
43 | /** Size of File. */
|
---|
44 | uint32_t FileSize;
|
---|
45 | /** Reserved (should be 0). */
|
---|
46 | uint16_t Reserved1;
|
---|
47 | /** Reserved (should be 0). */
|
---|
48 | uint16_t Reserved2;
|
---|
49 | /** Offset to bitmap data. */
|
---|
50 | uint32_t Offset;
|
---|
51 | } BMPINFO;
|
---|
52 | AssertCompileSize(BMPINFO, 14);
|
---|
53 | /** Pointer to a bitmap header. */
|
---|
54 | typedef BMPINFO *PBMPINFO;
|
---|
55 |
|
---|
56 | /** OS/2 1.x Information Header Format. */
|
---|
57 | typedef struct
|
---|
58 | {
|
---|
59 | /** Size of Remaining Header. */
|
---|
60 | uint32_t Size;
|
---|
61 | /** Width of Bitmap in Pixels. */
|
---|
62 | uint16_t Width;
|
---|
63 | /** Height of Bitmap in Pixels. */
|
---|
64 | uint16_t Height;
|
---|
65 | /** Number of Planes. */
|
---|
66 | uint16_t Planes;
|
---|
67 | /** Color Bits Per Pixel. */
|
---|
68 | uint16_t BitCount;
|
---|
69 | } OS2HDR;
|
---|
70 | AssertCompileSize(OS2HDR, 12);
|
---|
71 | /** Pointer to a OS/2 1.x header format. */
|
---|
72 | typedef OS2HDR *POS2HDR;
|
---|
73 |
|
---|
74 | /** OS/2 2.0 Information Header Format. */
|
---|
75 | typedef struct
|
---|
76 | {
|
---|
77 | /** Size of Remaining Header. */
|
---|
78 | uint32_t Size;
|
---|
79 | /** Width of Bitmap in Pixels. */
|
---|
80 | uint32_t Width;
|
---|
81 | /** Height of Bitmap in Pixels. */
|
---|
82 | uint32_t Height;
|
---|
83 | /** Number of Planes. */
|
---|
84 | uint16_t Planes;
|
---|
85 | /** Color Bits Per Pixel. */
|
---|
86 | uint16_t BitCount;
|
---|
87 | /** Compression Scheme (0=none). */
|
---|
88 | uint32_t Compression;
|
---|
89 | /** Size of bitmap in bytes. */
|
---|
90 | uint32_t SizeImage;
|
---|
91 | /** Horz. Resolution in Pixels/Meter. */
|
---|
92 | uint32_t XPelsPerMeter;
|
---|
93 | /** Vert. Resolution in Pixels/Meter. */
|
---|
94 | uint32_t YPelsPerMeter;
|
---|
95 | /** Number of Colors in Color Table. */
|
---|
96 | uint32_t ClrUsed;
|
---|
97 | /** Number of Important Colors. */
|
---|
98 | uint32_t ClrImportant;
|
---|
99 | /** Resolution Measurement Used. */
|
---|
100 | uint16_t Units;
|
---|
101 | /** Reserved Fields (always 0). */
|
---|
102 | uint16_t Reserved;
|
---|
103 | /** Orientation of Bitmap. */
|
---|
104 | uint16_t Recording;
|
---|
105 | /** Halftone Algorithm Used on Image. */
|
---|
106 | uint16_t Rendering;
|
---|
107 | /** Halftone Algorithm Data. */
|
---|
108 | uint32_t Size1;
|
---|
109 | /** Halftone Algorithm Data. */
|
---|
110 | uint32_t Size2;
|
---|
111 | /** Color Table Format (always 0). */
|
---|
112 | uint32_t ColorEncoding;
|
---|
113 | /** Misc. Field for Application Use . */
|
---|
114 | uint32_t Identifier;
|
---|
115 | } OS22HDR;
|
---|
116 | AssertCompileSize(OS22HDR, 64);
|
---|
117 | /** Pointer to a OS/2 2.0 header format . */
|
---|
118 | typedef OS22HDR *POS22HDR;
|
---|
119 |
|
---|
120 | /** Windows 3.x Information Header Format. */
|
---|
121 | typedef struct
|
---|
122 | {
|
---|
123 | /** Size of Remaining Header. */
|
---|
124 | uint32_t Size;
|
---|
125 | /** Width of Bitmap in Pixels. */
|
---|
126 | uint32_t Width;
|
---|
127 | /** Height of Bitmap in Pixels. */
|
---|
128 | uint32_t Height;
|
---|
129 | /** Number of Planes. */
|
---|
130 | uint16_t Planes;
|
---|
131 | /** Bits Per Pixel. */
|
---|
132 | uint16_t BitCount;
|
---|
133 | /** Compression Scheme (0=none). */
|
---|
134 | uint32_t Compression;
|
---|
135 | /** Size of bitmap in bytes. */
|
---|
136 | uint32_t SizeImage;
|
---|
137 | /** Horz. Resolution in Pixels/Meter. */
|
---|
138 | uint32_t XPelsPerMeter;
|
---|
139 | /** Vert. Resolution in Pixels/Meter. */
|
---|
140 | uint32_t YPelsPerMeter;
|
---|
141 | /** Number of Colors in Color Table. */
|
---|
142 | uint32_t ClrUsed;
|
---|
143 | /** Number of Important Colors. */
|
---|
144 | uint32_t ClrImportant;
|
---|
145 | } WINHDR;
|
---|
146 | /** Pointer to a Windows 3.x header format. */
|
---|
147 | typedef WINHDR *PWINHDR;
|
---|
148 |
|
---|
149 | #pragma pack()
|
---|
150 |
|
---|
151 | /** BMP file magic number. */
|
---|
152 | #define BMP_HDR_MAGIC (RT_H2LE_U16_C(0x4d42))
|
---|
153 |
|
---|
154 | /** @name BMP compressions.
|
---|
155 | * @{ . */
|
---|
156 | #define BMP_COMPRESS_NONE 0
|
---|
157 | #define BMP_COMPRESS_RLE8 1
|
---|
158 | #define BMP_COMPRESS_RLE4 2
|
---|
159 | /** @} . */
|
---|
160 |
|
---|
161 | /** @name BMP header sizes.
|
---|
162 | * @{ . */
|
---|
163 | #define BMP_HEADER_OS21 12
|
---|
164 | #define BMP_HEADER_OS22 64
|
---|
165 | #define BMP_HEADER_WIN3 40
|
---|
166 | /** @} . */
|
---|
167 |
|
---|
168 | #endif /* !IPRT_INCLUDED_formats_bmp_h . */
|
---|
169 |
|
---|