]>
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 | |
10 | // Licence: wxWindows licence | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef _MFUTILS_H_ | |
14 | #define _MFUTILS_H_ | |
15 | ||
ab7ce33c | 16 | #if defined(__GNUG__) && !defined(__APPLE__) |
1fc25a89 JS |
17 | #pragma interface "mfutils.h" |
18 | #endif | |
19 | ||
5f331691 | 20 | |
1fc25a89 JS |
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 | /* Win32s/Borland need these macros, although META_SETBKCOLOR is defined */ | |
31 | #if 1 // !defined(META_SETBKCOLOR) // || defined(WIN32) | |
32 | ||
33 | #define META_SETBKCOLOR 0x0201 | |
34 | #define META_SETBKMODE 0x0102 | |
35 | #define META_SETMAPMODE 0x0103 | |
36 | #define META_SETROP2 0x0104 | |
37 | #define META_SETRELABS 0x0105 | |
38 | #define META_SETPOLYFILLMODE 0x0106 | |
39 | #define META_SETSTRETCHBLTMODE 0x0107 | |
40 | #define META_SETTEXTCHAREXTRA 0x0108 | |
41 | #define META_SETTEXTCOLOR 0x0209 | |
42 | #define META_SETTEXTJUSTIFICATION 0x020A | |
43 | #define META_SETWINDOWORG 0x020B | |
44 | #define META_SETWINDOWEXT 0x020C | |
45 | #define META_SETVIEWPORTORG 0x020D | |
46 | #define META_SETVIEWPORTEXT 0x020E | |
47 | #define META_OFFSETWINDOWORG 0x020F | |
48 | #define META_SCALEWINDOWEXT 0x0410 | |
49 | #define META_OFFSETVIEWPORTORG 0x0211 | |
50 | #define META_SCALEVIEWPORTEXT 0x0412 | |
51 | #define META_LINETO 0x0213 | |
52 | #define META_MOVETO 0x0214 | |
53 | #define META_EXCLUDECLIPRECT 0x0415 | |
54 | #define META_INTERSECTCLIPRECT 0x0416 | |
55 | #define META_ARC 0x0817 | |
56 | #define META_ELLIPSE 0x0418 | |
57 | #define META_FLOODFILL 0x0419 | |
58 | #define META_PIE 0x081A | |
59 | #define META_RECTANGLE 0x041B | |
60 | #define META_ROUNDRECT 0x061C | |
61 | #define META_PATBLT 0x061D | |
62 | #define META_SAVEDC 0x001E | |
63 | #define META_SETPIXEL 0x041F | |
64 | #define META_OFFSETCLIPRGN 0x0220 | |
65 | #define META_TEXTOUT 0x0521 | |
66 | #define META_BITBLT 0x0922 | |
67 | #define META_STRETCHBLT 0x0B23 | |
68 | #define META_POLYGON 0x0324 | |
69 | #define META_POLYLINE 0x0325 | |
70 | #define META_ESCAPE 0x0626 | |
71 | #define META_RESTOREDC 0x0127 | |
72 | #define META_FILLREGION 0x0228 | |
73 | #define META_FRAMEREGION 0x0429 | |
74 | #define META_INVERTREGION 0x012A | |
75 | #define META_PAINTREGION 0x012B | |
76 | #define META_SELECTCLIPREGION 0x012C | |
77 | #define META_SELECTOBJECT 0x012D | |
78 | #define META_SETTEXTALIGN 0x012E | |
79 | #define META_DRAWTEXT 0x062F | |
80 | ||
81 | #define META_CHORD 0x0830 | |
82 | #define META_SETMAPPERFLAGS 0x0231 | |
83 | #define META_EXTTEXTOUT 0x0a32 | |
84 | #define META_SETDIBTODEV 0x0d33 | |
85 | #define META_SELECTPALETTE 0x0234 | |
86 | #define META_REALIZEPALETTE 0x0035 | |
87 | #define META_ANIMATEPALETTE 0x0436 | |
88 | #define META_SETPALENTRIES 0x0037 | |
89 | #define META_POLYPOLYGON 0x0538 | |
90 | #define META_RESIZEPALETTE 0x0139 | |
91 | ||
92 | #define META_DIBBITBLT 0x0940 | |
93 | #define META_DIBSTRETCHBLT 0x0b41 | |
94 | #define META_DIBCREATEPATTERNBRUSH 0x0142 | |
95 | #define META_STRETCHDIB 0x0f43 | |
96 | ||
97 | #define META_EXTFLOODFILL 0x0548 | |
98 | ||
99 | #define META_RESETDC 0x014C | |
100 | #define META_STARTDOC 0x014D | |
101 | #define META_STARTPAGE 0x004F | |
102 | #define META_ENDPAGE 0x0050 | |
103 | #define META_ABORTDOC 0x0052 | |
104 | #define META_ENDDOC 0x005E | |
105 | ||
106 | #define META_DELETEOBJECT 0x01f0 | |
107 | ||
108 | #define META_CREATEPALETTE 0x00f7 | |
109 | #define META_CREATEBRUSH 0x00F8 | |
110 | #define META_CREATEPATTERNBRUSH 0x01F9 | |
111 | #define META_CREATEPENINDIRECT 0x02FA | |
112 | #define META_CREATEFONTINDIRECT 0x02FB | |
113 | #define META_CREATEBRUSHINDIRECT 0x02FC | |
114 | #define META_CREATEBITMAPINDIRECT 0x02FD | |
115 | #define META_CREATEBITMAP 0x06FE | |
116 | #define META_CREATEREGION 0x06FF | |
117 | ||
118 | /* Background Modes */ | |
119 | #define TRANSPARENT 1 | |
120 | #define OPAQUE 2 | |
121 | ||
122 | /* Pen Styles */ | |
123 | #define PS_SOLID 0 | |
124 | #define PS_DASH 1 | |
125 | #define PS_DOT 2 | |
126 | #define PS_DASHDOT 3 | |
127 | #define PS_DASHDOTDOT 4 | |
128 | #define PS_NULL 5 | |
129 | #define PS_INSIDEFRAME 6 | |
130 | ||
131 | /* PitchAndFamily family values (high 4 bits) */ | |
132 | /* Win32s/Borland don't need this */ | |
133 | #ifndef FF_DONTCARE // !defined(__BORLANDC__) && !defined(WIN32) | |
134 | #define FF_DONTCARE 0x00 | |
135 | #define FF_ROMAN 0x10 | |
136 | #define FF_SWISS 0x20 | |
137 | #define FF_MODERN 0x30 | |
138 | #define FF_SCRIPT 0x40 | |
139 | #define FF_DECORATIVE 0x50 | |
140 | #endif | |
141 | ||
142 | /* Brush Styles */ | |
143 | #define BS_SOLID 0 | |
144 | #define BS_NULL 1 | |
145 | #define BS_HOLLOW BS_NULL | |
146 | #define BS_HATCHED 2 | |
147 | #define BS_PATTERN 3 | |
148 | #define BS_INDEXED 4 | |
149 | #define BS_DIBPATTERN 5 | |
150 | ||
151 | /* Hatch Styles */ | |
152 | #define HS_HORIZONTAL 0 | |
153 | #define HS_VERTICAL 1 | |
154 | #define HS_FDIAGONAL 2 | |
155 | #define HS_BDIAGONAL 3 | |
156 | #define HS_CROSS 4 | |
157 | #define HS_DIAGCROSS 5 | |
158 | ||
159 | #endif // metafile functions | |
160 | ||
5f331691 | 161 | class WXDLLIMPEXP_OGL wxMetaRecord: public wxObject |
1fc25a89 JS |
162 | { |
163 | public: | |
164 | int metaFunction; | |
165 | long param1; | |
166 | long param2; | |
167 | long param3; | |
168 | long param4; | |
169 | long param5; | |
170 | long param6; | |
171 | long param7; | |
172 | long param8; | |
c1fa2fda | 173 | wxChar *stringParam; |
1fc25a89 | 174 | wxRealPoint *points; |
c1fa2fda | 175 | |
1fc25a89 JS |
176 | wxMetaRecord(int fun) |
177 | { | |
178 | metaFunction = fun; points = NULL; stringParam = NULL; | |
179 | param1 = 0; | |
180 | } | |
181 | ~wxMetaRecord(void); | |
182 | }; | |
183 | ||
5f331691 | 184 | class WXDLLIMPEXP_OGL wxXMetaFile: public wxObject |
1fc25a89 JS |
185 | { |
186 | public: | |
187 | double lastX; | |
188 | double lastY; | |
189 | bool ok; | |
190 | ||
191 | double left; | |
192 | double top; | |
193 | double right; | |
194 | double bottom; | |
195 | ||
196 | wxList metaRecords; | |
197 | wxList gdiObjects; // List of wxMetaRecord objects created with Create..., | |
198 | // referenced by position in list by SelectObject | |
9e053640 | 199 | wxXMetaFile(const wxChar* file = NULL); |
1fc25a89 | 200 | ~wxXMetaFile(void); |
c1fa2fda | 201 | |
1fc25a89 JS |
202 | // After this is called, the metafile cannot be used for anything |
203 | // since it is now owned by the clipboard. | |
204 | bool SetClipboard(int width = 0, int height = 0); | |
205 | ||
206 | bool Play(wxDC *dc); | |
207 | inline bool Ok(void) const { return ok; } | |
9e053640 | 208 | bool ReadFile(const wxChar *file); |
1fc25a89 JS |
209 | }; |
210 | ||
211 | #endif | |
212 | // _MFUTILS_H_ |