1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Metafile utilities: reading a placeable metafile independently
5 // Author: Julian Smart
9 // Copyright: (c) Julian Smart
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
16 #if defined(__GNUG__) && !defined(__APPLE__)
17 #pragma interface "mfutils.h"
21 #include <wx/metafile.h>
24 #define GetRValue(rgb) ((unsigned char)(rgb))
25 #define GetGValue(rgb) ((unsigned char)(((int)(rgb)) >> 8))
26 #define GetBValue(rgb) ((unsigned char)((rgb)>>16))
29 /* Metafile Functions */
30 // some compilers have them in their include files
32 #ifndef META_SETBKCOLOR
33 #define META_SETBKCOLOR 0x0201
35 #ifndef META_SETBKMODE
36 #define META_SETBKMODE 0x0102
38 #ifndef META_SETMAPMODE
39 #define META_SETMAPMODE 0x0103
42 #define META_SETROP2 0x0104
44 #ifndef META_SETRELABS
45 #define META_SETRELABS 0x0105
47 #ifndef META_SETPOLYFILLMODE
48 #define META_SETPOLYFILLMODE 0x0106
50 #ifndef META_SETSTRETCHBLTMODE
51 #define META_SETSTRETCHBLTMODE 0x0107
53 #ifndef META_SETTEXTCHAREXTRA
54 #define META_SETTEXTCHAREXTRA 0x0108
56 #ifndef META_SETTEXTCOLOR
57 #define META_SETTEXTCOLOR 0x0209
59 #ifndef META_SETTEXTJUSTIFICATION
60 #define META_SETTEXTJUSTIFICATION 0x020A
62 #ifndef META_SETWINDOWORG
63 #define META_SETWINDOWORG 0x020B
65 #ifndef META_SETWINDOWEXT
66 #define META_SETWINDOWEXT 0x020C
68 #ifndef META_SETVIEWPORTORG
69 #define META_SETVIEWPORTORG 0x020D
71 #ifndef META_SETVIEWPORTEXT
72 #define META_SETVIEWPORTEXT 0x020E
74 #ifndef META_OFFSETWINDOWORG
75 #define META_OFFSETWINDOWORG 0x020F
77 #ifndef META_SCALEWINDOWEXT
78 #define META_SCALEWINDOWEXT 0x0410
80 #ifndef META_OFFSETVIEWPORTORG
81 #define META_OFFSETVIEWPORTORG 0x0211
83 #ifndef META_SCALEVIEWPORTEXT
84 #define META_SCALEVIEWPORTEXT 0x0412
87 #define META_LINETO 0x0213
90 #define META_MOVETO 0x0214
92 #ifndef META_EXCLUDECLIPRECT
93 #define META_EXCLUDECLIPRECT 0x0415
95 #ifndef META_INTERSECTCLIPRECT
96 #define META_INTERSECTCLIPRECT 0x0416
99 #define META_ARC 0x0817
102 #define META_ELLIPSE 0x0418
104 #ifndef META_FLOODFILL
105 #define META_FLOODFILL 0x0419
108 #define META_PIE 0x081A
110 #ifndef META_RECTANGLE
111 #define META_RECTANGLE 0x041B
113 #ifndef META_ROUNDRECT
114 #define META_ROUNDRECT 0x061C
117 #define META_PATBLT 0x061D
120 #define META_SAVEDC 0x001E
122 #ifndef META_SETPIXEL
123 #define META_SETPIXEL 0x041F
125 #ifndef META_OFFSETCLIPRGN
126 #define META_OFFSETCLIPRGN 0x0220
129 #define META_TEXTOUT 0x0521
132 #define META_BITBLT 0x0922
134 #ifndef META_STRETCHBLT
135 #define META_STRETCHBLT 0x0B23
138 #define META_POLYGON 0x0324
140 #ifndef META_POLYLINE
141 #define META_POLYLINE 0x0325
144 #define META_ESCAPE 0x0626
146 #ifndef META_RESTOREDC
147 #define META_RESTOREDC 0x0127
149 #ifndef META_FILLREGION
150 #define META_FILLREGION 0x0228
152 #ifndef META_FRAMEREGION
153 #define META_FRAMEREGION 0x0429
155 #ifndef META_INVERTREGION
156 #define META_INVERTREGION 0x012A
158 #ifndef META_PAINTREGION
159 #define META_PAINTREGION 0x012B
161 #ifndef META_SELECTCLIPREGION
162 #define META_SELECTCLIPREGION 0x012C
164 #ifndef META_SELECTOBJECT
165 #define META_SELECTOBJECT 0x012D
167 #ifndef META_SETTEXTALIGN
168 #define META_SETTEXTALIGN 0x012E
170 #ifndef META_DRAWTEXT
171 #define META_DRAWTEXT 0x062F
175 #define META_CHORD 0x0830
177 #ifndef META_SETMAPPERFLAGS
178 #define META_SETMAPPERFLAGS 0x0231
180 #ifndef META_EXTTEXTOUT
181 #define META_EXTTEXTOUT 0x0a32
183 #ifndef META_SETDIBTODEV
184 #define META_SETDIBTODEV 0x0d33
186 #ifndef META_SELECTPALETTE
187 #define META_SELECTPALETTE 0x0234
189 #ifndef META_REALIZEPALETTE
190 #define META_REALIZEPALETTE 0x0035
192 #ifndef META_ANIMATEPALETTE
193 #define META_ANIMATEPALETTE 0x0436
195 #ifndef META_SETPALENTRIES
196 #define META_SETPALENTRIES 0x0037
198 #ifndef META_POLYPOLYGON
199 #define META_POLYPOLYGON 0x0538
201 #ifndef META_RESIZEPALETTE
202 #define META_RESIZEPALETTE 0x0139
205 #ifndef META_DIBBITBLT
206 #define META_DIBBITBLT 0x0940
208 #ifndef META_DIBSTRETCHBLT
209 #define META_DIBSTRETCHBLT 0x0b41
211 #ifndef META_DIBCREATEPATTERNBRUSH
212 #define META_DIBCREATEPATTERNBRUSH 0x0142
214 #ifndef META_STRETCHDIB
215 #define META_STRETCHDIB 0x0f43
218 #ifndef META_EXTFLOODFILL
219 #define META_EXTFLOODFILL 0x0548
223 #define META_RESETDC 0x014C
225 #ifndef META_STARTDOC
226 #define META_STARTDOC 0x014D
228 #ifndef META_STARTPAGE
229 #define META_STARTPAGE 0x004F
232 #define META_ENDPAGE 0x0050
234 #ifndef META_ABORTDOC
235 #define META_ABORTDOC 0x0052
238 #define META_ENDDOC 0x005E
241 #ifndef META_DELETEOBJECT
242 #define META_DELETEOBJECT 0x01f0
245 #ifndef META_CREATEPALETTE
246 #define META_CREATEPALETTE 0x00f7
248 #ifndef META_CREATEBRUSH
249 #define META_CREATEBRUSH 0x00F8
251 #ifndef META_CREATEPATTERNBRUSH
252 #define META_CREATEPATTERNBRUSH 0x01F9
254 #ifndef META_CREATEPENINDIRECT
255 #define META_CREATEPENINDIRECT 0x02FA
257 #ifndef META_CREATEFONTINDIRECT
258 #define META_CREATEFONTINDIRECT 0x02FB
260 #ifndef META_CREATEBRUSHINDIRECT
261 #define META_CREATEBRUSHINDIRECT 0x02FC
263 #ifndef META_CREATEBITMAPINDIRECT
264 #define META_CREATEBITMAPINDIRECT 0x02FD
266 #ifndef META_CREATEBITMAP
267 #define META_CREATEBITMAP 0x06FE
269 #ifndef META_CREATEREGION
270 #define META_CREATEREGION 0x06FF
273 /* Background Modes */
275 #define TRANSPARENT 1
294 #ifndef PS_DASHDOTDOT
295 #define PS_DASHDOTDOT 4
300 #ifndef PS_INSIDEFRAME
301 #define PS_INSIDEFRAME 6
304 /* PitchAndFamily family values (high 4 bits) */
306 #define FF_DONTCARE 0x00
309 #define FF_ROMAN 0x10
312 #define FF_SWISS 0x20
315 #define FF_MODERN 0x30
318 #define FF_SCRIPT 0x40
320 #ifndef FF_DECORATIVE
321 #define FF_DECORATIVE 0x50
332 #define BS_HOLLOW BS_NULL
343 #ifndef BS_DIBPATTERN
344 #define BS_DIBPATTERN 5
348 #ifndef HS_HORIZONTAL
349 #define HS_HORIZONTAL 0
352 #define HS_VERTICAL 1
355 #define HS_FDIAGONAL 2
358 #define HS_BDIAGONAL 3
364 #define HS_DIAGCROSS 5
367 class WXDLLIMPEXP_OGL wxMetaRecord
: public wxObject
382 wxMetaRecord(int fun
)
384 metaFunction
= fun
; points
= NULL
; stringParam
= NULL
;
390 class WXDLLIMPEXP_OGL wxXMetaFile
: public wxObject
403 wxList gdiObjects
; // List of wxMetaRecord objects created with Create...,
404 // referenced by position in list by SelectObject
405 wxXMetaFile(const wxChar
* file
= NULL
);
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);
413 inline bool Ok(void) const { return ok
; }
414 bool ReadFile(const wxChar
*file
);