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