2005-05-08 18:02:41 +00:00
|
|
|
/*
|
2008-03-25 17:36:27 +00:00
|
|
|
* Copyright (C) 2007 Google (Evan Stade)
|
2005-05-08 18:02:41 +00:00
|
|
|
*
|
2008-03-25 17:36:27 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2005-05-08 18:02:41 +00:00
|
|
|
*
|
2008-03-25 17:36:27 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2005-05-08 18:02:41 +00:00
|
|
|
*
|
2008-03-25 17:36:27 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-05-08 18:02:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GDIPLUSMETAHEADER_H
|
|
|
|
#define _GDIPLUSMETAHEADER_H
|
|
|
|
|
2008-03-25 17:36:27 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2019-12-29 14:21:05 +00:00
|
|
|
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;
|
2005-05-08 18:02:41 +00:00
|
|
|
} ENHMETAHEADER3;
|
|
|
|
|
2008-03-25 17:36:27 +00:00
|
|
|
#include <pshpack2.h>
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2019-12-29 14:21:05 +00:00
|
|
|
INT16 Left;
|
|
|
|
INT16 Top;
|
|
|
|
INT16 Right;
|
|
|
|
INT16 Bottom;
|
2005-05-08 18:02:41 +00:00
|
|
|
} PWMFRect16;
|
|
|
|
|
2008-03-25 17:36:27 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2019-12-29 14:21:05 +00:00
|
|
|
UINT32 Key;
|
|
|
|
INT16 Hmf;
|
2008-03-25 17:36:27 +00:00
|
|
|
PWMFRect16 BoundingBox;
|
2019-12-29 14:21:05 +00:00
|
|
|
INT16 Inch;
|
|
|
|
UINT32 Reserved;
|
|
|
|
INT16 Checksum;
|
2005-05-08 18:02:41 +00:00
|
|
|
} WmfPlaceableFileHeader;
|
|
|
|
|
2008-03-25 17:36:27 +00:00
|
|
|
#include <poppack.h>
|
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
#define GDIP_EMFPLUSFLAGS_DISPLAY 0x00000001
|
2005-05-08 18:02:41 +00:00
|
|
|
|
2008-03-25 17:36:27 +00:00
|
|
|
#ifdef __cplusplus
|
2005-05-08 18:02:41 +00:00
|
|
|
class MetafileHeader
|
|
|
|
{
|
2019-12-29 14:21:05 +00:00
|
|
|
public:
|
|
|
|
MetafileType Type;
|
|
|
|
UINT Size;
|
|
|
|
UINT Version;
|
|
|
|
UINT EmfPlusFlags;
|
|
|
|
REAL DpiX;
|
|
|
|
REAL DpiY;
|
|
|
|
INT X;
|
|
|
|
INT Y;
|
|
|
|
INT Width;
|
|
|
|
INT Height;
|
|
|
|
union {
|
|
|
|
METAHEADER WmfHeader;
|
|
|
|
ENHMETAHEADER3 EmfHeader;
|
2008-03-25 17:36:27 +00:00
|
|
|
};
|
2019-12-29 14:21:05 +00:00
|
|
|
INT EmfPlusHeaderSize;
|
|
|
|
INT LogicalDpiX;
|
|
|
|
INT LogicalDpiY;
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
public:
|
|
|
|
MetafileType
|
|
|
|
GetType() const
|
|
|
|
{
|
|
|
|
return Type;
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
UINT
|
|
|
|
GetMetafileSize() const
|
|
|
|
{
|
|
|
|
return Size;
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
UINT
|
|
|
|
GetVersion() const
|
|
|
|
{
|
|
|
|
return Version;
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
UINT
|
|
|
|
GetEmfPlusFlags() const
|
|
|
|
{
|
|
|
|
return EmfPlusFlags;
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
REAL
|
|
|
|
GetDpiX() const
|
|
|
|
{
|
|
|
|
return DpiX;
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
REAL
|
|
|
|
GetDpiY() const
|
|
|
|
{
|
|
|
|
return DpiY;
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
VOID
|
|
|
|
GetBounds(OUT Rect *r) const
|
2008-03-25 17:36:27 +00:00
|
|
|
{
|
|
|
|
r->X = X;
|
|
|
|
r->Y = Y;
|
|
|
|
r->Width = Width;
|
|
|
|
r->Height = Height;
|
|
|
|
}
|
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
BOOL
|
|
|
|
IsWmf() const
|
2008-03-25 17:36:27 +00:00
|
|
|
{
|
2019-12-29 14:21:05 +00:00
|
|
|
return ((Type == MetafileTypeWmf) || (Type == MetafileTypeWmfPlaceable));
|
2008-03-25 17:36:27 +00:00
|
|
|
}
|
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
BOOL
|
|
|
|
IsWmfPlaceable() const
|
|
|
|
{
|
|
|
|
return (Type == MetafileTypeWmfPlaceable);
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
BOOL
|
|
|
|
IsEmf() const
|
|
|
|
{
|
|
|
|
return (Type == MetafileTypeEmf);
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
BOOL
|
|
|
|
IsEmfOrEmfPlus() const
|
|
|
|
{
|
|
|
|
return (Type >= MetafileTypeEmf);
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
BOOL
|
|
|
|
IsEmfPlus() const
|
|
|
|
{
|
|
|
|
return (Type >= MetafileTypeEmfPlusOnly);
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
BOOL
|
|
|
|
IsEmfPlusDual() const
|
|
|
|
{
|
|
|
|
return (Type == MetafileTypeEmfPlusDual);
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
BOOL
|
|
|
|
IsEmfPlusOnly() const
|
|
|
|
{
|
|
|
|
return (Type == MetafileTypeEmfPlusOnly);
|
|
|
|
}
|
2008-03-25 17:36:27 +00:00
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
BOOL
|
|
|
|
IsDisplay() const
|
2008-03-25 17:36:27 +00:00
|
|
|
{
|
|
|
|
return IsEmfPlus() && ((EmfPlusFlags & GDIP_EMFPLUSFLAGS_DISPLAY) != 0);
|
|
|
|
}
|
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
const METAHEADER *
|
|
|
|
GetWmfHeader() const
|
2008-03-25 17:36:27 +00:00
|
|
|
{
|
|
|
|
return IsWmf() ? &WmfHeader : NULL;
|
|
|
|
}
|
|
|
|
|
2019-12-29 14:21:05 +00:00
|
|
|
const ENHMETAHEADER3 *
|
|
|
|
GetEmfHeader() const
|
2008-03-25 17:36:27 +00:00
|
|
|
{
|
|
|
|
return IsEmfOrEmfPlus() ? &EmfHeader : NULL;
|
|
|
|
}
|
2005-05-08 18:02:41 +00:00
|
|
|
};
|
2008-03-25 17:36:27 +00:00
|
|
|
#else /* end of c++ typedefs */
|
|
|
|
|
|
|
|
typedef struct MetafileHeader
|
|
|
|
{
|
2019-12-29 14:21:05 +00:00
|
|
|
MetafileType Type;
|
|
|
|
UINT Size;
|
|
|
|
UINT Version;
|
|
|
|
UINT EmfPlusFlags;
|
|
|
|
REAL DpiX;
|
|
|
|
REAL DpiY;
|
|
|
|
INT X;
|
|
|
|
INT Y;
|
|
|
|
INT Width;
|
|
|
|
INT Height;
|
|
|
|
union {
|
|
|
|
METAHEADER WmfHeader;
|
|
|
|
ENHMETAHEADER3 EmfHeader;
|
2008-03-25 17:36:27 +00:00
|
|
|
} DUMMYUNIONNAME;
|
2019-12-29 14:21:05 +00:00
|
|
|
INT EmfPlusHeaderSize;
|
|
|
|
INT LogicalDpiX;
|
|
|
|
INT LogicalDpiY;
|
2008-03-25 17:36:27 +00:00
|
|
|
} MetafileHeader;
|
|
|
|
|
|
|
|
#endif /* end of c typedefs */
|
2005-05-08 18:02:41 +00:00
|
|
|
|
|
|
|
#endif /* _GDIPLUSMETAHEADER_H */
|