https://git.reactos.org/?p=reactos.git;a=commitdiff;h=91f3c8f81aeaae573852b…
commit 91f3c8f81aeaae573852b7d5ea298c3d623deb0d
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jan 1 17:06:34 2020 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jan 1 17:06:34 2020 +0900
[SDK][INCLUDE] Improve gdiplusmetafile.h (#2221)
CORE-16585
---
sdk/include/psdk/gdiplusmetafile.h | 151 ++++++++++++++++++++++++++++---------
1 file changed, 114 insertions(+), 37 deletions(-)
diff --git a/sdk/include/psdk/gdiplusmetafile.h b/sdk/include/psdk/gdiplusmetafile.h
index cc59e23abf6..ca9336281b9 100644
--- a/sdk/include/psdk/gdiplusmetafile.h
+++ b/sdk/include/psdk/gdiplusmetafile.h
@@ -22,148 +22,225 @@
class Metafile : public Image
{
public:
- Metafile(HDC referenceHdc, EmfType type, const WCHAR *description)
+ Metafile(HDC referenceHdc, EmfType type = EmfTypeEmfPlusDual, const WCHAR
*description = NULL)
{
+ GpMetafile *metafile = NULL;
+ lastStatus =
+ DllExports::GdipRecordMetafile(referenceHdc, type, NULL,
MetafileFrameUnitGdi, description, &metafile);
+ SetNativeImage(metafile);
}
Metafile(const WCHAR *filename)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipCreateMetafileFromFile(filename, &metafile);
+ SetNativeImage(metafile);
}
Metafile(
HDC referenceHdc,
const RectF &frameRect,
- MetafileFrameUnit frameUnit,
- EmfType type,
- const WCHAR *description)
+ MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
+ EmfType type = EmfTypeEmfPlusDual,
+ const WCHAR *description = NULL)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipRecordMetafile(referenceHdc, type, &frameRect,
frameUnit, description, &metafile);
+ SetNativeImage(metafile);
}
- Metafile(HMETAFILE hWmf, const WmfPlaceableFileHeader *wmfPlaceableFileHeader, BOOL
deleteWmf)
+ Metafile(HMETAFILE hWmf, const WmfPlaceableFileHeader *wmfPlaceableFileHeader, BOOL
deleteWmf = FALSE)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf,
wmfPlaceableFileHeader, &metafile);
+ SetNativeImage(metafile);
}
Metafile(
const WCHAR *fileName,
HDC referenceHdc,
const Rect &frameRect,
- MetafileFrameUnit frameUnit,
- EmfType type,
- const WCHAR *description)
+ MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
+ EmfType type = EmfTypeEmfPlusDual,
+ const WCHAR *description = NULL)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipRecordMetafileFileNameI(
+ fileName, referenceHdc, type, &frameRect, frameUnit, description,
&metafile);
+ SetNativeImage(metafile);
}
Metafile(
IStream *stream,
HDC referenceHdc,
const RectF &frameRect,
- MetafileFrameUnit frameUnit,
- EmfType type,
- const WCHAR *description)
+ MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
+ EmfType type = EmfTypeEmfPlusDual,
+ const WCHAR *description = NULL)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipRecordMetafile(referenceHdc, type, &frameRect,
frameUnit, description, &metafile);
+ SetNativeImage(metafile);
}
- Metafile(IStream *stream, HDC referenceHdc, EmfType type, const WCHAR *description)
+ Metafile(IStream *stream, HDC referenceHdc, EmfType type = EmfTypeEmfPlusDual, const
WCHAR *description = NULL)
{
+#if 1
+ // FIXME
+ SetNativeImage(NULL);
+#else
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipRecordMetafileStream(
+ stream, referenceHdc, type, NULL, MetafileFrameUnitGdi, description,
&metafile);
+ SetNativeImage(metafile);
+#endif
}
Metafile(
IStream *stream,
HDC referenceHdc,
const Rect &frameRect,
- MetafileFrameUnit frameUnit,
- EmfType type,
- const WCHAR *description)
+ MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
+ EmfType type = EmfTypeEmfPlusDual,
+ const WCHAR *description = NULL)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipRecordMetafileI(referenceHdc, type, &frameRect,
frameUnit, description, &metafile);
+ SetNativeImage(metafile);
}
Metafile(
const WCHAR *fileName,
HDC referenceHdc,
const RectF &frameRect,
- MetafileFrameUnit frameUnit,
- EmfType type,
- const WCHAR *description)
+ MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
+ EmfType type = EmfTypeEmfPlusDual,
+ const WCHAR *description = NULL)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipRecordMetafileFileName(
+ fileName, referenceHdc, type, &frameRect, frameUnit, description,
&metafile);
+ SetNativeImage(metafile);
}
- Metafile(const WCHAR *fileName, HDC referenceHdc, EmfType type, const WCHAR
*description)
+ Metafile(
+ const WCHAR *fileName,
+ HDC referenceHdc,
+ EmfType type = EmfTypeEmfPlusDual,
+ const WCHAR *description = NULL)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipRecordMetafileFileName(
+ fileName, referenceHdc, type, NULL, MetafileFrameUnitGdi, description,
&metafile);
+ SetNativeImage(metafile);
}
Metafile(IStream *stream)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipCreateMetafileFromStream(stream, &metafile);
+ SetNativeImage(metafile);
}
- Metafile(HENHMETAFILE hEmf, BOOL deleteEmf)
+ Metafile(HENHMETAFILE hEmf, BOOL deleteEmf = FALSE)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipCreateMetafileFromEmf(hEmf, deleteEmf,
&metafile);
+ SetNativeImage(metafile);
}
Metafile(
HDC referenceHdc,
const Rect &frameRect,
- MetafileFrameUnit frameUnit,
- EmfType type,
- const WCHAR *description)
+ MetafileFrameUnit frameUnit = MetafileFrameUnitGdi,
+ EmfType type = EmfTypeEmfPlusDual,
+ const WCHAR *description = NULL)
{
+ GpMetafile *metafile = NULL;
+ lastStatus = DllExports::GdipRecordMetafileI(referenceHdc, type, &frameRect,
frameUnit, description, &metafile);
+ SetNativeImage(metafile);
}
static UINT
- EmfToWmfBits(HENHMETAFILE hemf, UINT cbData16, LPBYTE pData16, INT iMapMode,
EmfToWmfBitsFlags eFlags)
+ EmfToWmfBits(
+ HENHMETAFILE hemf,
+ UINT cbData16,
+ LPBYTE pData16,
+ INT iMapMode = MM_ANISOTROPIC,
+ EmfToWmfBitsFlags eFlags = EmfToWmfBitsFlagsDefault)
{
- return 0;
+ return DllExports::GdipEmfToWmfBits(hemf, cbData16, pData16, iMapMode, eFlags);
}
- UINT GetDownLevelRasterizationLimit(VOID)
+ UINT
+ GetDownLevelRasterizationLimit() const
{
- return 0;
+#if 1
+ return 0; // FIXME
+#else
+ UINT metafileRasterizationLimitDpi = 0;
+ SetStatus(DllExports::GdipGetMetafileDownLevelRasterizationLimit(
+ GetNativeMetafile(), &metafileRasterizationLimitDpi));
+ return metafileRasterizationLimitDpi;
+#endif
}
- HENHMETAFILE GetHENHMETAFILE(VOID)
+ HENHMETAFILE
+ GetHENHMETAFILE() const
{
- return NULL;
+ HENHMETAFILE hEmf;
+ SetStatus(DllExports::GdipGetHemfFromMetafile(GetNativeMetafile(), &hEmf));
+ return hEmf;
}
static Status
GetMetafileHeader(const WCHAR *filename, MetafileHeader *header)
{
- return NotImplemented;
+ return DllExports::GdipGetMetafileHeaderFromFile(filename, header);
}
static Status
- GetMetafileHeader(HENHMETAFILE *hEmf, MetafileHeader *header)
+ GetMetafileHeader(HENHMETAFILE hEmf, MetafileHeader *header)
{
- return NotImplemented;
+ return DllExports::GdipGetMetafileHeaderFromEmf(hEmf, header);
}
static Status
GetMetafileHeader(HMETAFILE hWmf, const WmfPlaceableFileHeader
*wmfPlaceableFileHeader, MetafileHeader *header)
{
- return NotImplemented;
+ return DllExports::GdipGetMetafileHeaderFromWmf(hWmf, wmfPlaceableFileHeader,
header);
}
Status
GetMetafileHeader(MetafileHeader *header) const
{
- return NotImplemented;
+ return
SetStatus(DllExports::GdipGetMetafileHeaderFromMetafile(GetNativeMetafile(), header));
}
static Status
GetMetafileHeader(IStream *stream, MetafileHeader *header)
{
- return NotImplemented;
+ return DllExports::GdipGetMetafileHeaderFromStream(stream, header);
}
Status
PlayRecord(EmfPlusRecordType recordType, UINT flags, UINT dataSize, const BYTE
*data)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipPlayMetafileRecord(GetNativeMetafile(),
recordType, flags, dataSize, data));
}
Status
SetDownLevelRasterizationLimit(UINT metafileRasterizationLimitDpi)
{
- return NotImplemented;
+ return SetStatus(
+ DllExports::GdipSetMetafileDownLevelRasterizationLimit(GetNativeMetafile(),
metafileRasterizationLimitDpi));
+ }
+
+ protected:
+ GpMetafile *
+ GetNativeMetafile() const
+ {
+ return static_cast<GpMetafile *>(nativeImage);
}
};