ReactOS  0.4.15-dev-1150-g593bcce
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 
22 class Metafile : public Image
23 {
24  public:
26  {
28  lastStatus =
31  }
32 
34  {
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  {
69  fileName, referenceHdc, type, &frameRect, frameUnit, description, &metafile);
71  }
72 
74  IStream *stream,
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  {
92  }
93 
95  IStream *stream,
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  {
117  fileName, referenceHdc, type, &frameRect, frameUnit, description, &metafile);
119  }
120 
122  const WCHAR *fileName,
123  HDC referenceHdc,
125  const WCHAR *description = NULL)
126  {
129  fileName, referenceHdc, type, NULL, MetafileFrameUnitGdi, description, &metafile);
131  }
132 
134  {
138  }
139 
140  Metafile(HENHMETAFILE hEmf, BOOL deleteEmf = FALSE)
141  {
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;
188  return hEmf;
189  }
190 
191  static Status
193  {
195  }
196 
197  static Status
199  {
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  {
213  }
214 
215  static Status
217  {
219  }
220 
221  Status
223  {
225  }
226 
227  Status
228  SetDownLevelRasterizationLimit(UINT metafileRasterizationLimitDpi)
229  {
230  return SetStatus(
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 */
GpStatus WINGDIPAPI GdipRecordMetafileI(HDC hdc, EmfType type, GDIPCONST GpRect *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
Definition: metafile.c:842
UINT GetDownLevelRasterizationLimit() const
static Status GetMetafileHeader(IStream *stream, MetafileHeader *header)
Metafile(IStream *stream, HDC referenceHdc, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf, MetafileHeader *header)
Definition: metafile.c:3688
static HDC
Definition: imagelist.c:92
GpStatus WINGDIPAPI GdipEmfToWmfBits(HENHMETAFILE hemf, UINT cbData16, LPBYTE pData16, INT iMapMode, INT eFlags)
Definition: metafile.c:3986
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GpStatus WINGDIPAPI GdipGetHemfFromMetafile(GpMetafile *metafile, HENHMETAFILE *hEmf)
Definition: metafile.c:1613
GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream *stream, GpMetafile **metafile)
Definition: metafile.c:3936
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename, MetafileHeader *header)
Definition: metafile.c:3764
MetafileFrameUnit
Definition: gdiplusenums.h:379
const char * description
Definition: directx.c:2497
Metafile(HDC referenceHdc, const Rect &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
const char * filename
Definition: ioapi.h:135
int32_t INT
Definition: typedefs.h:58
GpImage * nativeImage
GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
Definition: metafile.c:735
static const unsigned char metafile[]
Definition: olepicture.c:138
EmfPlusRecordType
Definition: gdiplusenums.h:454
Metafile(IStream *stream, HDC referenceHdc, const Rect &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromWmf(HMETAFILE hwmf, GDIPCONST WmfPlaceableFileHeader *placeable, MetafileHeader *header)
Definition: metafile.c:3747
Metafile(const WCHAR *filename)
static UINT EmfToWmfBits(HENHMETAFILE hemf, UINT cbData16, LPBYTE pData16, INT iMapMode=MM_ANISOTROPIC, EmfToWmfBitsFlags eFlags=EmfToWmfBitsFlagsDefault)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
friend GpMetafile *& getNat(const Metafile *metafile)
GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete, GpMetafile **metafile)
Definition: metafile.c:3804
GpStatus WINGDIPAPI GdipRecordMetafileStream(IStream *stream, HDC hdc, EmfType type, GDIPCONST GpRectF *frameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
Definition: metafile.c:863
smooth NULL
Definition: ftsmooth.c:416
Status GetMetafileHeader(MetafileHeader *header) const
Status lastStatus
void SetNativeImage(GpImage *image)
static Status GetMetafileHeader(HENHMETAFILE hEmf, MetafileHeader *header)
Metafile(const WCHAR *fileName, HDC referenceHdc, const RectF &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(const WCHAR *fileName, HDC referenceHdc, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile, UINT limitDpi)
Definition: metafile.c:3956
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream, MetafileHeader *header)
Definition: metafile.c:3784
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile *metafile, MetafileHeader *header)
Definition: metafile.c:3632
Metafile(HDC referenceHdc, const RectF &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(HMETAFILE hWmf, const WmfPlaceableFileHeader *wmfPlaceableFileHeader, BOOL deleteWmf=FALSE)
__wchar_t WCHAR
Definition: xmlstorage.h:180
GpStatus WINGDIPAPI GdipCreateMetafileFromFile(GDIPCONST WCHAR *file, GpMetafile **metafile)
Definition: metafile.c:3915
Metafile(HENHMETAFILE hEmf, BOOL deleteEmf=FALSE)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
Status
Definition: gdiplustypes.h:24
Definition: parse.h:22
#define MM_ANISOTROPIC
Definition: wingdi.h:866
GpStatus WINGDIPAPI GdipRecordMetafileFileName(GDIPCONST WCHAR *fileName, HDC hdc, EmfType type, GDIPCONST GpRectF *pFrameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
Definition: metafile.c:3993
unsigned char BYTE
Definition: xxhash.c:193
Metafile(const WCHAR *fileName, HDC referenceHdc, const Rect &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
Metafile(IStream *stream)
Status SetDownLevelRasterizationLimit(UINT metafileRasterizationLimitDpi)
GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, GDIPCONST WmfPlaceableFileHeader *placeable, GpMetafile **metafile)
Definition: metafile.c:3845
Status SetStatus(Status status) const
Status PlayRecord(EmfPlusRecordType recordType, UINT flags, UINT dataSize, const BYTE *data)
unsigned int UINT
Definition: ndis.h:50
EmfType
Definition: gdiplusenums.h:232
static Status GetMetafileHeader(HMETAFILE hWmf, const WmfPlaceableFileHeader *wmfPlaceableFileHeader, MetafileHeader *header)
GLenum GLsizei dataSize
Definition: glext.h:11123
HENHMETAFILE GetHENHMETAFILE() const
static Status GetMetafileHeader(const WCHAR *filename, MetafileHeader *header)
EmfToWmfBitsFlags
Definition: gdiplusenums.h:239
Metafile(IStream *stream, HDC referenceHdc, const RectF &frameRect, MetafileFrameUnit frameUnit=MetafileFrameUnitGdi, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)
GpStatus WINGDIPAPI GdipRecordMetafileFileNameI(GDIPCONST WCHAR *fileName, HDC hdc, EmfType type, GDIPCONST GpRect *pFrameRect, MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
Definition: metafile.c:4004
GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, EmfPlusRecordType recordType, UINT flags, UINT dataSize, GDIPCONST BYTE *data)
Definition: metafile.c:2461
GpMetafile * GetNativeMetafile() const
Metafile(HDC referenceHdc, EmfType type=EmfTypeEmfPlusDual, const WCHAR *description=NULL)