source: Daodan/MinGW/include/gdiplus/gdiplusmetaheader.h@ 1163

Last change on this file since 1163 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 3.7 KB
Line 
1/*
2 * gdiplusmetaheader.h
3 *
4 * GDI+ metafile header structure
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Markus Koenig <markus@stber-koenig.de>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23#ifndef __GDIPLUS_METAHEADER_H
24#define __GDIPLUS_METAHEADER_H
25#if __GNUC__ >=3
26#pragma GCC system_header
27#endif
28
29
30/*
31 * FIXME: is 1 the correct value for GDIP_EMFPLUSFLAGS_DISPLAY? This number
32 * has been determined by calling Metafile::GetMetafileHeader() on a EMF+
33 * metafile which was recorded on a display device context (SampleMetafile.emf).
34 */
35#ifdef __cplusplus
36const UINT GDIP_EMFPLUSFLAGS_DISPLAY = 1;
37#else
38#define GDIP_EMFPLUSFLAGS_DISPLAY ((UINT) 1)
39#endif
40
41typedef struct tagENHMETAHEADER3 {
42 DWORD iType;
43 DWORD nSize;
44 RECTL rclBounds;
45 RECTL rclFrame;
46 DWORD dSignature;
47 DWORD nVersion;
48 DWORD nBytes;
49 DWORD nRecords;
50 WORD nHandles;
51 WORD sReserved;
52 DWORD nDescription;
53 DWORD offDescription;
54 DWORD nPalEntries;
55 SIZEL szlDevice;
56 SIZEL szlMillimeters;
57} ENHMETAHEADER3,*LPENHMETAHEADER3;
58
59typedef struct PWMFRect16 {
60 INT16 Left;
61 INT16 Top;
62 INT16 Right;
63 INT16 Bottom;
64} PWMFRect16;
65
66typedef struct WmfPlaceableFileHeader {
67 UINT32 Key;
68 INT16 Hmf;
69 PWMFRect16 BoundingBox;
70 INT16 Inch;
71 UINT32 Reserved;
72 INT16 Checksum;
73} WmfPlaceableFileHeader;
74
75typedef struct MetafileHeader {
76 MetafileType Type;
77 UINT Size;
78 UINT Version;
79 UINT EmfPlusFlags;
80 REAL DpiX;
81 REAL DpiY;
82 INT X;
83 INT Y;
84 INT Width;
85 INT Height;
86 __extension__ union {
87 METAHEADER WmfHeader;
88 ENHMETAHEADER3 EmfHeader;
89 };
90 INT EmfPlusHeaderSize;
91 INT LogicalDpiX;
92 INT LogicalDpiY;
93
94 #ifdef __cplusplus
95 public:
96 void GetBounds(Rect *rect) const
97 {
98 if (rect)
99 {
100 rect->X = X;
101 rect->Y = Y;
102 rect->Width = Width;
103 rect->Height = Height;
104 }
105 }
106 REAL GetDpiX() const
107 {
108 return DpiX;
109 }
110 REAL GetDpiY() const
111 {
112 return DpiY;
113 }
114 const ENHMETAHEADER3* GetEmfHeader() const
115 {
116 if (Type == MetafileTypeEmf
117 || Type == MetafileTypeEmfPlusOnly
118 || Type == MetafileTypeEmfPlusDual)
119 {
120 return &EmfHeader;
121 }
122 else
123 {
124 return NULL;
125 }
126 }
127 UINT GetEmfPlusFlags() const
128 {
129 return EmfPlusFlags;
130 }
131 UINT GetMetafileSize() const
132 {
133 return Size;
134 }
135 MetafileType GetType() const
136 {
137 return Type;
138 }
139 UINT GetVersion() const
140 {
141 return Version;
142 }
143 const METAHEADER* GetWmfHeader() const
144 {
145 if (Type == MetafileTypeWmf || Type == MetafileTypeWmfPlaceable)
146 {
147 return &WmfHeader;
148 }
149 else
150 {
151 return NULL;
152 }
153 }
154 BOOL IsDisplay() const
155 {
156 return EmfPlusFlags == GDIP_EMFPLUSFLAGS_DISPLAY;
157 }
158 BOOL IsEmf() const
159 {
160 return Type == MetafileTypeEmf;
161 }
162 BOOL IsEmfOrEmfPlus() const
163 {
164 return Type == MetafileTypeEmf
165 || Type == MetafileTypeEmfPlusOnly
166 || Type == MetafileTypeEmfPlusDual;
167 }
168 BOOL IsEmfPlus() const
169 {
170 return Type == MetafileTypeEmfPlusOnly
171 || Type == MetafileTypeEmfPlusDual;
172 }
173 BOOL IsEmfPlusDual() const
174 {
175 return Type == MetafileTypeEmfPlusDual;
176 }
177 BOOL IsEmfPlusOnly() const
178 {
179 return Type == MetafileTypeEmfPlusOnly;
180 }
181 BOOL IsWmf() const
182 {
183 return Type == MetafileTypeWmf
184 || Type == MetafileTypeWmfPlaceable;
185 }
186 BOOL IsWmfPlaceable() const
187 {
188 return Type == MetafileTypeWmfPlaceable;
189 }
190 #endif
191} MetafileHeader;
192
193#endif /* __GDIPLUS_METAHEADER_H */
Note: See TracBrowser for help on using the repository browser.