[SDK][INCLUDE] Improve gdiplusmetafile.h (#2221)

CORE-16585
This commit is contained in:
Katayama Hirofumi MZ 2020-01-01 17:06:34 +09:00 committed by GitHub
parent f48a01324c
commit 91f3c8f81a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}
};