ReactOS 0.4.16-dev-321-g63bb46a
gdiplusmetafile.h
Go to the documentation of this file.
1/*
2 * GdiPlusMetaFile.h
3 *
4 * Windows GDI+
5 *
6 * This file is part of the w32api package.
7 *
8 * THIS SOFTWARE IS NOT COPYRIGHTED
9 *
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
12 *
13 * This code is distributed in the hope that it will be useful but
14 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
15 * DISCLAIMED. This includes but is not limited to warranties of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 */
18
19#ifndef _GDIPLUSMETAFILE_H
20#define _GDIPLUSMETAFILE_H
21
22class Metafile : public Image
23{
24 public:
26 {
29 DllExports::GdipRecordMetafile(referenceHdc, type, NULL, MetafileFrameUnitGdi, description, &metafile);
31 }
32
34 {
36 lastStatus = DllExports::GdipCreateMetafileFromFile(filename, &metafile);
38 }
39
41 HDC referenceHdc,
42 const RectF &frameRect,
45 const WCHAR *description = NULL)
46 {
48 lastStatus = DllExports::GdipRecordMetafile(referenceHdc, type, &frameRect, frameUnit, description, &metafile);
50 }
51
52 Metafile(HMETAFILE hWmf, const WmfPlaceableFileHeader *wmfPlaceableFileHeader, BOOL deleteWmf = FALSE)
53 {
55 lastStatus = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf, wmfPlaceableFileHeader, &metafile);
57 }
58
60 const WCHAR *fileName,
61 HDC referenceHdc,
62 const Rect &frameRect,
65 const WCHAR *description = NULL)
66 {
68 lastStatus = DllExports::GdipRecordMetafileFileNameI(
69 fileName, referenceHdc, type, &frameRect, frameUnit, description, &metafile);
71 }
72
75 HDC referenceHdc,
76 const RectF &frameRect,
79 const WCHAR *description = NULL)
80 {
82 lastStatus = DllExports::GdipRecordMetafile(referenceHdc, type, &frameRect, frameUnit, description, &metafile);
84 }
85
87 {
89 lastStatus = DllExports::GdipRecordMetafileStream(
92 }
93
96 HDC referenceHdc,
97 const Rect &frameRect,
100 const WCHAR *description = NULL)
101 {
103 lastStatus = DllExports::GdipRecordMetafileI(referenceHdc, type, &frameRect, frameUnit, description, &metafile);
105 }
106
108 const WCHAR *fileName,
109 HDC referenceHdc,
110 const RectF &frameRect,
113 const WCHAR *description = NULL)
114 {
116 lastStatus = DllExports::GdipRecordMetafileFileName(
117 fileName, referenceHdc, type, &frameRect, frameUnit, description, &metafile);
119 }
120
122 const WCHAR *fileName,
123 HDC referenceHdc,
125 const WCHAR *description = NULL)
126 {
128 lastStatus = DllExports::GdipRecordMetafileFileName(
129 fileName, referenceHdc, type, NULL, MetafileFrameUnitGdi, description, &metafile);
131 }
132
134 {
136 lastStatus = DllExports::GdipCreateMetafileFromStream(stream, &metafile);
138 }
139
140 Metafile(HENHMETAFILE hEmf, BOOL deleteEmf = FALSE)
141 {
143 lastStatus = DllExports::GdipCreateMetafileFromEmf(hEmf, deleteEmf, &metafile);
145 }
146
148 HDC referenceHdc,
149 const Rect &frameRect,
152 const WCHAR *description = NULL)
153 {
155 lastStatus = DllExports::GdipRecordMetafileI(referenceHdc, type, &frameRect, frameUnit, description, &metafile);
157 }
158
159 static UINT
161 HENHMETAFILE hemf,
162 UINT cbData16,
163 LPBYTE pData16,
164 INT iMapMode = MM_ANISOTROPIC,
166 {
167 return DllExports::GdipEmfToWmfBits(hemf, cbData16, pData16, iMapMode, eFlags);
168 }
169
170 UINT
172 {
173#if 1
174 return 0; // FIXME
175#else
176 UINT metafileRasterizationLimitDpi = 0;
177 SetStatus(DllExports::GdipGetMetafileDownLevelRasterizationLimit(
178 GetNativeMetafile(), &metafileRasterizationLimitDpi));
179 return metafileRasterizationLimitDpi;
180#endif
181 }
182
183 HENHMETAFILE
185 {
186 HENHMETAFILE hEmf;
187 SetStatus(DllExports::GdipGetHemfFromMetafile(GetNativeMetafile(), &hEmf));
188 return hEmf;
189 }
190
191 static Status
193 {
194 return DllExports::GdipGetMetafileHeaderFromFile(filename, header);
195 }
196
197 static Status
199 {
200 return DllExports::GdipGetMetafileHeaderFromEmf(hEmf, header);
201 }
202
203 static Status
204 GetMetafileHeader(HMETAFILE hWmf, const WmfPlaceableFileHeader *wmfPlaceableFileHeader, MetafileHeader *header)
205 {
206 return DllExports::GdipGetMetafileHeaderFromWmf(hWmf, wmfPlaceableFileHeader, header);
207 }
208
209 Status
211 {
212 return SetStatus(DllExports::GdipGetMetafileHeaderFromMetafile(GetNativeMetafile(), header));
213 }
214
215 static Status
217 {
218 return DllExports::GdipGetMetafileHeaderFromStream(stream, header);
219 }
220
221 Status
223 {
224 return SetStatus(DllExports::GdipPlayMetafileRecord(GetNativeMetafile(), recordType, flags, dataSize, data));
225 }
226
227 Status
228 SetDownLevelRasterizationLimit(UINT metafileRasterizationLimitDpi)
229 {
230 return SetStatus(
231 DllExports::GdipSetMetafileDownLevelRasterizationLimit(GetNativeMetafile(), metafileRasterizationLimitDpi));
232 }
233
234 protected:
235 GpMetafile *
237 {
238 return static_cast<GpMetafile *>(nativeImage);
239 }
240
241 // get native
242 friend inline GpMetafile *&
244 {
245 return reinterpret_cast<GpMetafile *&>(const_cast<Metafile *>(metafile)->nativeImage);
246 }
247};
248
249#endif /* _GDIPLUSMETAFILE_H */
void SetNativeImage(GpImage *image)
Status lastStatus
Status SetStatus(Status status) const
GpImage * nativeImage
Status GetMetafileHeader(MetafileHeader *header) const
static Status GetMetafileHeader(HENHMETAFILE hEmf, MetafileHeader *header)
HENHMETAFILE GetHENHMETAFILE() const
Status PlayRecord(EmfPlusRecordType recordType, UINT flags, UINT dataSize, const BYTE *data)
Metafile(const WCHAR *filename)
Metafile(HDC referenceHdc, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(const WCHAR *fileName, HDC referenceHdc, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(IStream *stream, HDC referenceHdc, const Rect &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
GpMetafile * GetNativeMetafile() const
static Status GetMetafileHeader(HMETAFILE hWmf, const WmfPlaceableFileHeader *wmfPlaceableFileHeader, MetafileHeader *header)
static Status GetMetafileHeader(IStream *stream, MetafileHeader *header)
Status SetDownLevelRasterizationLimit(UINT metafileRasterizationLimitDpi)
Metafile(HENHMETAFILE hEmf, BOOL deleteEmf=FALSE)
Metafile(IStream *stream, HDC referenceHdc, const RectF &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(HDC referenceHdc, const Rect &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(IStream *stream)
UINT GetDownLevelRasterizationLimit() const
static Status GetMetafileHeader(const WCHAR *filename, MetafileHeader *header)
Metafile(HMETAFILE hWmf, const WmfPlaceableFileHeader *wmfPlaceableFileHeader, BOOL deleteWmf=FALSE)
Metafile(const WCHAR *fileName, HDC referenceHdc, const Rect &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(const WCHAR *fileName, HDC referenceHdc, const RectF &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(HDC referenceHdc, const RectF &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
static UINT EmfToWmfBits(HENHMETAFILE hemf, UINT cbData16, LPBYTE pData16, INT iMapMode=MM_ANISOTROPIC, EmfToWmfBitsFlags eFlags=EmfToWmfBitsFlagsDefault)
Metafile(IStream *stream, HDC referenceHdc, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
friend GpMetafile *& getNat(const Metafile *metafile)
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
EmfPlusRecordType
Definition: gdiplusenums.h:455
EmfType
Definition: gdiplusenums.h:233
@ EmfTypeEmfPlusDual
Definition: gdiplusenums.h:236
EmfToWmfBitsFlags
Definition: gdiplusenums.h:240
@ EmfToWmfBitsFlagsDefault
Definition: gdiplusenums.h:241
MetafileFrameUnit
Definition: gdiplusenums.h:380
@ MetafileFrameUnitGdi
Definition: gdiplusenums.h:386
Status
Definition: gdiplustypes.h:25
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei dataSize
Definition: glext.h:11123
const char * filename
Definition: ioapi.h:137
static HDC
Definition: imagelist.c:88
static const unsigned char metafile[]
Definition: olepicture.c:138
unsigned int UINT
Definition: ndis.h:50
Definition: parse.h:23
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
const char * description
Definition: directx.c:2497
#define MM_ANISOTROPIC
Definition: wingdi.h:867
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193