]>
Commit | Line | Data |
---|---|---|
1fc25a89 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: mfutils.h | |
3 | // Purpose: Metafile utilities: reading a placeable metafile independently | |
4 | // of Windows. | |
5 | // Author: Julian Smart | |
6 | // Modified by: | |
7 | // Created: 12/07/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) Julian Smart | |
2ba06d5a | 10 | // Licence: wxWindows licence |
1fc25a89 JS |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef _MFUTILS_H_ | |
14 | #define _MFUTILS_H_ | |
15 | ||
5f331691 | 16 | |
1fc25a89 JS |
17 | #include <wx/metafile.h> |
18 | ||
19 | #ifndef GetRValue | |
2ba06d5a WS |
20 | #define GetRValue(rgb) ((unsigned char)(rgb)) |
21 | #define GetGValue(rgb) ((unsigned char)(((int)(rgb)) >> 8)) | |
22 | #define GetBValue(rgb) ((unsigned char)((rgb)>>16)) | |
1fc25a89 JS |
23 | #endif |
24 | ||
25 | /* Metafile Functions */ | |
f7a8c129 JS |
26 | // some compilers have them in their include files |
27 | ||
28 | #ifndef META_SETBKCOLOR | |
2ba06d5a | 29 | #define META_SETBKCOLOR 0x0201 |
f7a8c129 JS |
30 | #endif |
31 | #ifndef META_SETBKMODE | |
2ba06d5a | 32 | #define META_SETBKMODE 0x0102 |
f7a8c129 JS |
33 | #endif |
34 | #ifndef META_SETMAPMODE | |
2ba06d5a | 35 | #define META_SETMAPMODE 0x0103 |
f7a8c129 JS |
36 | #endif |
37 | #ifndef META_SETROP2 | |
2ba06d5a | 38 | #define META_SETROP2 0x0104 |
f7a8c129 JS |
39 | #endif |
40 | #ifndef META_SETRELABS | |
2ba06d5a | 41 | #define META_SETRELABS 0x0105 |
f7a8c129 JS |
42 | #endif |
43 | #ifndef META_SETPOLYFILLMODE | |
2ba06d5a | 44 | #define META_SETPOLYFILLMODE 0x0106 |
f7a8c129 JS |
45 | #endif |
46 | #ifndef META_SETSTRETCHBLTMODE | |
2ba06d5a | 47 | #define META_SETSTRETCHBLTMODE 0x0107 |
f7a8c129 JS |
48 | #endif |
49 | #ifndef META_SETTEXTCHAREXTRA | |
2ba06d5a | 50 | #define META_SETTEXTCHAREXTRA 0x0108 |
f7a8c129 JS |
51 | #endif |
52 | #ifndef META_SETTEXTCOLOR | |
2ba06d5a | 53 | #define META_SETTEXTCOLOR 0x0209 |
f7a8c129 JS |
54 | #endif |
55 | #ifndef META_SETTEXTJUSTIFICATION | |
2ba06d5a | 56 | #define META_SETTEXTJUSTIFICATION 0x020A |
f7a8c129 JS |
57 | #endif |
58 | #ifndef META_SETWINDOWORG | |
2ba06d5a | 59 | #define META_SETWINDOWORG 0x020B |
f7a8c129 JS |
60 | #endif |
61 | #ifndef META_SETWINDOWEXT | |
2ba06d5a | 62 | #define META_SETWINDOWEXT 0x020C |
f7a8c129 JS |
63 | #endif |
64 | #ifndef META_SETVIEWPORTORG | |
2ba06d5a | 65 | #define META_SETVIEWPORTORG 0x020D |
f7a8c129 JS |
66 | #endif |
67 | #ifndef META_SETVIEWPORTEXT | |
2ba06d5a | 68 | #define META_SETVIEWPORTEXT 0x020E |
f7a8c129 JS |
69 | #endif |
70 | #ifndef META_OFFSETWINDOWORG | |
2ba06d5a | 71 | #define META_OFFSETWINDOWORG 0x020F |
f7a8c129 JS |
72 | #endif |
73 | #ifndef META_SCALEWINDOWEXT | |
2ba06d5a | 74 | #define META_SCALEWINDOWEXT 0x0410 |
f7a8c129 JS |
75 | #endif |
76 | #ifndef META_OFFSETVIEWPORTORG | |
2ba06d5a | 77 | #define META_OFFSETVIEWPORTORG 0x0211 |
f7a8c129 JS |
78 | #endif |
79 | #ifndef META_SCALEVIEWPORTEXT | |
2ba06d5a | 80 | #define META_SCALEVIEWPORTEXT 0x0412 |
f7a8c129 JS |
81 | #endif |
82 | #ifndef META_LINETO | |
2ba06d5a | 83 | #define META_LINETO 0x0213 |
f7a8c129 JS |
84 | #endif |
85 | #ifndef META_MOVETO | |
2ba06d5a | 86 | #define META_MOVETO 0x0214 |
f7a8c129 JS |
87 | #endif |
88 | #ifndef META_EXCLUDECLIPRECT | |
2ba06d5a | 89 | #define META_EXCLUDECLIPRECT 0x0415 |
f7a8c129 JS |
90 | #endif |
91 | #ifndef META_INTERSECTCLIPRECT | |
2ba06d5a | 92 | #define META_INTERSECTCLIPRECT 0x0416 |
f7a8c129 JS |
93 | #endif |
94 | #ifndef META_ARC | |
2ba06d5a | 95 | #define META_ARC 0x0817 |
f7a8c129 JS |
96 | #endif |
97 | #ifndef META_ELLIPSE | |
2ba06d5a | 98 | #define META_ELLIPSE 0x0418 |
f7a8c129 JS |
99 | #endif |
100 | #ifndef META_FLOODFILL | |
2ba06d5a | 101 | #define META_FLOODFILL 0x0419 |
f7a8c129 JS |
102 | #endif |
103 | #ifndef META_PIE | |
2ba06d5a | 104 | #define META_PIE 0x081A |
f7a8c129 JS |
105 | #endif |
106 | #ifndef META_RECTANGLE | |
2ba06d5a | 107 | #define META_RECTANGLE 0x041B |
f7a8c129 JS |
108 | #endif |
109 | #ifndef META_ROUNDRECT | |
2ba06d5a | 110 | #define META_ROUNDRECT 0x061C |
f7a8c129 JS |
111 | #endif |
112 | #ifndef META_PATBLT | |
2ba06d5a | 113 | #define META_PATBLT 0x061D |
f7a8c129 JS |
114 | #endif |
115 | #ifndef META_SAVEDC | |
2ba06d5a | 116 | #define META_SAVEDC 0x001E |
f7a8c129 JS |
117 | #endif |
118 | #ifndef META_SETPIXEL | |
2ba06d5a | 119 | #define META_SETPIXEL 0x041F |
f7a8c129 JS |
120 | #endif |
121 | #ifndef META_OFFSETCLIPRGN | |
2ba06d5a | 122 | #define META_OFFSETCLIPRGN 0x0220 |
f7a8c129 JS |
123 | #endif |
124 | #ifndef META_TEXTOUT | |
2ba06d5a | 125 | #define META_TEXTOUT 0x0521 |
f7a8c129 JS |
126 | #endif |
127 | #ifndef META_BITBLT | |
2ba06d5a | 128 | #define META_BITBLT 0x0922 |
f7a8c129 JS |
129 | #endif |
130 | #ifndef META_STRETCHBLT | |
2ba06d5a | 131 | #define META_STRETCHBLT 0x0B23 |
f7a8c129 JS |
132 | #endif |
133 | #ifndef META_POLYGON | |
2ba06d5a | 134 | #define META_POLYGON 0x0324 |
f7a8c129 JS |
135 | #endif |
136 | #ifndef META_POLYLINE | |
2ba06d5a | 137 | #define META_POLYLINE 0x0325 |
f7a8c129 JS |
138 | #endif |
139 | #ifndef META_ESCAPE | |
2ba06d5a | 140 | #define META_ESCAPE 0x0626 |
f7a8c129 JS |
141 | #endif |
142 | #ifndef META_RESTOREDC | |
2ba06d5a | 143 | #define META_RESTOREDC 0x0127 |
f7a8c129 JS |
144 | #endif |
145 | #ifndef META_FILLREGION | |
2ba06d5a | 146 | #define META_FILLREGION 0x0228 |
f7a8c129 JS |
147 | #endif |
148 | #ifndef META_FRAMEREGION | |
2ba06d5a | 149 | #define META_FRAMEREGION 0x0429 |
f7a8c129 JS |
150 | #endif |
151 | #ifndef META_INVERTREGION | |
2ba06d5a | 152 | #define META_INVERTREGION 0x012A |
f7a8c129 JS |
153 | #endif |
154 | #ifndef META_PAINTREGION | |
2ba06d5a | 155 | #define META_PAINTREGION 0x012B |
f7a8c129 JS |
156 | #endif |
157 | #ifndef META_SELECTCLIPREGION | |
2ba06d5a | 158 | #define META_SELECTCLIPREGION 0x012C |
f7a8c129 JS |
159 | #endif |
160 | #ifndef META_SELECTOBJECT | |
2ba06d5a | 161 | #define META_SELECTOBJECT 0x012D |
f7a8c129 JS |
162 | #endif |
163 | #ifndef META_SETTEXTALIGN | |
2ba06d5a | 164 | #define META_SETTEXTALIGN 0x012E |
f7a8c129 JS |
165 | #endif |
166 | #ifndef META_DRAWTEXT | |
2ba06d5a | 167 | #define META_DRAWTEXT 0x062F |
f7a8c129 JS |
168 | #endif |
169 | ||
170 | #ifndef META_CHORD | |
2ba06d5a | 171 | #define META_CHORD 0x0830 |
f7a8c129 JS |
172 | #endif |
173 | #ifndef META_SETMAPPERFLAGS | |
2ba06d5a | 174 | #define META_SETMAPPERFLAGS 0x0231 |
f7a8c129 JS |
175 | #endif |
176 | #ifndef META_EXTTEXTOUT | |
2ba06d5a | 177 | #define META_EXTTEXTOUT 0x0a32 |
f7a8c129 JS |
178 | #endif |
179 | #ifndef META_SETDIBTODEV | |
2ba06d5a | 180 | #define META_SETDIBTODEV 0x0d33 |
f7a8c129 JS |
181 | #endif |
182 | #ifndef META_SELECTPALETTE | |
2ba06d5a | 183 | #define META_SELECTPALETTE 0x0234 |
f7a8c129 JS |
184 | #endif |
185 | #ifndef META_REALIZEPALETTE | |
2ba06d5a | 186 | #define META_REALIZEPALETTE 0x0035 |
f7a8c129 JS |
187 | #endif |
188 | #ifndef META_ANIMATEPALETTE | |
2ba06d5a | 189 | #define META_ANIMATEPALETTE 0x0436 |
f7a8c129 JS |
190 | #endif |
191 | #ifndef META_SETPALENTRIES | |
2ba06d5a | 192 | #define META_SETPALENTRIES 0x0037 |
f7a8c129 JS |
193 | #endif |
194 | #ifndef META_POLYPOLYGON | |
2ba06d5a | 195 | #define META_POLYPOLYGON 0x0538 |
f7a8c129 JS |
196 | #endif |
197 | #ifndef META_RESIZEPALETTE | |
2ba06d5a | 198 | #define META_RESIZEPALETTE 0x0139 |
f7a8c129 JS |
199 | #endif |
200 | ||
201 | #ifndef META_DIBBITBLT | |
2ba06d5a | 202 | #define META_DIBBITBLT 0x0940 |
f7a8c129 JS |
203 | #endif |
204 | #ifndef META_DIBSTRETCHBLT | |
2ba06d5a | 205 | #define META_DIBSTRETCHBLT 0x0b41 |
f7a8c129 JS |
206 | #endif |
207 | #ifndef META_DIBCREATEPATTERNBRUSH | |
2ba06d5a | 208 | #define META_DIBCREATEPATTERNBRUSH 0x0142 |
f7a8c129 JS |
209 | #endif |
210 | #ifndef META_STRETCHDIB | |
2ba06d5a | 211 | #define META_STRETCHDIB 0x0f43 |
f7a8c129 JS |
212 | #endif |
213 | ||
214 | #ifndef META_EXTFLOODFILL | |
2ba06d5a | 215 | #define META_EXTFLOODFILL 0x0548 |
f7a8c129 JS |
216 | #endif |
217 | ||
218 | #ifndef META_RESETDC | |
2ba06d5a | 219 | #define META_RESETDC 0x014C |
f7a8c129 JS |
220 | #endif |
221 | #ifndef META_STARTDOC | |
2ba06d5a | 222 | #define META_STARTDOC 0x014D |
f7a8c129 JS |
223 | #endif |
224 | #ifndef META_STARTPAGE | |
2ba06d5a | 225 | #define META_STARTPAGE 0x004F |
f7a8c129 JS |
226 | #endif |
227 | #ifndef META_ENDPAGE | |
2ba06d5a | 228 | #define META_ENDPAGE 0x0050 |
f7a8c129 JS |
229 | #endif |
230 | #ifndef META_ABORTDOC | |
2ba06d5a | 231 | #define META_ABORTDOC 0x0052 |
f7a8c129 JS |
232 | #endif |
233 | #ifndef META_ENDDOC | |
2ba06d5a | 234 | #define META_ENDDOC 0x005E |
f7a8c129 JS |
235 | #endif |
236 | ||
237 | #ifndef META_DELETEOBJECT | |
2ba06d5a | 238 | #define META_DELETEOBJECT 0x01f0 |
f7a8c129 JS |
239 | #endif |
240 | ||
241 | #ifndef META_CREATEPALETTE | |
2ba06d5a | 242 | #define META_CREATEPALETTE 0x00f7 |
f7a8c129 JS |
243 | #endif |
244 | #ifndef META_CREATEBRUSH | |
2ba06d5a | 245 | #define META_CREATEBRUSH 0x00F8 |
f7a8c129 JS |
246 | #endif |
247 | #ifndef META_CREATEPATTERNBRUSH | |
2ba06d5a | 248 | #define META_CREATEPATTERNBRUSH 0x01F9 |
f7a8c129 JS |
249 | #endif |
250 | #ifndef META_CREATEPENINDIRECT | |
2ba06d5a | 251 | #define META_CREATEPENINDIRECT 0x02FA |
f7a8c129 JS |
252 | #endif |
253 | #ifndef META_CREATEFONTINDIRECT | |
2ba06d5a | 254 | #define META_CREATEFONTINDIRECT 0x02FB |
f7a8c129 JS |
255 | #endif |
256 | #ifndef META_CREATEBRUSHINDIRECT | |
2ba06d5a | 257 | #define META_CREATEBRUSHINDIRECT 0x02FC |
f7a8c129 JS |
258 | #endif |
259 | #ifndef META_CREATEBITMAPINDIRECT | |
2ba06d5a | 260 | #define META_CREATEBITMAPINDIRECT 0x02FD |
f7a8c129 JS |
261 | #endif |
262 | #ifndef META_CREATEBITMAP | |
2ba06d5a | 263 | #define META_CREATEBITMAP 0x06FE |
f7a8c129 JS |
264 | #endif |
265 | #ifndef META_CREATEREGION | |
2ba06d5a | 266 | #define META_CREATEREGION 0x06FF |
f7a8c129 | 267 | #endif |
1fc25a89 JS |
268 | |
269 | /* Background Modes */ | |
f7a8c129 JS |
270 | #ifndef TRANSPARENT |
271 | #define TRANSPARENT 1 | |
272 | #endif | |
273 | #ifndef OPAQUE | |
274 | #define OPAQUE 2 | |
275 | #endif | |
1fc25a89 JS |
276 | |
277 | /* Pen Styles */ | |
f7a8c129 | 278 | #ifndef PS_SOLID |
2ba06d5a | 279 | #define PS_SOLID 0 |
f7a8c129 JS |
280 | #endif |
281 | #ifndef PS_DASH | |
2ba06d5a | 282 | #define PS_DASH 1 |
f7a8c129 JS |
283 | #endif |
284 | #ifndef PS_DOT | |
2ba06d5a | 285 | #define PS_DOT 2 |
f7a8c129 JS |
286 | #endif |
287 | #ifndef PS_DASHDOT | |
2ba06d5a | 288 | #define PS_DASHDOT 3 |
f7a8c129 JS |
289 | #endif |
290 | #ifndef PS_DASHDOTDOT | |
2ba06d5a | 291 | #define PS_DASHDOTDOT 4 |
f7a8c129 JS |
292 | #endif |
293 | #ifndef PS_NULL | |
2ba06d5a | 294 | #define PS_NULL 5 |
f7a8c129 JS |
295 | #endif |
296 | #ifndef PS_INSIDEFRAME | |
2ba06d5a | 297 | #define PS_INSIDEFRAME 6 |
f7a8c129 | 298 | #endif |
1fc25a89 JS |
299 | |
300 | /* PitchAndFamily family values (high 4 bits) */ | |
f7a8c129 JS |
301 | #ifndef FF_DONTCARE |
302 | #define FF_DONTCARE 0x00 | |
303 | #endif | |
304 | #ifndef FF_ROMAN | |
305 | #define FF_ROMAN 0x10 | |
306 | #endif | |
307 | #ifndef FF_SWISS | |
308 | #define FF_SWISS 0x20 | |
309 | #endif | |
310 | #ifndef FF_MODERN | |
311 | #define FF_MODERN 0x30 | |
312 | #endif | |
313 | #ifndef FF_SCRIPT | |
314 | #define FF_SCRIPT 0x40 | |
315 | #endif | |
316 | #ifndef FF_DECORATIVE | |
317 | #define FF_DECORATIVE 0x50 | |
1fc25a89 JS |
318 | #endif |
319 | ||
320 | /* Brush Styles */ | |
f7a8c129 | 321 | #ifndef BS_SOLID |
2ba06d5a | 322 | #define BS_SOLID 0 |
f7a8c129 JS |
323 | #endif |
324 | #ifndef BS_NULL | |
2ba06d5a | 325 | #define BS_NULL 1 |
f7a8c129 JS |
326 | #endif |
327 | #ifndef BS_HOLLOW | |
2ba06d5a | 328 | #define BS_HOLLOW BS_NULL |
f7a8c129 JS |
329 | #endif |
330 | #ifndef BS_HATCHED | |
2ba06d5a | 331 | #define BS_HATCHED 2 |
f7a8c129 JS |
332 | #endif |
333 | #ifndef BS_PATTERN | |
2ba06d5a | 334 | #define BS_PATTERN 3 |
f7a8c129 JS |
335 | #endif |
336 | #ifndef BS_INDEXED | |
2ba06d5a | 337 | #define BS_INDEXED 4 |
f7a8c129 JS |
338 | #endif |
339 | #ifndef BS_DIBPATTERN | |
2ba06d5a | 340 | #define BS_DIBPATTERN 5 |
f7a8c129 | 341 | #endif |
1fc25a89 JS |
342 | |
343 | /* Hatch Styles */ | |
f7a8c129 JS |
344 | #ifndef HS_HORIZONTAL |
345 | #define HS_HORIZONTAL 0 | |
346 | #endif | |
347 | #ifndef HS_VERTICAL | |
348 | #define HS_VERTICAL 1 | |
349 | #endif | |
350 | #ifndef HS_FDIAGONAL | |
351 | #define HS_FDIAGONAL 2 | |
352 | #endif | |
353 | #ifndef HS_BDIAGONAL | |
354 | #define HS_BDIAGONAL 3 | |
355 | #endif | |
356 | #ifndef HS_CROSS | |
357 | #define HS_CROSS 4 | |
358 | #endif | |
359 | #ifndef HS_DIAGCROSS | |
360 | #define HS_DIAGCROSS 5 | |
361 | #endif | |
1fc25a89 | 362 | |
5f331691 | 363 | class WXDLLIMPEXP_OGL wxMetaRecord: public wxObject |
1fc25a89 JS |
364 | { |
365 | public: | |
366 | int metaFunction; | |
367 | long param1; | |
368 | long param2; | |
369 | long param3; | |
370 | long param4; | |
371 | long param5; | |
372 | long param6; | |
373 | long param7; | |
374 | long param8; | |
c1fa2fda | 375 | wxChar *stringParam; |
1fc25a89 | 376 | wxRealPoint *points; |
c1fa2fda | 377 | |
1fc25a89 JS |
378 | wxMetaRecord(int fun) |
379 | { | |
380 | metaFunction = fun; points = NULL; stringParam = NULL; | |
381 | param1 = 0; | |
382 | } | |
383 | ~wxMetaRecord(void); | |
384 | }; | |
385 | ||
5f331691 | 386 | class WXDLLIMPEXP_OGL wxXMetaFile: public wxObject |
1fc25a89 JS |
387 | { |
388 | public: | |
389 | double lastX; | |
390 | double lastY; | |
391 | bool ok; | |
392 | ||
393 | double left; | |
394 | double top; | |
395 | double right; | |
396 | double bottom; | |
397 | ||
398 | wxList metaRecords; | |
399 | wxList gdiObjects; // List of wxMetaRecord objects created with Create..., | |
400 | // referenced by position in list by SelectObject | |
9e053640 | 401 | wxXMetaFile(const wxChar* file = NULL); |
1fc25a89 | 402 | ~wxXMetaFile(void); |
c1fa2fda | 403 | |
1fc25a89 JS |
404 | // After this is called, the metafile cannot be used for anything |
405 | // since it is now owned by the clipboard. | |
406 | bool SetClipboard(int width = 0, int height = 0); | |
407 | ||
408 | bool Play(wxDC *dc); | |
409 | inline bool Ok(void) const { return ok; } | |
9e053640 | 410 | bool ReadFile(const wxChar *file); |
1fc25a89 JS |
411 | }; |
412 | ||
413 | #endif | |
414 | // _MFUTILS_H_ |