1 | ' Classes/System/Drawing/Imaging/MetafileHeader.ab
|
---|
2 | Namespace System
|
---|
3 | Namespace Drawing
|
---|
4 | Namespace Imaging
|
---|
5 |
|
---|
6 | Type Align(8) ENHMETAHEADER3
|
---|
7 | iType As DWord
|
---|
8 | nSize As DWord
|
---|
9 |
|
---|
10 | rclBounds As RECTL
|
---|
11 | rclFrame As RECTL
|
---|
12 | dSignature As DWord
|
---|
13 | nVersion As DWord
|
---|
14 | nBytes As DWord
|
---|
15 | nRecords As DWord
|
---|
16 | nHandles As Word
|
---|
17 |
|
---|
18 | sReserved As Word
|
---|
19 | nDescription As DWord
|
---|
20 |
|
---|
21 | offDescription As DWord
|
---|
22 |
|
---|
23 | nPalEntries As DWord
|
---|
24 | szlDevice As SIZEL
|
---|
25 | szlMillimeters As SIZEL
|
---|
26 | End Type
|
---|
27 |
|
---|
28 | ' Placeable WMFs
|
---|
29 |
|
---|
30 | Type Align(2) PWMFRect16
|
---|
31 | Left As Word
|
---|
32 | Top As Word
|
---|
33 | Right As Word
|
---|
34 | Bottom As Word
|
---|
35 | End Type
|
---|
36 |
|
---|
37 | Type Align(2) WmfPlaceableFileHeader
|
---|
38 | Key As DWord
|
---|
39 | Hmf As Word
|
---|
40 | BoundingBox As PWMFRect16
|
---|
41 | Inch As Word
|
---|
42 | Reserved As DWord
|
---|
43 | Checksum As Word
|
---|
44 | End Type
|
---|
45 |
|
---|
46 | Const GDIP_EMFPLUSFLAGS_DISPLAY = &h00000001
|
---|
47 |
|
---|
48 | Class MetafileHeader
|
---|
49 | Private
|
---|
50 | mfType As MetafileType
|
---|
51 | Size As DWord
|
---|
52 | version As DWord
|
---|
53 | emfPlusFlags As DWord
|
---|
54 | dpiX As Single
|
---|
55 | dpiY As Single
|
---|
56 | X As Long
|
---|
57 | Y As Long
|
---|
58 | Width As Long
|
---|
59 | Height As Long
|
---|
60 | 'Union
|
---|
61 | ' WmfHeader As METAHEADER
|
---|
62 | EmfHeader As ENHMETAHEADER3
|
---|
63 | 'End Union
|
---|
64 | emfPlusHeaderSize As Long
|
---|
65 | logicalDpiX As Long
|
---|
66 | logicalDpiY As Long
|
---|
67 | Public
|
---|
68 | Function MetafileType() As MetafileType
|
---|
69 | Return mfType
|
---|
70 | End Function
|
---|
71 |
|
---|
72 | Function EmfPlusHeaderSize() As DWord
|
---|
73 | Return emfPlusHeaderSize
|
---|
74 | End Function
|
---|
75 |
|
---|
76 | Function Version() As DWord
|
---|
77 | Return version
|
---|
78 | End Function
|
---|
79 |
|
---|
80 | Function EmfPlusFlags() As DWord
|
---|
81 | Return emfPlusFlags
|
---|
82 | End Function
|
---|
83 |
|
---|
84 | Function DpiX() As Single
|
---|
85 | Return dpiX
|
---|
86 | End Function
|
---|
87 |
|
---|
88 | Function DpiY() As Single
|
---|
89 | Return dpiY
|
---|
90 | End Function
|
---|
91 |
|
---|
92 | Function Bounds() As Rectangle
|
---|
93 | Dim r(X, Y, Width, Height)
|
---|
94 | Return r
|
---|
95 | End Function
|
---|
96 |
|
---|
97 | Function LogicalDpiX() As Single
|
---|
98 | Return logicalDpiX
|
---|
99 | End Function
|
---|
100 |
|
---|
101 | Function LogicalDpiY() As Single
|
---|
102 | Return logicalDpiY
|
---|
103 | End Function
|
---|
104 |
|
---|
105 | Function IsWmf() As BOOL
|
---|
106 | IsWmf = (mfType = MetafileTypeWmf Or mfType = MetafileTypeWmfPlaceable)
|
---|
107 | End Function
|
---|
108 |
|
---|
109 | Function IsWmfPlaceable() As BOOL
|
---|
110 | IsWmfPlaceable = (mfType = MetafileTypeWmfPlaceable)
|
---|
111 | End Function
|
---|
112 |
|
---|
113 | Function IsEmf() As BOOL
|
---|
114 | IsEmf = (mfType = MetafileTypeEmf)
|
---|
115 | End Function
|
---|
116 |
|
---|
117 | Function IsEmfOrEmfPlus() As BOOL
|
---|
118 | IsEmfOrEmfPlus = (mfType >= MetafileTypeEmf)
|
---|
119 | End Function
|
---|
120 |
|
---|
121 | Function IsEmfPlus() As BOOL
|
---|
122 | IsEmfPlus = (mfType >= MetafileTypeEmfPlusOnly)
|
---|
123 | End Function
|
---|
124 |
|
---|
125 | Function IsEmfPlusDual() As BOOL
|
---|
126 | IsEmfPlusDual = (mfType = MetafileTypeEmfPlusDual)
|
---|
127 | End Function
|
---|
128 |
|
---|
129 | Function IsEmfPlusOnly() As BOOL /*const*/
|
---|
130 | IsEmfPlusOnly = (mfType = MetafileTypeEmfPlusOnly)
|
---|
131 | End Function
|
---|
132 |
|
---|
133 | Function IsDisplay() As BOOL
|
---|
134 | If IsEmfPlus() <> FALSE And ((EmfPlusFlags And GDIP_EMFPLUSFLAGS_DISPLAY) <> 0) Then
|
---|
135 | IsDisplay = _System_TRUE
|
---|
136 | Else
|
---|
137 | IsDisplay = _System_FALSE
|
---|
138 | End Function
|
---|
139 |
|
---|
140 | Function WmfHeader() As *METAHEADER 'const METAHEADER* const
|
---|
141 | If IsWmf() Then
|
---|
142 | Return VarPtr(EmfHeader) 'VarPtr(WmfHeader)
|
---|
143 | Else
|
---|
144 | Return 0
|
---|
145 | End If
|
---|
146 | End Function
|
---|
147 |
|
---|
148 | Function GetEmfHeader() As * /*const*/ ENHMETAHEADER3 /*const*/
|
---|
149 | If IsEmfOrEmfPlus() Then
|
---|
150 | Return VarPtr(EmfHeader) 'VarPtr(WmfHeader)
|
---|
151 | Else
|
---|
152 | Return 0
|
---|
153 | End If
|
---|
154 | End Function
|
---|
155 | End Class
|
---|
156 |
|
---|
157 | End Namespace
|
---|
158 | End Namespace
|
---|
159 | End Namespace
|
---|