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