Embed:
(wiki syntax)
Show/hide line numbers
gdiplusmetaheader.h
00001 /* 00002 * gdiplusmetaheader.h 00003 * 00004 * GDI+ metafile header structure 00005 * 00006 * This file is part of the w32api package. 00007 * 00008 * Contributors: 00009 * Created by Markus Koenig <markus@stber-koenig.de> 00010 * 00011 * THIS SOFTWARE IS NOT COPYRIGHTED 00012 * 00013 * This source code is offered for use in the public domain. You may 00014 * use, modify or distribute it freely. 00015 * 00016 * This code is distributed in the hope that it will be useful but 00017 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 00018 * DISCLAIMED. This includes but is not limited to warranties of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00020 * 00021 */ 00022 00023 #ifndef __GDIPLUS_METAHEADER_H 00024 #define __GDIPLUS_METAHEADER_H 00025 #if __GNUC__ >=3 00026 #pragma GCC system_header 00027 #endif 00028 00029 00030 /* 00031 * FIXME: is 1 the correct value for GDIP_EMFPLUSFLAGS_DISPLAY? This number 00032 * has been determined by calling Metafile::GetMetafileHeader() on a EMF+ 00033 * metafile which was recorded on a display device context (SampleMetafile.emf). 00034 */ 00035 #ifdef __cplusplus 00036 const UINT GDIP_EMFPLUSFLAGS_DISPLAY = 1; 00037 #else 00038 #define GDIP_EMFPLUSFLAGS_DISPLAY ((UINT) 1) 00039 #endif 00040 00041 typedef struct tagENHMETAHEADER3 { 00042 DWORD iType; 00043 DWORD nSize; 00044 RECTL rclBounds; 00045 RECTL rclFrame; 00046 DWORD dSignature; 00047 DWORD nVersion; 00048 DWORD nBytes; 00049 DWORD nRecords; 00050 WORD nHandles; 00051 WORD sReserved; 00052 DWORD nDescription; 00053 DWORD offDescription; 00054 DWORD nPalEntries; 00055 SIZEL szlDevice; 00056 SIZEL szlMillimeters; 00057 } ENHMETAHEADER3,*LPENHMETAHEADER3; 00058 00059 typedef struct PWMFRect16 { 00060 INT16 Left; 00061 INT16 Top; 00062 INT16 Right; 00063 INT16 Bottom; 00064 } PWMFRect16; 00065 00066 typedef struct WmfPlaceableFileHeader { 00067 UINT32 Key; 00068 INT16 Hmf; 00069 PWMFRect16 BoundingBox; 00070 INT16 Inch; 00071 UINT32 Reserved; 00072 INT16 Checksum; 00073 } WmfPlaceableFileHeader; 00074 00075 typedef struct MetafileHeader { 00076 MetafileType Type; 00077 UINT Size; 00078 UINT Version; 00079 UINT EmfPlusFlags; 00080 REAL DpiX; 00081 REAL DpiY; 00082 INT X; 00083 INT Y; 00084 INT Width; 00085 INT Height; 00086 __extension__ union { 00087 METAHEADER WmfHeader; 00088 ENHMETAHEADER3 EmfHeader; 00089 }; 00090 INT EmfPlusHeaderSize; 00091 INT LogicalDpiX; 00092 INT LogicalDpiY; 00093 00094 #ifdef __cplusplus 00095 public: 00096 void GetBounds(Rect *rect) const 00097 { 00098 if (rect) 00099 { 00100 rect->X = X; 00101 rect->Y = Y; 00102 rect->Width = Width; 00103 rect->Height = Height; 00104 } 00105 } 00106 REAL GetDpiX() const 00107 { 00108 return DpiX; 00109 } 00110 REAL GetDpiY() const 00111 { 00112 return DpiY; 00113 } 00114 const ENHMETAHEADER3* GetEmfHeader() const 00115 { 00116 if (Type == MetafileTypeEmf 00117 || Type == MetafileTypeEmfPlusOnly 00118 || Type == MetafileTypeEmfPlusDual) 00119 { 00120 return &EmfHeader; 00121 } 00122 else 00123 { 00124 return NULL; 00125 } 00126 } 00127 UINT GetEmfPlusFlags() const 00128 { 00129 return EmfPlusFlags; 00130 } 00131 UINT GetMetafileSize() const 00132 { 00133 return Size; 00134 } 00135 MetafileType GetType() const 00136 { 00137 return Type; 00138 } 00139 UINT GetVersion() const 00140 { 00141 return Version; 00142 } 00143 const METAHEADER* GetWmfHeader() const 00144 { 00145 if (Type == MetafileTypeWmf || Type == MetafileTypeWmfPlaceable) 00146 { 00147 return &WmfHeader; 00148 } 00149 else 00150 { 00151 return NULL; 00152 } 00153 } 00154 BOOL IsDisplay() const 00155 { 00156 return EmfPlusFlags == GDIP_EMFPLUSFLAGS_DISPLAY; 00157 } 00158 BOOL IsEmf() const 00159 { 00160 return Type == MetafileTypeEmf; 00161 } 00162 BOOL IsEmfOrEmfPlus() const 00163 { 00164 return Type == MetafileTypeEmf 00165 || Type == MetafileTypeEmfPlusOnly 00166 || Type == MetafileTypeEmfPlusDual; 00167 } 00168 BOOL IsEmfPlus() const 00169 { 00170 return Type == MetafileTypeEmfPlusOnly 00171 || Type == MetafileTypeEmfPlusDual; 00172 } 00173 BOOL IsEmfPlusDual() const 00174 { 00175 return Type == MetafileTypeEmfPlusDual; 00176 } 00177 BOOL IsEmfPlusOnly() const 00178 { 00179 return Type == MetafileTypeEmfPlusOnly; 00180 } 00181 BOOL IsWmf() const 00182 { 00183 return Type == MetafileTypeWmf 00184 || Type == MetafileTypeWmfPlaceable; 00185 } 00186 BOOL IsWmfPlaceable() const 00187 { 00188 return Type == MetafileTypeWmfPlaceable; 00189 } 00190 #endif 00191 } MetafileHeader; 00192 00193 #endif /* __GDIPLUS_METAHEADER_H */
Generated on Tue Jul 12 2022 19:59:54 by
1.7.2