-
Notifications
You must be signed in to change notification settings - Fork 32
/
emf2svg_rec_state_record.c
268 lines (260 loc) · 8.9 KB
/
emf2svg_rec_state_record.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
#ifdef __cplusplus
extern "C" {
#endif
#ifndef DARWIN
#define _POSIX_C_SOURCE 200809L
#endif
#include "emf2svg_private.h"
#include "emf2svg_print.h"
#include <stdio.h>
void U_EMRINVERTRGN_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_IGNORED;
if (states->verbose) {
U_EMRINVERTRGN_print(contents, states);
}
}
void U_EMRMOVETOEX_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRMOVETOEX_print(contents, states);
}
if (states->inPath) {
fprintf(out, "M ");
moveto_draw("U_EMRMOVETOEX", "ptl:", "", contents, out, states);
} else {
PU_EMRGENERICPAIR pEmr = (PU_EMRGENERICPAIR)(contents);
U_POINT pt = pEmr->pair;
states->cur_x = pt.x;
states->cur_y = pt.y;
}
}
void U_EMRPIXELFORMAT_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_IGNORED;
if (states->verbose) {
U_EMRPIXELFORMAT_print(contents, states);
}
// PU_EMRPIXELFORMAT pEmr = (PU_EMRPIXELFORMAT)(contents);
}
void U_EMRRESTOREDC_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRRESTOREDC_print(contents, states);
}
PU_EMRSETMAPMODE pEmr = (PU_EMRSETMAPMODE)(contents);
restoreDeviceContext(states, pEmr->iMode);
}
void U_EMRSAVEDC_draw(const char *contents, FILE *out, drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRSAVEDC_print(contents, states);
}
saveDeviceContext(states);
UNUSED(contents);
}
void U_EMRSCALEVIEWPORTEXTEX_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_IGNORED;
if (states->verbose) {
U_EMRSCALEVIEWPORTEXTEX_print(contents, states);
}
}
void U_EMRSCALEWINDOWEXTEX_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_IGNORED;
if (states->verbose) {
U_EMRSCALEWINDOWEXTEX_print(contents, states);
}
}
void U_EMRSETARCDIRECTION_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRSETARCDIRECTION_print(contents, states);
}
PU_EMRSETARCDIRECTION pEmr = (PU_EMRSETARCDIRECTION)contents;
switch (pEmr->iArcDirection) {
case U_AD_CLOCKWISE:
states->currentDeviceContext.arcdir = 1;
break;
case U_AD_COUNTERCLOCKWISE:
states->currentDeviceContext.arcdir = -1;
break;
}
}
void U_EMRSETBKCOLOR_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_PARTIAL;
if (states->verbose) {
U_EMRSETBKCOLOR_print(contents, states);
}
PU_EMRSETBKCOLOR pEmr = (PU_EMRSETBKCOLOR)(contents);
states->currentDeviceContext.bk_red = pEmr->crColor.Red;
states->currentDeviceContext.bk_blue = pEmr->crColor.Blue;
states->currentDeviceContext.bk_green = pEmr->crColor.Green;
}
void U_EMRSETBKMODE_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_PARTIAL;
if (states->verbose) {
U_EMRSETBKMODE_print(contents, states);
}
PU_EMRSETMAPMODE pEmr = (PU_EMRSETMAPMODE)(contents);
states->currentDeviceContext.bk_mode = pEmr->iMode;
}
void U_EMRSETBRUSHORGEX_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_UNUSED;
if (states->verbose) {
U_EMRSETBRUSHORGEX_print(contents, states);
}
}
void U_EMRSETCOLORADJUSTMENT_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_IGNORED;
if (states->verbose) {
U_EMRSETCOLORADJUSTMENT_print(contents, states);
}
// PU_EMRSETCOLORADJUSTMENT pEmr = (PU_EMRSETCOLORADJUSTMENT)(contents);
}
void U_EMRSETICMMODE_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_UNUSED;
if (states->verbose) {
U_EMRSETICMMODE_print(contents, states);
}
}
void U_EMRSETLAYOUT_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_PARTIAL;
if (states->verbose) {
U_EMRSETLAYOUT_print(contents, states);
}
PU_EMRSETMAPMODE pEmr = (PU_EMRSETLAYOUT)(contents);
states->text_layout = pEmr->iMode;
}
void U_EMRSETMAPMODE_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_PARTIAL;
PU_EMRSETMAPMODE pEmr = (PU_EMRSETMAPMODE)(contents);
states->MapMode = pEmr->iMode;
if (states->verbose) {
U_EMRSETMAPMODE_print(contents, states);
}
}
void U_EMRSETMAPPERFLAGS_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_IGNORED;
if (states->verbose) {
U_EMRSETMAPPERFLAGS_print(contents, states);
}
// PU_EMRSETMAPPERFLAGS pEmr = (PU_EMRSETMAPPERFLAGS)(contents);
}
void U_EMRSETMETARGN_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_IGNORED;
if (states->verbose) {
U_EMRSETMETARGN_print(contents, states);
}
UNUSED(contents);
}
void U_EMRSETMITERLIMIT_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
PU_EMRSETMITERLIMIT pEmr = (PU_EMRSETMITERLIMIT)(contents);
states->currentDeviceContext.miterLimit = pEmr->eMiterLimit;
if (states->verbose) {
U_EMRSETMITERLIMIT_print(contents, states);
}
}
void U_EMRSETPOLYFILLMODE_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRSETPOLYFILLMODE_print(contents, states);
}
PU_EMRSETMAPMODE pEmr = (PU_EMRSETMAPMODE)(contents);
states->currentDeviceContext.fill_polymode = pEmr->iMode;
}
void U_EMRSETROP2_draw(const char *contents, FILE *out, drawingStates *states) {
FLAG_IGNORED;
if (states->verbose) {
U_EMRSETROP2_print(contents, states);
}
}
void U_EMRSETSTRETCHBLTMODE_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_PARTIAL;
PU_EMRSETMAPMODE pEmr = (PU_EMRSETMAPMODE)(contents);
states->currentDeviceContext.stretchMode = pEmr->iMode;
if (states->verbose) {
U_EMRSETSTRETCHBLTMODE_print(contents, states);
}
}
void U_EMRSETTEXTALIGN_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_PARTIAL;
if (states->verbose) {
U_EMRSETTEXTALIGN_print(contents, states);
}
PU_EMRSETMAPMODE pEmr = (PU_EMRSETMAPMODE)(contents);
states->currentDeviceContext.text_align = pEmr->iMode;
}
void U_EMRSETTEXTCOLOR_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_PARTIAL;
if (states->verbose) {
U_EMRSETTEXTCOLOR_print(contents, states);
}
PU_EMRSETTEXTCOLOR pEmr = (PU_EMRSETTEXTCOLOR)(contents);
states->currentDeviceContext.text_red = pEmr->crColor.Red;
states->currentDeviceContext.text_blue = pEmr->crColor.Blue;
states->currentDeviceContext.text_green = pEmr->crColor.Green;
}
void U_EMRSETVIEWPORTEXTEX_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRSETVIEWPORTEXTEX_print(contents, states);
}
PU_EMRSETVIEWPORTEXTEX pEmr = (PU_EMRSETVIEWPORTEXTEX)(contents);
states->viewPortExX = (double)pEmr->szlExtent.cx;
states->viewPortExY = (double)pEmr->szlExtent.cy;
}
void U_EMRSETVIEWPORTORGEX_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRSETVIEWPORTORGEX_print(contents, states);
}
PU_EMRSETVIEWPORTORGEX pEmr = (PU_EMRSETVIEWPORTORGEX)(contents);
states->viewPortOrgX = (double)pEmr->ptlOrigin.x;
states->viewPortOrgY = (double)pEmr->ptlOrigin.y;
}
void U_EMRSETWINDOWEXTEX_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRSETWINDOWEXTEX_print(contents, states);
}
PU_EMRSETWINDOWEXTEX pEmr = (PU_EMRSETVIEWPORTEXTEX)(contents);
states->windowExX = (double)pEmr->szlExtent.cx;
states->windowExY = (double)pEmr->szlExtent.cy;
}
void U_EMRSETWINDOWORGEX_draw(const char *contents, FILE *out,
drawingStates *states) {
FLAG_SUPPORTED;
if (states->verbose) {
U_EMRSETWINDOWORGEX_print(contents, states);
}
PU_EMRSETWINDOWORGEX pEmr = (PU_EMRSETWINDOWORGEX)(contents);
states->windowOrgX = (double)pEmr->ptlOrigin.x;
states->windowOrgY = (double)pEmr->ptlOrigin.y;
}
#ifdef __cplusplus
}
#endif
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */