Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gdiplusmetaheader.h « gdiplus « include « w32api « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 84cdd3272ff9bd7648dfa858be962355435b1230 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*
 * gdiplusmetaheader.h
 *
 * GDI+ metafile header structure
 *
 * This file is part of the w32api package.
 *
 * Contributors:
 *   Created by Markus Koenig <markus@stber-koenig.de>
 *
 * THIS SOFTWARE IS NOT COPYRIGHTED
 *
 * This source code is offered for use in the public domain. You may
 * use, modify or distribute it freely.
 *
 * This code is distributed in the hope that it will be useful but
 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
 * DISCLAIMED. This includes but is not limited to warranties of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 */

#ifndef __GDIPLUS_METAHEADER_H
#define __GDIPLUS_METAHEADER_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif


/*
 * FIXME: is 1 the correct value for GDIP_EMFPLUSFLAGS_DISPLAY? This number
 * has been determined by calling Metafile::GetMetafileHeader() on a EMF+
 * metafile which was recorded on a display device context (SampleMetafile.emf).
 */
#ifdef __cplusplus
const UINT GDIP_EMFPLUSFLAGS_DISPLAY = 1;
#else
#define GDIP_EMFPLUSFLAGS_DISPLAY ((UINT) 1)
#endif

typedef struct tagENHMETAHEADER3 {
	DWORD iType;
	DWORD nSize;
	RECTL rclBounds;
	RECTL rclFrame;
	DWORD dSignature;
	DWORD nVersion;
	DWORD nBytes;
	DWORD nRecords;
	WORD nHandles;
	WORD sReserved;
	DWORD nDescription;
	DWORD offDescription;
	DWORD nPalEntries;
	SIZEL szlDevice;
	SIZEL szlMillimeters;
} ENHMETAHEADER3,*LPENHMETAHEADER3;

typedef struct PWMFRect16 {
	INT16 Left;
	INT16 Top;
	INT16 Right;
	INT16 Bottom;
} PWMFRect16;

typedef struct WmfPlaceableFileHeader {
	UINT32 Key;
	INT16 Hmf;
	PWMFRect16 BoundingBox;
	INT16 Inch;
	UINT32 Reserved;
	INT16 Checksum;
} WmfPlaceableFileHeader;

typedef struct MetafileHeader {
	MetafileType Type;
	UINT Size;
	UINT Version;
	UINT EmfPlusFlags;
	REAL DpiX;
	REAL DpiY;
	INT X;
	INT Y;
	INT Width;
	INT Height;
	__extension__ union {
		METAHEADER WmfHeader;
		ENHMETAHEADER3 EmfHeader;
	};
	INT EmfPlusHeaderSize;
	INT LogicalDpiX;
	INT LogicalDpiY;

	#ifdef __cplusplus
	public:
	void GetBounds(Rect *rect) const
	{
		if (rect)
		{
			rect->X = X;
			rect->Y = Y;
			rect->Width = Width;
			rect->Height = Height;
		}
	}
	REAL GetDpiX() const
	{
		return DpiX;
	}
	REAL GetDpiY() const
	{
		return DpiY;
	}
	const ENHMETAHEADER3* GetEmfHeader() const
	{
		if (Type == MetafileTypeEmf
				|| Type == MetafileTypeEmfPlusOnly
				|| Type == MetafileTypeEmfPlusDual)
		{
			return &EmfHeader;
		}
		else
		{
			return NULL;
		}
	}
	UINT GetEmfPlusFlags() const
	{
		return EmfPlusFlags;
	}
	UINT GetMetafileSize() const
	{
		return Size;
	}
	MetafileType GetType() const
	{
		return Type;
	}
	UINT GetVersion() const
	{
		return Version;
	}
	const METAHEADER* GetWmfHeader() const
	{
		if (Type == MetafileTypeWmf || Type == MetafileTypeWmfPlaceable)
		{
			return &WmfHeader;
		}
		else
		{
			return NULL;
		}
	}
	BOOL IsDisplay() const
	{
		return EmfPlusFlags == GDIP_EMFPLUSFLAGS_DISPLAY;
	}
	BOOL IsEmf() const
	{
		return Type == MetafileTypeEmf;
	}
	BOOL IsEmfOrEmfPlus() const
	{
		return Type == MetafileTypeEmf
			|| Type == MetafileTypeEmfPlusOnly
			|| Type == MetafileTypeEmfPlusDual;
	}
	BOOL IsEmfPlus() const
	{
		return Type == MetafileTypeEmfPlusOnly
			|| Type == MetafileTypeEmfPlusDual;
	}
	BOOL IsEmfPlusDual() const
	{
		return Type == MetafileTypeEmfPlusDual;
	}
	BOOL IsEmfPlusOnly() const
	{
		return Type == MetafileTypeEmfPlusOnly;
	}
	BOOL IsWmf() const
	{
		return Type == MetafileTypeWmf
			|| Type == MetafileTypeWmfPlaceable;
	}
	BOOL IsWmfPlaceable() const
	{
		return Type == MetafileTypeWmfPlaceable;
	}
	#endif
} MetafileHeader;

#endif /* __GDIPLUS_METAHEADER_H */