Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
svg-path-parser.cpp
Go to the documentation of this file.
1
2#line 1 "svg-path-parser.rl"
35#include <cstdio>
36#include <cmath>
37#include <vector>
38#include <glib.h>
39
40#include <2geom/point.h>
42#include <2geom/angle.h>
43
44namespace Geom {
45
46
47#line 48 "svg-path-parser.cpp"
48static const char _svg_path_actions[] = {
49 0, 1, 0, 1, 1, 1, 2, 1,
50 3, 1, 4, 1, 5, 1, 15, 2,
51 1, 0, 2, 1, 6, 2, 1, 7,
52 2, 1, 8, 2, 1, 9, 2, 1,
53 10, 2, 1, 11, 2, 1, 12, 2,
54 1, 13, 2, 1, 14, 2, 2, 0,
55 2, 3, 0, 2, 4, 0, 2, 5,
56 0, 3, 1, 6, 0, 3, 1, 7,
57 0, 3, 1, 8, 0, 3, 1, 9,
58 0, 3, 1, 10, 0, 3, 1, 11,
59 0, 3, 1, 12, 0, 3, 1, 13,
60 0, 3, 1, 14, 0
61};
62
63static const short _svg_path_key_offsets[] = {
64 0, 0, 9, 18, 21, 23, 35, 45,
65 48, 50, 53, 55, 67, 77, 80, 82,
66 91, 103, 112, 121, 130, 133, 135, 147,
67 157, 160, 162, 174, 184, 187, 189, 198,
68 205, 211, 218, 225, 231, 241, 251, 254,
69 256, 268, 278, 281, 283, 295, 304, 316,
70 325, 335, 339, 341, 348, 352, 354, 364,
71 368, 370, 380, 389, 398, 401, 403, 415,
72 425, 428, 430, 442, 452, 455, 457, 469,
73 479, 482, 484, 496, 506, 509, 511, 523,
74 533, 536, 538, 550, 559, 571, 580, 592,
75 601, 613, 622, 634, 643, 647, 649, 658,
76 667, 670, 672, 676, 678, 687, 696, 705,
77 708, 710, 722, 732, 735, 737, 749, 759,
78 762, 764, 776, 786, 789, 791, 803, 812,
79 824, 833, 845, 854, 858, 860, 869, 878,
80 881, 883, 895, 905, 908, 910, 922, 932,
81 935, 937, 949, 959, 962, 964, 976, 985,
82 997, 1006, 1018, 1027, 1031, 1033, 1042, 1051,
83 1054, 1056, 1068, 1078, 1081, 1083, 1095, 1104,
84 1108, 1110, 1119, 1128, 1131, 1133, 1137, 1139,
85 1148, 1157, 1166, 1175, 1184, 1196, 1205, 1209,
86 1211, 1220, 1229, 1238, 1247, 1251, 1253, 1263,
87 1267, 1269, 1279, 1283, 1285, 1295, 1299, 1301,
88 1311, 1315, 1317, 1327, 1331, 1333, 1343, 1347,
89 1349, 1359, 1363, 1365, 1375, 1379, 1381, 1391,
90 1395, 1397, 1407, 1411, 1413, 1423, 1427, 1429,
91 1439, 1443, 1445, 1455, 1459, 1461, 1470, 1474,
92 1476, 1486, 1498, 1507, 1517, 1524, 1528, 1530,
93 1534, 1536, 1546, 1552, 1584, 1614, 1646, 1678,
94 1710, 1740, 1772, 1802, 1834, 1864, 1896, 1926,
95 1958, 1988, 2020, 2050, 2082, 2112, 2144, 2174,
96 2206, 2236, 2268, 2298, 2330, 2360, 2392, 2422,
97 2454, 2484, 2508, 2532, 2564, 2594, 2624, 2656
98};
99
100static const char _svg_path_trans_keys[] = {
101 13, 32, 43, 45, 46, 9, 10, 48,
102 57, 13, 32, 43, 45, 46, 9, 10,
103 48, 57, 46, 48, 57, 48, 57, 13,
104 32, 44, 46, 69, 101, 9, 10, 43,
105 45, 48, 57, 13, 32, 44, 46, 9,
106 10, 43, 45, 48, 57, 46, 48, 57,
107 48, 57, 46, 48, 57, 48, 57, 13,
108 32, 44, 46, 69, 101, 9, 10, 43,
109 45, 48, 57, 13, 32, 44, 46, 9,
110 10, 43, 45, 48, 57, 46, 48, 57,
111 48, 57, 13, 32, 43, 45, 46, 9,
112 10, 48, 57, 13, 32, 44, 46, 69,
113 101, 9, 10, 43, 45, 48, 57, 13,
114 32, 43, 45, 46, 9, 10, 48, 57,
115 13, 32, 43, 45, 46, 9, 10, 48,
116 57, 13, 32, 43, 45, 46, 9, 10,
117 48, 57, 46, 48, 57, 48, 57, 13,
118 32, 44, 46, 69, 101, 9, 10, 43,
119 45, 48, 57, 13, 32, 44, 46, 9,
120 10, 43, 45, 48, 57, 46, 48, 57,
121 48, 57, 13, 32, 44, 46, 69, 101,
122 9, 10, 43, 45, 48, 57, 13, 32,
123 44, 46, 9, 10, 43, 45, 48, 57,
124 46, 48, 57, 48, 57, 13, 32, 44,
125 69, 101, 9, 10, 48, 57, 13, 32,
126 44, 48, 49, 9, 10, 13, 32, 48,
127 49, 9, 10, 13, 32, 44, 48, 49,
128 9, 10, 13, 32, 44, 48, 49, 9,
129 10, 13, 32, 48, 49, 9, 10, 13,
130 32, 44, 46, 9, 10, 43, 45, 48,
131 57, 13, 32, 44, 46, 9, 10, 43,
132 45, 48, 57, 46, 48, 57, 48, 57,
133 13, 32, 44, 46, 69, 101, 9, 10,
134 43, 45, 48, 57, 13, 32, 44, 46,
135 9, 10, 43, 45, 48, 57, 46, 48,
136 57, 48, 57, 13, 32, 44, 46, 69,
137 101, 9, 10, 43, 45, 48, 57, 13,
138 32, 43, 45, 46, 9, 10, 48, 57,
139 13, 32, 44, 46, 69, 101, 9, 10,
140 43, 45, 48, 57, 13, 32, 43, 45,
141 46, 9, 10, 48, 57, 13, 32, 44,
142 46, 69, 101, 9, 10, 48, 57, 43,
143 45, 48, 57, 48, 57, 13, 32, 44,
144 9, 10, 48, 57, 43, 45, 48, 57,
145 48, 57, 13, 32, 44, 46, 9, 10,
146 43, 45, 48, 57, 43, 45, 48, 57,
147 48, 57, 13, 32, 44, 46, 9, 10,
148 43, 45, 48, 57, 13, 32, 43, 45,
149 46, 9, 10, 48, 57, 13, 32, 43,
150 45, 46, 9, 10, 48, 57, 46, 48,
151 57, 48, 57, 13, 32, 44, 46, 69,
152 101, 9, 10, 43, 45, 48, 57, 13,
153 32, 44, 46, 9, 10, 43, 45, 48,
154 57, 46, 48, 57, 48, 57, 13, 32,
155 44, 46, 69, 101, 9, 10, 43, 45,
156 48, 57, 13, 32, 44, 46, 9, 10,
157 43, 45, 48, 57, 46, 48, 57, 48,
158 57, 13, 32, 44, 46, 69, 101, 9,
159 10, 43, 45, 48, 57, 13, 32, 44,
160 46, 9, 10, 43, 45, 48, 57, 46,
161 48, 57, 48, 57, 13, 32, 44, 46,
162 69, 101, 9, 10, 43, 45, 48, 57,
163 13, 32, 44, 46, 9, 10, 43, 45,
164 48, 57, 46, 48, 57, 48, 57, 13,
165 32, 44, 46, 69, 101, 9, 10, 43,
166 45, 48, 57, 13, 32, 44, 46, 9,
167 10, 43, 45, 48, 57, 46, 48, 57,
168 48, 57, 13, 32, 44, 46, 69, 101,
169 9, 10, 43, 45, 48, 57, 13, 32,
170 43, 45, 46, 9, 10, 48, 57, 13,
171 32, 44, 46, 69, 101, 9, 10, 43,
172 45, 48, 57, 13, 32, 43, 45, 46,
173 9, 10, 48, 57, 13, 32, 44, 46,
174 69, 101, 9, 10, 43, 45, 48, 57,
175 13, 32, 43, 45, 46, 9, 10, 48,
176 57, 13, 32, 44, 46, 69, 101, 9,
177 10, 43, 45, 48, 57, 13, 32, 43,
178 45, 46, 9, 10, 48, 57, 13, 32,
179 44, 46, 69, 101, 9, 10, 43, 45,
180 48, 57, 13, 32, 43, 45, 46, 9,
181 10, 48, 57, 43, 45, 48, 57, 48,
182 57, 13, 32, 43, 45, 46, 9, 10,
183 48, 57, 13, 32, 43, 45, 46, 9,
184 10, 48, 57, 46, 48, 57, 48, 57,
185 43, 45, 48, 57, 48, 57, 13, 32,
186 43, 45, 46, 9, 10, 48, 57, 13,
187 32, 43, 45, 46, 9, 10, 48, 57,
188 13, 32, 43, 45, 46, 9, 10, 48,
189 57, 46, 48, 57, 48, 57, 13, 32,
190 44, 46, 69, 101, 9, 10, 43, 45,
191 48, 57, 13, 32, 44, 46, 9, 10,
192 43, 45, 48, 57, 46, 48, 57, 48,
193 57, 13, 32, 44, 46, 69, 101, 9,
194 10, 43, 45, 48, 57, 13, 32, 44,
195 46, 9, 10, 43, 45, 48, 57, 46,
196 48, 57, 48, 57, 13, 32, 44, 46,
197 69, 101, 9, 10, 43, 45, 48, 57,
198 13, 32, 44, 46, 9, 10, 43, 45,
199 48, 57, 46, 48, 57, 48, 57, 13,
200 32, 44, 46, 69, 101, 9, 10, 43,
201 45, 48, 57, 13, 32, 43, 45, 46,
202 9, 10, 48, 57, 13, 32, 44, 46,
203 69, 101, 9, 10, 43, 45, 48, 57,
204 13, 32, 43, 45, 46, 9, 10, 48,
205 57, 13, 32, 44, 46, 69, 101, 9,
206 10, 43, 45, 48, 57, 13, 32, 43,
207 45, 46, 9, 10, 48, 57, 43, 45,
208 48, 57, 48, 57, 13, 32, 43, 45,
209 46, 9, 10, 48, 57, 13, 32, 43,
210 45, 46, 9, 10, 48, 57, 46, 48,
211 57, 48, 57, 13, 32, 44, 46, 69,
212 101, 9, 10, 43, 45, 48, 57, 13,
213 32, 44, 46, 9, 10, 43, 45, 48,
214 57, 46, 48, 57, 48, 57, 13, 32,
215 44, 46, 69, 101, 9, 10, 43, 45,
216 48, 57, 13, 32, 44, 46, 9, 10,
217 43, 45, 48, 57, 46, 48, 57, 48,
218 57, 13, 32, 44, 46, 69, 101, 9,
219 10, 43, 45, 48, 57, 13, 32, 44,
220 46, 9, 10, 43, 45, 48, 57, 46,
221 48, 57, 48, 57, 13, 32, 44, 46,
222 69, 101, 9, 10, 43, 45, 48, 57,
223 13, 32, 43, 45, 46, 9, 10, 48,
224 57, 13, 32, 44, 46, 69, 101, 9,
225 10, 43, 45, 48, 57, 13, 32, 43,
226 45, 46, 9, 10, 48, 57, 13, 32,
227 44, 46, 69, 101, 9, 10, 43, 45,
228 48, 57, 13, 32, 43, 45, 46, 9,
229 10, 48, 57, 43, 45, 48, 57, 48,
230 57, 13, 32, 43, 45, 46, 9, 10,
231 48, 57, 13, 32, 43, 45, 46, 9,
232 10, 48, 57, 46, 48, 57, 48, 57,
233 13, 32, 44, 46, 69, 101, 9, 10,
234 43, 45, 48, 57, 13, 32, 44, 46,
235 9, 10, 43, 45, 48, 57, 46, 48,
236 57, 48, 57, 13, 32, 44, 46, 69,
237 101, 9, 10, 43, 45, 48, 57, 13,
238 32, 43, 45, 46, 9, 10, 48, 57,
239 43, 45, 48, 57, 48, 57, 13, 32,
240 43, 45, 46, 9, 10, 48, 57, 13,
241 32, 43, 45, 46, 9, 10, 48, 57,
242 46, 48, 57, 48, 57, 43, 45, 48,
243 57, 48, 57, 13, 32, 43, 45, 46,
244 9, 10, 48, 57, 13, 32, 43, 45,
245 46, 9, 10, 48, 57, 13, 32, 43,
246 45, 46, 9, 10, 48, 57, 13, 32,
247 43, 45, 46, 9, 10, 48, 57, 13,
248 32, 43, 45, 46, 9, 10, 48, 57,
249 13, 32, 44, 46, 69, 101, 9, 10,
250 43, 45, 48, 57, 13, 32, 43, 45,
251 46, 9, 10, 48, 57, 43, 45, 48,
252 57, 48, 57, 13, 32, 43, 45, 46,
253 9, 10, 48, 57, 13, 32, 43, 45,
254 46, 9, 10, 48, 57, 13, 32, 43,
255 45, 46, 9, 10, 48, 57, 13, 32,
256 43, 45, 46, 9, 10, 48, 57, 43,
257 45, 48, 57, 48, 57, 13, 32, 44,
258 46, 9, 10, 43, 45, 48, 57, 43,
259 45, 48, 57, 48, 57, 13, 32, 44,
260 46, 9, 10, 43, 45, 48, 57, 43,
261 45, 48, 57, 48, 57, 13, 32, 44,
262 46, 9, 10, 43, 45, 48, 57, 43,
263 45, 48, 57, 48, 57, 13, 32, 44,
264 46, 9, 10, 43, 45, 48, 57, 43,
265 45, 48, 57, 48, 57, 13, 32, 44,
266 46, 9, 10, 43, 45, 48, 57, 43,
267 45, 48, 57, 48, 57, 13, 32, 44,
268 46, 9, 10, 43, 45, 48, 57, 43,
269 45, 48, 57, 48, 57, 13, 32, 44,
270 46, 9, 10, 43, 45, 48, 57, 43,
271 45, 48, 57, 48, 57, 13, 32, 44,
272 46, 9, 10, 43, 45, 48, 57, 43,
273 45, 48, 57, 48, 57, 13, 32, 44,
274 46, 9, 10, 43, 45, 48, 57, 43,
275 45, 48, 57, 48, 57, 13, 32, 44,
276 46, 9, 10, 43, 45, 48, 57, 43,
277 45, 48, 57, 48, 57, 13, 32, 44,
278 46, 9, 10, 43, 45, 48, 57, 43,
279 45, 48, 57, 48, 57, 13, 32, 44,
280 46, 9, 10, 43, 45, 48, 57, 43,
281 45, 48, 57, 48, 57, 13, 32, 44,
282 46, 9, 10, 43, 45, 48, 57, 43,
283 45, 48, 57, 48, 57, 13, 32, 43,
284 45, 46, 9, 10, 48, 57, 43, 45,
285 48, 57, 48, 57, 13, 32, 44, 46,
286 9, 10, 43, 45, 48, 57, 13, 32,
287 44, 46, 69, 101, 9, 10, 43, 45,
288 48, 57, 13, 32, 43, 45, 46, 9,
289 10, 48, 57, 13, 32, 44, 46, 9,
290 10, 43, 45, 48, 57, 13, 32, 44,
291 48, 49, 9, 10, 43, 45, 48, 57,
292 48, 57, 43, 45, 48, 57, 48, 57,
293 13, 32, 44, 46, 9, 10, 43, 45,
294 48, 57, 13, 32, 77, 109, 9, 10,
295 13, 32, 44, 46, 65, 67, 69, 72,
296 76, 77, 81, 83, 84, 86, 90, 97,
297 99, 101, 104, 108, 109, 113, 115, 116,
298 118, 122, 9, 10, 43, 45, 48, 57,
299 13, 32, 44, 46, 65, 67, 72, 76,
300 77, 81, 83, 84, 86, 90, 97, 99,
301 104, 108, 109, 113, 115, 116, 118, 122,
302 9, 10, 43, 45, 48, 57, 13, 32,
303 44, 46, 65, 67, 69, 72, 76, 77,
304 81, 83, 84, 86, 90, 97, 99, 101,
305 104, 108, 109, 113, 115, 116, 118, 122,
306 9, 10, 43, 45, 48, 57, 13, 32,
307 44, 46, 65, 67, 69, 72, 76, 77,
308 81, 83, 84, 86, 90, 97, 99, 101,
309 104, 108, 109, 113, 115, 116, 118, 122,
310 9, 10, 43, 45, 48, 57, 13, 32,
311 44, 46, 65, 67, 69, 72, 76, 77,
312 81, 83, 84, 86, 90, 97, 99, 101,
313 104, 108, 109, 113, 115, 116, 118, 122,
314 9, 10, 43, 45, 48, 57, 13, 32,
315 44, 46, 65, 67, 72, 76, 77, 81,
316 83, 84, 86, 90, 97, 99, 104, 108,
317 109, 113, 115, 116, 118, 122, 9, 10,
318 43, 45, 48, 57, 13, 32, 44, 46,
319 65, 67, 69, 72, 76, 77, 81, 83,
320 84, 86, 90, 97, 99, 101, 104, 108,
321 109, 113, 115, 116, 118, 122, 9, 10,
322 43, 45, 48, 57, 13, 32, 44, 46,
323 65, 67, 72, 76, 77, 81, 83, 84,
324 86, 90, 97, 99, 104, 108, 109, 113,
325 115, 116, 118, 122, 9, 10, 43, 45,
326 48, 57, 13, 32, 44, 46, 65, 67,
327 69, 72, 76, 77, 81, 83, 84, 86,
328 90, 97, 99, 101, 104, 108, 109, 113,
329 115, 116, 118, 122, 9, 10, 43, 45,
330 48, 57, 13, 32, 44, 46, 65, 67,
331 72, 76, 77, 81, 83, 84, 86, 90,
332 97, 99, 104, 108, 109, 113, 115, 116,
333 118, 122, 9, 10, 43, 45, 48, 57,
334 13, 32, 44, 46, 65, 67, 69, 72,
335 76, 77, 81, 83, 84, 86, 90, 97,
336 99, 101, 104, 108, 109, 113, 115, 116,
337 118, 122, 9, 10, 43, 45, 48, 57,
338 13, 32, 44, 46, 65, 67, 72, 76,
339 77, 81, 83, 84, 86, 90, 97, 99,
340 104, 108, 109, 113, 115, 116, 118, 122,
341 9, 10, 43, 45, 48, 57, 13, 32,
342 44, 46, 65, 67, 69, 72, 76, 77,
343 81, 83, 84, 86, 90, 97, 99, 101,
344 104, 108, 109, 113, 115, 116, 118, 122,
345 9, 10, 43, 45, 48, 57, 13, 32,
346 44, 46, 65, 67, 72, 76, 77, 81,
347 83, 84, 86, 90, 97, 99, 104, 108,
348 109, 113, 115, 116, 118, 122, 9, 10,
349 43, 45, 48, 57, 13, 32, 44, 46,
350 65, 67, 69, 72, 76, 77, 81, 83,
351 84, 86, 90, 97, 99, 101, 104, 108,
352 109, 113, 115, 116, 118, 122, 9, 10,
353 43, 45, 48, 57, 13, 32, 44, 46,
354 65, 67, 72, 76, 77, 81, 83, 84,
355 86, 90, 97, 99, 104, 108, 109, 113,
356 115, 116, 118, 122, 9, 10, 43, 45,
357 48, 57, 13, 32, 44, 46, 65, 67,
358 69, 72, 76, 77, 81, 83, 84, 86,
359 90, 97, 99, 101, 104, 108, 109, 113,
360 115, 116, 118, 122, 9, 10, 43, 45,
361 48, 57, 13, 32, 44, 46, 65, 67,
362 72, 76, 77, 81, 83, 84, 86, 90,
363 97, 99, 104, 108, 109, 113, 115, 116,
364 118, 122, 9, 10, 43, 45, 48, 57,
365 13, 32, 44, 46, 65, 67, 69, 72,
366 76, 77, 81, 83, 84, 86, 90, 97,
367 99, 101, 104, 108, 109, 113, 115, 116,
368 118, 122, 9, 10, 43, 45, 48, 57,
369 13, 32, 44, 46, 65, 67, 72, 76,
370 77, 81, 83, 84, 86, 90, 97, 99,
371 104, 108, 109, 113, 115, 116, 118, 122,
372 9, 10, 43, 45, 48, 57, 13, 32,
373 44, 46, 65, 67, 69, 72, 76, 77,
374 81, 83, 84, 86, 90, 97, 99, 101,
375 104, 108, 109, 113, 115, 116, 118, 122,
376 9, 10, 43, 45, 48, 57, 13, 32,
377 44, 46, 65, 67, 72, 76, 77, 81,
378 83, 84, 86, 90, 97, 99, 104, 108,
379 109, 113, 115, 116, 118, 122, 9, 10,
380 43, 45, 48, 57, 13, 32, 44, 46,
381 65, 67, 69, 72, 76, 77, 81, 83,
382 84, 86, 90, 97, 99, 101, 104, 108,
383 109, 113, 115, 116, 118, 122, 9, 10,
384 43, 45, 48, 57, 13, 32, 44, 46,
385 65, 67, 72, 76, 77, 81, 83, 84,
386 86, 90, 97, 99, 104, 108, 109, 113,
387 115, 116, 118, 122, 9, 10, 43, 45,
388 48, 57, 13, 32, 44, 46, 65, 67,
389 69, 72, 76, 77, 81, 83, 84, 86,
390 90, 97, 99, 101, 104, 108, 109, 113,
391 115, 116, 118, 122, 9, 10, 43, 45,
392 48, 57, 13, 32, 44, 46, 65, 67,
393 72, 76, 77, 81, 83, 84, 86, 90,
394 97, 99, 104, 108, 109, 113, 115, 116,
395 118, 122, 9, 10, 43, 45, 48, 57,
396 13, 32, 44, 46, 65, 67, 69, 72,
397 76, 77, 81, 83, 84, 86, 90, 97,
398 99, 101, 104, 108, 109, 113, 115, 116,
399 118, 122, 9, 10, 43, 45, 48, 57,
400 13, 32, 44, 46, 65, 67, 72, 76,
401 77, 81, 83, 84, 86, 90, 97, 99,
402 104, 108, 109, 113, 115, 116, 118, 122,
403 9, 10, 43, 45, 48, 57, 13, 32,
404 44, 46, 65, 67, 69, 72, 76, 77,
405 81, 83, 84, 86, 90, 97, 99, 101,
406 104, 108, 109, 113, 115, 116, 118, 122,
407 9, 10, 43, 45, 48, 57, 13, 32,
408 44, 46, 65, 67, 72, 76, 77, 81,
409 83, 84, 86, 90, 97, 99, 104, 108,
410 109, 113, 115, 116, 118, 122, 9, 10,
411 43, 45, 48, 57, 13, 32, 65, 67,
412 72, 76, 77, 81, 83, 84, 86, 90,
413 97, 99, 104, 108, 109, 113, 115, 116,
414 118, 122, 9, 10, 13, 32, 65, 67,
415 72, 76, 77, 81, 83, 84, 86, 90,
416 97, 99, 104, 108, 109, 113, 115, 116,
417 118, 122, 9, 10, 13, 32, 44, 46,
418 65, 67, 69, 72, 76, 77, 81, 83,
419 84, 86, 90, 97, 99, 101, 104, 108,
420 109, 113, 115, 116, 118, 122, 9, 10,
421 43, 45, 48, 57, 13, 32, 44, 46,
422 65, 67, 72, 76, 77, 81, 83, 84,
423 86, 90, 97, 99, 104, 108, 109, 113,
424 115, 116, 118, 122, 9, 10, 43, 45,
425 48, 57, 13, 32, 44, 46, 65, 67,
426 72, 76, 77, 81, 83, 84, 86, 90,
427 97, 99, 104, 108, 109, 113, 115, 116,
428 118, 122, 9, 10, 43, 45, 48, 57,
429 13, 32, 44, 46, 65, 67, 69, 72,
430 76, 77, 81, 83, 84, 86, 90, 97,
431 99, 101, 104, 108, 109, 113, 115, 116,
432 118, 122, 9, 10, 43, 45, 48, 57,
433 13, 32, 44, 46, 65, 67, 72, 76,
434 77, 81, 83, 84, 86, 90, 97, 99,
435 104, 108, 109, 113, 115, 116, 118, 122,
436 9, 10, 43, 45, 48, 57, 0
437};
438
439static const char _svg_path_single_lengths[] = {
440 0, 5, 5, 1, 0, 6, 4, 1,
441 0, 1, 0, 6, 4, 1, 0, 5,
442 6, 5, 5, 5, 1, 0, 6, 4,
443 1, 0, 6, 4, 1, 0, 5, 5,
444 4, 5, 5, 4, 4, 4, 1, 0,
445 6, 4, 1, 0, 6, 5, 6, 5,
446 6, 2, 0, 3, 2, 0, 4, 2,
447 0, 4, 5, 5, 1, 0, 6, 4,
448 1, 0, 6, 4, 1, 0, 6, 4,
449 1, 0, 6, 4, 1, 0, 6, 4,
450 1, 0, 6, 5, 6, 5, 6, 5,
451 6, 5, 6, 5, 2, 0, 5, 5,
452 1, 0, 2, 0, 5, 5, 5, 1,
453 0, 6, 4, 1, 0, 6, 4, 1,
454 0, 6, 4, 1, 0, 6, 5, 6,
455 5, 6, 5, 2, 0, 5, 5, 1,
456 0, 6, 4, 1, 0, 6, 4, 1,
457 0, 6, 4, 1, 0, 6, 5, 6,
458 5, 6, 5, 2, 0, 5, 5, 1,
459 0, 6, 4, 1, 0, 6, 5, 2,
460 0, 5, 5, 1, 0, 2, 0, 5,
461 5, 5, 5, 5, 6, 5, 2, 0,
462 5, 5, 5, 5, 2, 0, 4, 2,
463 0, 4, 2, 0, 4, 2, 0, 4,
464 2, 0, 4, 2, 0, 4, 2, 0,
465 4, 2, 0, 4, 2, 0, 4, 2,
466 0, 4, 2, 0, 4, 2, 0, 4,
467 2, 0, 4, 2, 0, 5, 2, 0,
468 4, 6, 5, 4, 5, 2, 0, 2,
469 0, 4, 4, 26, 24, 26, 26, 26,
470 24, 26, 24, 26, 24, 26, 24, 26,
471 24, 26, 24, 26, 24, 26, 24, 26,
472 24, 26, 24, 26, 24, 26, 24, 26,
473 24, 22, 22, 26, 24, 24, 26, 24
474};
475
476static const char _svg_path_range_lengths[] = {
477 0, 2, 2, 1, 1, 3, 3, 1,
478 1, 1, 1, 3, 3, 1, 1, 2,
479 3, 2, 2, 2, 1, 1, 3, 3,
480 1, 1, 3, 3, 1, 1, 2, 1,
481 1, 1, 1, 1, 3, 3, 1, 1,
482 3, 3, 1, 1, 3, 2, 3, 2,
483 2, 1, 1, 2, 1, 1, 3, 1,
484 1, 3, 2, 2, 1, 1, 3, 3,
485 1, 1, 3, 3, 1, 1, 3, 3,
486 1, 1, 3, 3, 1, 1, 3, 3,
487 1, 1, 3, 2, 3, 2, 3, 2,
488 3, 2, 3, 2, 1, 1, 2, 2,
489 1, 1, 1, 1, 2, 2, 2, 1,
490 1, 3, 3, 1, 1, 3, 3, 1,
491 1, 3, 3, 1, 1, 3, 2, 3,
492 2, 3, 2, 1, 1, 2, 2, 1,
493 1, 3, 3, 1, 1, 3, 3, 1,
494 1, 3, 3, 1, 1, 3, 2, 3,
495 2, 3, 2, 1, 1, 2, 2, 1,
496 1, 3, 3, 1, 1, 3, 2, 1,
497 1, 2, 2, 1, 1, 1, 1, 2,
498 2, 2, 2, 2, 3, 2, 1, 1,
499 2, 2, 2, 2, 1, 1, 3, 1,
500 1, 3, 1, 1, 3, 1, 1, 3,
501 1, 1, 3, 1, 1, 3, 1, 1,
502 3, 1, 1, 3, 1, 1, 3, 1,
503 1, 3, 1, 1, 3, 1, 1, 3,
504 1, 1, 3, 1, 1, 2, 1, 1,
505 3, 3, 2, 3, 1, 1, 1, 1,
506 1, 3, 1, 3, 3, 3, 3, 3,
507 3, 3, 3, 3, 3, 3, 3, 3,
508 3, 3, 3, 3, 3, 3, 3, 3,
509 3, 3, 3, 3, 3, 3, 3, 3,
510 3, 1, 1, 3, 3, 3, 3, 3
511};
512
513static const short _svg_path_index_offsets[] = {
514 0, 0, 8, 16, 19, 21, 31, 39,
515 42, 44, 47, 49, 59, 67, 70, 72,
516 80, 90, 98, 106, 114, 117, 119, 129,
517 137, 140, 142, 152, 160, 163, 165, 173,
518 180, 186, 193, 200, 206, 214, 222, 225,
519 227, 237, 245, 248, 250, 260, 268, 278,
520 286, 295, 299, 301, 307, 311, 313, 321,
521 325, 327, 335, 343, 351, 354, 356, 366,
522 374, 377, 379, 389, 397, 400, 402, 412,
523 420, 423, 425, 435, 443, 446, 448, 458,
524 466, 469, 471, 481, 489, 499, 507, 517,
525 525, 535, 543, 553, 561, 565, 567, 575,
526 583, 586, 588, 592, 594, 602, 610, 618,
527 621, 623, 633, 641, 644, 646, 656, 664,
528 667, 669, 679, 687, 690, 692, 702, 710,
529 720, 728, 738, 746, 750, 752, 760, 768,
530 771, 773, 783, 791, 794, 796, 806, 814,
531 817, 819, 829, 837, 840, 842, 852, 860,
532 870, 878, 888, 896, 900, 902, 910, 918,
533 921, 923, 933, 941, 944, 946, 956, 964,
534 968, 970, 978, 986, 989, 991, 995, 997,
535 1005, 1013, 1021, 1029, 1037, 1047, 1055, 1059,
536 1061, 1069, 1077, 1085, 1093, 1097, 1099, 1107,
537 1111, 1113, 1121, 1125, 1127, 1135, 1139, 1141,
538 1149, 1153, 1155, 1163, 1167, 1169, 1177, 1181,
539 1183, 1191, 1195, 1197, 1205, 1209, 1211, 1219,
540 1223, 1225, 1233, 1237, 1239, 1247, 1251, 1253,
541 1261, 1265, 1267, 1275, 1279, 1281, 1289, 1293,
542 1295, 1303, 1313, 1321, 1329, 1336, 1340, 1342,
543 1346, 1348, 1356, 1362, 1392, 1420, 1450, 1480,
544 1510, 1538, 1568, 1596, 1626, 1654, 1684, 1712,
545 1742, 1770, 1800, 1828, 1858, 1886, 1916, 1944,
546 1974, 2002, 2032, 2060, 2090, 2118, 2148, 2176,
547 2206, 2234, 2258, 2282, 2312, 2340, 2368, 2398
548};
549
550static const short _svg_path_indicies[] = {
551 0, 0, 2, 2, 3, 0, 4, 1,
552 5, 5, 6, 6, 7, 5, 8, 1,
553 9, 10, 1, 11, 1, 12, 12, 14,
554 15, 16, 16, 12, 13, 11, 1, 17,
555 17, 19, 20, 17, 18, 21, 1, 22,
556 23, 1, 24, 1, 25, 26, 1, 27,
557 1, 28, 28, 30, 31, 32, 32, 28,
558 29, 27, 1, 33, 33, 35, 36, 33,
559 34, 37, 1, 38, 39, 1, 40, 1,
560 41, 41, 42, 42, 43, 41, 44, 1,
561 28, 28, 30, 27, 32, 32, 28, 29,
562 26, 1, 35, 35, 34, 34, 36, 35,
563 37, 1, 45, 45, 46, 46, 47, 45,
564 48, 1, 49, 49, 50, 50, 51, 49,
565 52, 1, 53, 54, 1, 55, 1, 56,
566 56, 58, 59, 60, 60, 56, 57, 55,
567 1, 61, 61, 63, 64, 61, 62, 65,
568 1, 66, 67, 1, 68, 1, 69, 69,
569 71, 72, 73, 73, 69, 70, 68, 1,
570 74, 74, 76, 77, 74, 75, 78, 1,
571 79, 80, 1, 81, 1, 82, 82, 83,
572 84, 84, 82, 81, 1, 85, 85, 86,
573 87, 88, 85, 1, 86, 86, 87, 88,
574 86, 1, 89, 89, 90, 91, 92, 89,
575 1, 93, 93, 94, 95, 96, 93, 1,
576 94, 94, 95, 96, 94, 1, 97, 97,
577 99, 100, 97, 98, 101, 1, 102, 102,
578 104, 105, 102, 103, 106, 1, 107, 108,
579 1, 109, 1, 110, 110, 112, 113, 114,
580 114, 110, 111, 109, 1, 115, 115, 117,
581 118, 115, 116, 119, 1, 120, 121, 1,
582 122, 1, 56, 56, 58, 55, 60, 60,
583 56, 57, 54, 1, 63, 63, 62, 62,
584 64, 63, 65, 1, 69, 69, 71, 68,
585 73, 73, 69, 70, 67, 1, 76, 76,
586 75, 75, 77, 76, 78, 1, 82, 82,
587 83, 81, 84, 84, 82, 80, 1, 123,
588 123, 124, 1, 124, 1, 82, 82, 83,
589 82, 124, 1, 125, 125, 126, 1, 126,
590 1, 69, 69, 71, 72, 69, 70, 126,
591 1, 127, 127, 128, 1, 128, 1, 56,
592 56, 58, 59, 56, 57, 128, 1, 129,
593 129, 130, 130, 131, 129, 132, 1, 133,
594 133, 134, 134, 135, 133, 136, 1, 137,
595 138, 1, 139, 1, 140, 140, 142, 143,
596 144, 144, 140, 141, 139, 1, 145, 145,
597 147, 148, 145, 146, 149, 1, 150, 151,
598 1, 152, 1, 153, 153, 155, 156, 157,
599 157, 153, 154, 152, 1, 158, 158, 160,
600 161, 158, 159, 162, 1, 163, 164, 1,
601 165, 1, 166, 166, 168, 169, 170, 170,
602 166, 167, 165, 1, 171, 171, 173, 174,
603 171, 172, 175, 1, 176, 177, 1, 178,
604 1, 179, 179, 181, 182, 183, 183, 179,
605 180, 178, 1, 184, 184, 186, 187, 184,
606 185, 188, 1, 189, 190, 1, 191, 1,
607 192, 192, 194, 195, 196, 196, 192, 193,
608 191, 1, 197, 197, 199, 200, 197, 198,
609 201, 1, 202, 203, 1, 204, 1, 140,
610 140, 142, 139, 144, 144, 140, 141, 138,
611 1, 147, 147, 146, 146, 148, 147, 149,
612 1, 153, 153, 155, 152, 157, 157, 153,
613 154, 151, 1, 160, 160, 159, 159, 161,
614 160, 162, 1, 166, 166, 168, 165, 170,
615 170, 166, 167, 164, 1, 173, 173, 172,
616 172, 174, 173, 175, 1, 179, 179, 181,
617 178, 183, 183, 179, 180, 177, 1, 186,
618 186, 185, 185, 187, 186, 188, 1, 192,
619 192, 194, 191, 196, 196, 192, 193, 190,
620 1, 199, 199, 198, 198, 200, 199, 201,
621 1, 205, 205, 206, 1, 206, 1, 207,
622 207, 208, 208, 209, 207, 210, 1, 211,
623 211, 212, 212, 213, 211, 214, 1, 215,
624 216, 1, 217, 1, 218, 218, 219, 1,
625 219, 1, 220, 220, 221, 221, 222, 220,
626 223, 1, 224, 224, 225, 225, 226, 224,
627 227, 1, 228, 228, 229, 229, 230, 228,
628 231, 1, 232, 233, 1, 234, 1, 235,
629 235, 237, 238, 239, 239, 235, 236, 234,
630 1, 240, 240, 242, 243, 240, 241, 244,
631 1, 245, 246, 1, 247, 1, 248, 248,
632 250, 251, 252, 252, 248, 249, 247, 1,
633 253, 253, 255, 256, 253, 254, 257, 1,
634 258, 259, 1, 260, 1, 261, 261, 263,
635 264, 265, 265, 261, 262, 260, 1, 266,
636 266, 268, 269, 266, 267, 270, 1, 271,
637 272, 1, 273, 1, 235, 235, 237, 234,
638 239, 239, 235, 236, 233, 1, 242, 242,
639 241, 241, 243, 242, 244, 1, 248, 248,
640 250, 247, 252, 252, 248, 249, 246, 1,
641 255, 255, 254, 254, 256, 255, 257, 1,
642 261, 261, 263, 260, 265, 265, 261, 262,
643 259, 1, 268, 268, 267, 267, 269, 268,
644 270, 1, 274, 274, 275, 1, 275, 1,
645 276, 276, 277, 277, 278, 276, 279, 1,
646 280, 280, 281, 281, 282, 280, 283, 1,
647 284, 285, 1, 286, 1, 287, 287, 289,
648 290, 291, 291, 287, 288, 286, 1, 292,
649 292, 294, 295, 292, 293, 296, 1, 297,
650 298, 1, 299, 1, 300, 300, 302, 303,
651 304, 304, 300, 301, 299, 1, 305, 305,
652 307, 308, 305, 306, 309, 1, 310, 311,
653 1, 312, 1, 313, 313, 315, 316, 317,
654 317, 313, 314, 312, 1, 318, 318, 320,
655 321, 318, 319, 322, 1, 323, 324, 1,
656 325, 1, 287, 287, 289, 286, 291, 291,
657 287, 288, 285, 1, 294, 294, 293, 293,
658 295, 294, 296, 1, 300, 300, 302, 299,
659 304, 304, 300, 301, 298, 1, 307, 307,
660 306, 306, 308, 307, 309, 1, 313, 313,
661 315, 312, 317, 317, 313, 314, 311, 1,
662 320, 320, 319, 319, 321, 320, 322, 1,
663 326, 326, 327, 1, 327, 1, 328, 328,
664 329, 329, 330, 328, 331, 1, 332, 332,
665 333, 333, 334, 332, 335, 1, 336, 337,
666 1, 338, 1, 339, 339, 341, 342, 343,
667 343, 339, 340, 338, 1, 344, 344, 346,
668 347, 344, 345, 348, 1, 349, 350, 1,
669 351, 1, 339, 339, 341, 338, 343, 343,
670 339, 340, 337, 1, 346, 346, 345, 345,
671 347, 346, 348, 1, 352, 352, 353, 1,
672 353, 1, 354, 354, 355, 355, 356, 354,
673 357, 1, 358, 358, 359, 359, 360, 358,
674 361, 1, 362, 363, 1, 364, 1, 365,
675 365, 366, 1, 366, 1, 367, 367, 368,
676 368, 369, 367, 370, 1, 371, 371, 372,
677 372, 373, 371, 374, 1, 375, 375, 376,
678 376, 377, 375, 378, 1, 379, 379, 380,
679 380, 381, 379, 382, 1, 383, 383, 384,
680 384, 385, 383, 386, 1, 12, 12, 14,
681 11, 16, 16, 12, 13, 10, 1, 19,
682 19, 18, 18, 20, 19, 21, 1, 387,
683 387, 388, 1, 388, 1, 389, 389, 390,
684 390, 391, 389, 392, 1, 393, 393, 394,
685 394, 395, 393, 396, 1, 397, 397, 398,
686 398, 399, 397, 400, 1, 401, 401, 402,
687 402, 403, 401, 404, 1, 405, 405, 406,
688 1, 406, 1, 12, 12, 14, 15, 12,
689 13, 406, 1, 407, 407, 408, 1, 408,
690 1, 339, 339, 341, 342, 339, 340, 408,
691 1, 409, 409, 410, 1, 410, 1, 313,
692 313, 315, 316, 313, 314, 410, 1, 411,
693 411, 412, 1, 412, 1, 300, 300, 302,
694 303, 300, 301, 412, 1, 413, 413, 414,
695 1, 414, 1, 287, 287, 289, 290, 287,
696 288, 414, 1, 415, 415, 416, 1, 416,
697 1, 261, 261, 263, 264, 261, 262, 416,
698 1, 417, 417, 418, 1, 418, 1, 248,
699 248, 250, 251, 248, 249, 418, 1, 419,
700 419, 420, 1, 420, 1, 235, 235, 237,
701 238, 235, 236, 420, 1, 421, 421, 422,
702 1, 422, 1, 192, 192, 194, 195, 192,
703 193, 422, 1, 423, 423, 424, 1, 424,
704 1, 179, 179, 181, 182, 179, 180, 424,
705 1, 425, 425, 426, 1, 426, 1, 166,
706 166, 168, 169, 166, 167, 426, 1, 427,
707 427, 428, 1, 428, 1, 153, 153, 155,
708 156, 153, 154, 428, 1, 429, 429, 430,
709 1, 430, 1, 140, 140, 142, 143, 140,
710 141, 430, 1, 431, 431, 432, 1, 432,
711 1, 117, 117, 116, 116, 118, 117, 119,
712 1, 433, 433, 434, 1, 434, 1, 110,
713 110, 112, 113, 110, 111, 434, 1, 110,
714 110, 112, 109, 114, 114, 110, 111, 108,
715 1, 104, 104, 103, 103, 105, 104, 106,
716 1, 435, 435, 437, 438, 435, 436, 439,
717 1, 440, 440, 441, 442, 443, 440, 1,
718 444, 444, 445, 1, 445, 1, 446, 446,
719 447, 1, 447, 1, 28, 28, 30, 31,
720 28, 29, 447, 1, 448, 448, 449, 450,
721 448, 1, 451, 451, 453, 454, 455, 456,
722 457, 458, 459, 460, 461, 462, 463, 464,
723 465, 466, 467, 457, 468, 469, 470, 471,
724 472, 473, 474, 465, 451, 452, 24, 1,
725 475, 475, 41, 43, 476, 477, 478, 479,
726 449, 480, 481, 482, 483, 484, 485, 486,
727 487, 488, 450, 489, 490, 491, 492, 484,
728 475, 42, 44, 1, 493, 493, 495, 496,
729 497, 498, 499, 500, 501, 502, 503, 504,
730 505, 506, 507, 508, 509, 499, 510, 511,
731 512, 513, 514, 515, 516, 507, 493, 494,
732 40, 1, 493, 493, 495, 40, 497, 498,
733 499, 500, 501, 502, 503, 504, 505, 506,
734 507, 508, 509, 499, 510, 511, 512, 513,
735 514, 515, 516, 507, 493, 494, 39, 1,
736 517, 517, 519, 520, 521, 522, 523, 524,
737 525, 526, 527, 528, 529, 530, 531, 532,
738 533, 523, 534, 535, 536, 537, 538, 539,
739 540, 531, 517, 518, 122, 1, 541, 541,
740 49, 51, 476, 477, 478, 479, 449, 480,
741 481, 482, 483, 484, 485, 486, 487, 488,
742 450, 489, 490, 491, 492, 484, 541, 50,
743 52, 1, 542, 542, 544, 545, 546, 547,
744 548, 549, 550, 551, 552, 553, 554, 555,
745 556, 557, 558, 548, 559, 560, 561, 562,
746 563, 564, 565, 556, 542, 543, 204, 1,
747 566, 566, 133, 135, 476, 477, 478, 479,
748 449, 480, 481, 482, 483, 484, 485, 486,
749 487, 488, 450, 489, 490, 491, 492, 484,
750 566, 134, 136, 1, 542, 542, 544, 204,
751 546, 547, 548, 549, 550, 551, 552, 553,
752 554, 555, 556, 557, 558, 548, 559, 560,
753 561, 562, 563, 564, 565, 556, 542, 543,
754 203, 1, 542, 542, 544, 545, 546, 547,
755 549, 550, 551, 552, 553, 554, 555, 556,
756 557, 558, 559, 560, 561, 562, 563, 564,
757 565, 556, 542, 543, 206, 1, 567, 567,
758 569, 570, 571, 572, 573, 574, 575, 576,
759 577, 578, 579, 580, 581, 582, 583, 573,
760 584, 585, 586, 587, 588, 589, 590, 581,
761 567, 568, 217, 1, 591, 591, 211, 213,
762 476, 477, 478, 479, 449, 480, 481, 482,
763 483, 484, 485, 486, 487, 488, 450, 489,
764 490, 491, 492, 484, 591, 212, 214, 1,
765 567, 567, 569, 217, 571, 572, 573, 574,
766 575, 576, 577, 578, 579, 580, 581, 582,
767 583, 573, 584, 585, 586, 587, 588, 589,
768 590, 581, 567, 568, 216, 1, 567, 567,
769 569, 570, 571, 572, 574, 575, 576, 577,
770 578, 579, 580, 581, 582, 583, 584, 585,
771 586, 587, 588, 589, 590, 581, 567, 568,
772 219, 1, 592, 592, 594, 595, 596, 597,
773 598, 599, 600, 601, 602, 603, 604, 605,
774 606, 607, 608, 598, 609, 610, 611, 612,
775 613, 614, 615, 606, 592, 593, 273, 1,
776 616, 616, 228, 230, 476, 477, 478, 479,
777 449, 480, 481, 482, 483, 484, 485, 486,
778 487, 488, 450, 489, 490, 491, 492, 484,
779 616, 229, 231, 1, 592, 592, 594, 273,
780 596, 597, 598, 599, 600, 601, 602, 603,
781 604, 605, 606, 607, 608, 598, 609, 610,
782 611, 612, 613, 614, 615, 606, 592, 593,
783 272, 1, 592, 592, 594, 595, 596, 597,
784 599, 600, 601, 602, 603, 604, 605, 606,
785 607, 608, 609, 610, 611, 612, 613, 614,
786 615, 606, 592, 593, 275, 1, 617, 617,
787 619, 620, 621, 622, 623, 624, 625, 626,
788 627, 628, 629, 630, 631, 632, 633, 623,
789 634, 635, 636, 637, 638, 639, 640, 631,
790 617, 618, 325, 1, 641, 641, 280, 282,
791 476, 477, 478, 479, 449, 480, 481, 482,
792 483, 484, 485, 486, 487, 488, 450, 489,
793 490, 491, 492, 484, 641, 281, 283, 1,
794 617, 617, 619, 325, 621, 622, 623, 624,
795 625, 626, 627, 628, 629, 630, 631, 632,
796 633, 623, 634, 635, 636, 637, 638, 639,
797 640, 631, 617, 618, 324, 1, 617, 617,
798 619, 620, 621, 622, 624, 625, 626, 627,
799 628, 629, 630, 631, 632, 633, 634, 635,
800 636, 637, 638, 639, 640, 631, 617, 618,
801 327, 1, 642, 642, 644, 645, 646, 647,
802 648, 649, 650, 651, 652, 653, 654, 655,
803 656, 657, 658, 648, 659, 660, 661, 662,
804 663, 664, 665, 656, 642, 643, 351, 1,
805 666, 666, 332, 334, 476, 477, 478, 479,
806 449, 480, 481, 482, 483, 484, 485, 486,
807 487, 488, 450, 489, 490, 491, 492, 484,
808 666, 333, 335, 1, 642, 642, 644, 351,
809 646, 647, 648, 649, 650, 651, 652, 653,
810 654, 655, 656, 657, 658, 648, 659, 660,
811 661, 662, 663, 664, 665, 656, 642, 643,
812 350, 1, 642, 642, 644, 645, 646, 647,
813 649, 650, 651, 652, 653, 654, 655, 656,
814 657, 658, 659, 660, 661, 662, 663, 664,
815 665, 656, 642, 643, 353, 1, 667, 667,
816 669, 670, 671, 672, 673, 674, 675, 676,
817 677, 678, 679, 680, 681, 682, 683, 673,
818 684, 685, 686, 687, 688, 689, 690, 681,
819 667, 668, 364, 1, 691, 691, 358, 360,
820 476, 477, 478, 479, 449, 480, 481, 482,
821 483, 484, 485, 486, 487, 488, 450, 489,
822 490, 491, 492, 484, 691, 359, 361, 1,
823 667, 667, 669, 364, 671, 672, 673, 674,
824 675, 676, 677, 678, 679, 680, 681, 682,
825 683, 673, 684, 685, 686, 687, 688, 689,
826 690, 681, 667, 668, 363, 1, 667, 667,
827 669, 670, 671, 672, 674, 675, 676, 677,
828 678, 679, 680, 681, 682, 683, 684, 685,
829 686, 687, 688, 689, 690, 681, 667, 668,
830 366, 1, 692, 692, 693, 694, 695, 696,
831 697, 698, 699, 700, 701, 702, 703, 704,
832 705, 706, 707, 708, 709, 710, 711, 702,
833 692, 1, 712, 712, 476, 477, 478, 479,
834 449, 480, 481, 482, 483, 484, 485, 486,
835 487, 488, 450, 489, 490, 491, 492, 484,
836 712, 1, 451, 451, 453, 24, 455, 456,
837 457, 458, 459, 460, 461, 462, 463, 464,
838 465, 466, 467, 457, 468, 469, 470, 471,
839 472, 473, 474, 465, 451, 452, 23, 1,
840 451, 451, 453, 454, 455, 456, 458, 459,
841 460, 461, 462, 463, 464, 465, 466, 467,
842 468, 469, 470, 471, 472, 473, 474, 465,
843 451, 452, 388, 1, 517, 517, 519, 520,
844 521, 522, 524, 525, 526, 527, 528, 529,
845 530, 531, 532, 533, 534, 535, 536, 537,
846 538, 539, 540, 531, 517, 518, 432, 1,
847 517, 517, 519, 122, 521, 522, 523, 524,
848 525, 526, 527, 528, 529, 530, 531, 532,
849 533, 523, 534, 535, 536, 537, 538, 539,
850 540, 531, 517, 518, 121, 1, 493, 493,
851 495, 496, 497, 498, 500, 501, 502, 503,
852 504, 505, 506, 507, 508, 509, 510, 511,
853 512, 513, 514, 515, 516, 507, 493, 494,
854 445, 1, 0
855};
856
857static const short _svg_path_trans_targs[] = {
858 2, 0, 3, 4, 172, 2, 3, 4,
859 172, 4, 172, 5, 6, 7, 173, 8,
860 180, 6, 7, 173, 8, 267, 8, 267,
861 235, 10, 16, 11, 12, 13, 17, 14,
862 231, 12, 13, 17, 14, 238, 14, 238,
863 237, 15, 9, 10, 16, 19, 20, 21,
864 44, 19, 20, 21, 44, 21, 44, 22,
865 23, 24, 45, 25, 55, 23, 24, 45,
866 25, 46, 25, 46, 26, 27, 28, 47,
867 29, 52, 27, 28, 47, 29, 48, 29,
868 48, 30, 31, 32, 49, 31, 32, 33,
869 228, 34, 35, 36, 227, 34, 35, 36,
870 227, 37, 38, 226, 39, 225, 37, 38,
871 226, 39, 225, 39, 225, 40, 41, 42,
872 221, 43, 222, 41, 42, 221, 43, 270,
873 43, 270, 239, 50, 51, 53, 54, 56,
874 57, 59, 60, 61, 82, 59, 60, 61,
875 82, 61, 82, 62, 63, 64, 83, 65,
876 216, 63, 64, 83, 65, 84, 65, 84,
877 66, 67, 68, 85, 69, 213, 67, 68,
878 85, 69, 86, 69, 86, 70, 71, 72,
879 87, 73, 210, 71, 72, 87, 73, 88,
880 73, 88, 74, 75, 76, 89, 77, 207,
881 75, 76, 89, 77, 90, 77, 90, 78,
882 79, 80, 91, 81, 204, 79, 80, 91,
883 81, 243, 81, 243, 241, 93, 244, 95,
884 96, 97, 247, 95, 96, 97, 247, 97,
885 247, 245, 99, 248, 15, 9, 10, 16,
886 102, 103, 104, 117, 102, 103, 104, 117,
887 104, 117, 105, 106, 107, 118, 108, 201,
888 106, 107, 118, 108, 119, 108, 119, 109,
889 110, 111, 120, 112, 198, 110, 111, 120,
890 112, 121, 112, 121, 113, 114, 115, 122,
891 116, 195, 114, 115, 122, 116, 251, 116,
892 251, 249, 124, 252, 126, 127, 128, 141,
893 126, 127, 128, 141, 128, 141, 129, 130,
894 131, 142, 132, 192, 130, 131, 142, 132,
895 143, 132, 143, 133, 134, 135, 144, 136,
896 189, 134, 135, 144, 136, 145, 136, 145,
897 137, 138, 139, 146, 140, 186, 138, 139,
898 146, 140, 255, 140, 255, 253, 148, 256,
899 150, 151, 152, 157, 150, 151, 152, 157,
900 152, 157, 153, 154, 155, 158, 156, 183,
901 154, 155, 158, 156, 259, 156, 259, 257,
902 160, 260, 162, 163, 164, 263, 162, 163,
903 164, 263, 164, 263, 261, 166, 264, 19,
904 20, 21, 44, 59, 60, 61, 82, 95,
905 96, 97, 247, 15, 9, 10, 16, 2,
906 3, 4, 172, 175, 268, 102, 103, 104,
907 117, 126, 127, 128, 141, 150, 151, 152,
908 157, 162, 163, 164, 263, 181, 182, 184,
909 185, 187, 188, 190, 191, 193, 194, 196,
910 197, 199, 200, 202, 203, 205, 206, 208,
911 209, 211, 212, 214, 215, 217, 218, 220,
912 269, 223, 224, 37, 38, 226, 39, 225,
913 34, 35, 36, 227, 230, 271, 232, 233,
914 234, 1, 171, 236, 9, 15, 10, 18,
915 58, 174, 94, 100, 1, 101, 125, 149,
916 161, 265, 167, 168, 169, 170, 171, 176,
917 177, 178, 179, 236, 18, 58, 94, 100,
918 101, 125, 149, 161, 265, 167, 168, 169,
919 170, 176, 177, 178, 179, 236, 9, 15,
920 10, 18, 58, 229, 94, 100, 1, 101,
921 125, 149, 161, 265, 167, 168, 169, 170,
922 171, 176, 177, 178, 179, 240, 20, 19,
923 21, 18, 58, 219, 94, 100, 1, 101,
924 125, 149, 161, 265, 167, 168, 169, 170,
925 171, 176, 177, 178, 179, 240, 242, 60,
926 59, 61, 18, 58, 92, 94, 100, 1,
927 101, 125, 149, 161, 265, 167, 168, 169,
928 170, 171, 176, 177, 178, 179, 242, 246,
929 96, 95, 97, 18, 58, 98, 94, 100,
930 1, 101, 125, 149, 161, 265, 167, 168,
931 169, 170, 171, 176, 177, 178, 179, 246,
932 250, 103, 102, 104, 18, 58, 123, 94,
933 100, 1, 101, 125, 149, 161, 265, 167,
934 168, 169, 170, 171, 176, 177, 178, 179,
935 250, 254, 127, 126, 128, 18, 58, 147,
936 94, 100, 1, 101, 125, 149, 161, 265,
937 167, 168, 169, 170, 171, 176, 177, 178,
938 179, 254, 258, 151, 150, 152, 18, 58,
939 159, 94, 100, 1, 101, 125, 149, 161,
940 265, 167, 168, 169, 170, 171, 176, 177,
941 178, 179, 258, 262, 163, 162, 164, 18,
942 58, 165, 94, 100, 1, 101, 125, 149,
943 161, 265, 167, 168, 169, 170, 171, 176,
944 177, 178, 179, 262, 266, 18, 58, 94,
945 100, 1, 101, 125, 149, 161, 265, 167,
946 168, 169, 170, 171, 176, 177, 178, 179,
947 266
948};
949
950static const char _svg_path_trans_actions[] = {
951 9, 0, 51, 51, 51, 0, 1, 1,
952 1, 0, 0, 0, 3, 15, 3, 15,
953 0, 0, 1, 0, 1, 1, 0, 0,
954 0, 0, 0, 0, 3, 15, 3, 15,
955 0, 0, 1, 0, 1, 1, 0, 0,
956 0, 0, 1, 1, 1, 9, 51, 51,
957 51, 0, 1, 1, 1, 0, 0, 0,
958 3, 15, 3, 15, 0, 0, 1, 0,
959 1, 1, 0, 0, 0, 3, 15, 3,
960 15, 0, 0, 1, 0, 1, 1, 0,
961 0, 0, 3, 3, 0, 0, 0, 0,
962 0, 7, 7, 7, 7, 0, 0, 0,
963 0, 7, 48, 7, 48, 48, 0, 1,
964 0, 1, 1, 0, 0, 0, 3, 15,
965 3, 15, 0, 0, 1, 0, 1, 1,
966 0, 0, 0, 0, 0, 0, 0, 0,
967 0, 9, 51, 51, 51, 0, 1, 1,
968 1, 0, 0, 0, 3, 15, 3, 15,
969 0, 0, 1, 0, 1, 1, 0, 0,
970 0, 3, 15, 3, 15, 0, 0, 1,
971 0, 1, 1, 0, 0, 0, 3, 15,
972 3, 15, 0, 0, 1, 0, 1, 1,
973 0, 0, 0, 3, 15, 3, 15, 0,
974 0, 1, 0, 1, 1, 0, 0, 0,
975 3, 15, 3, 15, 0, 0, 1, 0,
976 1, 1, 0, 0, 0, 0, 0, 9,
977 51, 51, 51, 0, 1, 1, 1, 0,
978 0, 0, 0, 0, 9, 51, 51, 51,
979 9, 51, 51, 51, 0, 1, 1, 1,
980 0, 0, 0, 3, 15, 3, 15, 0,
981 0, 1, 0, 1, 1, 0, 0, 0,
982 3, 15, 3, 15, 0, 0, 1, 0,
983 1, 1, 0, 0, 0, 3, 15, 3,
984 15, 0, 0, 1, 0, 1, 1, 0,
985 0, 0, 0, 0, 9, 51, 51, 51,
986 0, 1, 1, 1, 0, 0, 0, 3,
987 15, 3, 15, 0, 0, 1, 0, 1,
988 1, 0, 0, 0, 3, 15, 3, 15,
989 0, 0, 1, 0, 1, 1, 0, 0,
990 0, 3, 15, 3, 15, 0, 0, 1,
991 0, 1, 1, 0, 0, 0, 0, 0,
992 9, 51, 51, 51, 0, 1, 1, 1,
993 0, 0, 0, 3, 15, 3, 15, 0,
994 0, 1, 0, 1, 1, 0, 0, 0,
995 0, 0, 9, 51, 51, 51, 0, 1,
996 1, 1, 0, 0, 0, 0, 0, 11,
997 54, 54, 54, 11, 54, 54, 54, 11,
998 54, 54, 54, 11, 54, 54, 54, 11,
999 54, 54, 54, 0, 0, 11, 54, 54,
1000 54, 11, 54, 54, 54, 11, 54, 54,
1001 54, 11, 54, 54, 54, 0, 0, 0,
1002 0, 0, 0, 0, 0, 0, 0, 0,
1003 0, 0, 0, 0, 0, 0, 0, 0,
1004 0, 0, 0, 0, 0, 0, 0, 0,
1005 0, 0, 0, 5, 45, 5, 45, 45,
1006 5, 5, 5, 5, 0, 0, 0, 0,
1007 0, 0, 0, 18, 57, 18, 57, 18,
1008 18, 0, 18, 18, 18, 18, 18, 18,
1009 18, 18, 18, 18, 18, 18, 18, 18,
1010 18, 18, 18, 0, 0, 0, 0, 0,
1011 0, 0, 0, 0, 0, 0, 0, 0,
1012 0, 0, 0, 0, 0, 21, 61, 21,
1013 61, 21, 21, 0, 21, 21, 21, 21,
1014 21, 21, 21, 21, 21, 21, 21, 21,
1015 21, 21, 21, 21, 21, 42, 89, 42,
1016 89, 42, 42, 0, 42, 42, 42, 42,
1017 42, 42, 42, 42, 42, 42, 42, 42,
1018 42, 42, 42, 42, 42, 0, 30, 73,
1019 30, 73, 30, 30, 0, 30, 30, 30,
1020 30, 30, 30, 30, 30, 30, 30, 30,
1021 30, 30, 30, 30, 30, 30, 0, 24,
1022 65, 24, 65, 24, 24, 0, 24, 24,
1023 24, 24, 24, 24, 24, 24, 24, 24,
1024 24, 24, 24, 24, 24, 24, 24, 0,
1025 36, 81, 36, 81, 36, 36, 0, 36,
1026 36, 36, 36, 36, 36, 36, 36, 36,
1027 36, 36, 36, 36, 36, 36, 36, 36,
1028 0, 33, 77, 33, 77, 33, 33, 0,
1029 33, 33, 33, 33, 33, 33, 33, 33,
1030 33, 33, 33, 33, 33, 33, 33, 33,
1031 33, 0, 39, 85, 39, 85, 39, 39,
1032 0, 39, 39, 39, 39, 39, 39, 39,
1033 39, 39, 39, 39, 39, 39, 39, 39,
1034 39, 39, 0, 27, 69, 27, 69, 27,
1035 27, 0, 27, 27, 27, 27, 27, 27,
1036 27, 27, 27, 27, 27, 27, 27, 27,
1037 27, 27, 27, 0, 13, 13, 13, 13,
1038 13, 13, 13, 13, 13, 13, 13, 13,
1039 13, 13, 13, 13, 13, 13, 13, 13,
1040 0
1041};
1042
1043static const char _svg_path_eof_actions[] = {
1044 0, 0, 0, 0, 0, 0, 0, 0,
1045 0, 0, 0, 0, 0, 0, 0, 0,
1046 0, 0, 0, 0, 0, 0, 0, 0,
1047 0, 0, 0, 0, 0, 0, 0, 0,
1048 0, 0, 0, 0, 0, 0, 0, 0,
1049 0, 0, 0, 0, 0, 0, 0, 0,
1050 0, 0, 0, 0, 0, 0, 0, 0,
1051 0, 0, 0, 0, 0, 0, 0, 0,
1052 0, 0, 0, 0, 0, 0, 0, 0,
1053 0, 0, 0, 0, 0, 0, 0, 0,
1054 0, 0, 0, 0, 0, 0, 0, 0,
1055 0, 0, 0, 0, 0, 0, 0, 0,
1056 0, 0, 0, 0, 0, 0, 0, 0,
1057 0, 0, 0, 0, 0, 0, 0, 0,
1058 0, 0, 0, 0, 0, 0, 0, 0,
1059 0, 0, 0, 0, 0, 0, 0, 0,
1060 0, 0, 0, 0, 0, 0, 0, 0,
1061 0, 0, 0, 0, 0, 0, 0, 0,
1062 0, 0, 0, 0, 0, 0, 0, 0,
1063 0, 0, 0, 0, 0, 0, 0, 0,
1064 0, 0, 0, 0, 0, 0, 0, 0,
1065 0, 0, 0, 0, 0, 0, 0, 0,
1066 0, 0, 0, 0, 0, 0, 0, 0,
1067 0, 0, 0, 0, 0, 0, 0, 0,
1068 0, 0, 0, 0, 0, 0, 0, 0,
1069 0, 0, 0, 0, 0, 0, 0, 0,
1070 0, 0, 0, 0, 0, 0, 0, 0,
1071 0, 0, 0, 0, 0, 0, 0, 0,
1072 0, 0, 0, 0, 0, 0, 0, 0,
1073 0, 0, 0, 18, 0, 21, 21, 42,
1074 0, 30, 0, 30, 30, 24, 0, 24,
1075 24, 36, 0, 36, 36, 33, 0, 33,
1076 33, 39, 0, 39, 39, 27, 0, 27,
1077 27, 13, 0, 18, 18, 42, 42, 21
1078};
1079
1080static const int svg_path_start = 234;
1081static const int svg_path_first_final = 234;
1082
1083static const int svg_path_en_main = 234;
1084
1085
1086#line 47 "svg-path-parser.rl"
1087
1088
1090 : _absolute(false)
1091 , _sink(sink)
1092 , _z_snap_threshold(0)
1093 , _curve(NULL)
1094{
1095 reset();
1096}
1097
1099{
1100 delete _curve;
1101}
1102
1104 _absolute = false;
1105 _current = _initial = Point(0, 0);
1107 _params.clear();
1108 delete _curve;
1109 _curve = NULL;
1110
1111
1112#line 1113 "svg-path-parser.cpp"
1113 {
1115 }
1116
1117#line 73 "svg-path-parser.rl"
1118
1119}
1120
1121void SVGPathParser::parse(char const *str, int len)
1122{
1123 if (len < 0) {
1124 len = std::strlen(str);
1125 }
1126 _parse(str, str + len, true);
1127}
1128
1129void SVGPathParser::parse(std::string const &s)
1130{
1131 _parse(s.c_str(), s.c_str() + s.size(), true);
1132}
1133
1134void SVGPathParser::feed(char const *str, int len)
1135{
1136 if (len < 0) {
1137 len = std::strlen(str);
1138 }
1139 _parse(str, str + len, false);
1140}
1141
1142void SVGPathParser::feed(std::string const &s)
1143{
1144 _parse(s.c_str(), s.c_str() + s.size(), false);
1145}
1146
1148{
1149 char const *empty = "";
1150 _parse(empty, empty, true);
1151}
1152
1154{
1155 _params.push_back(value);
1156}
1157
1159{
1160 Coord value = _params.back();
1161 _params.pop_back();
1162 return value;
1163}
1164
1166{
1167 return _pop() != 0.0;
1168}
1169
1171{
1172 if (_absolute) {
1173 return _pop();
1174 } else {
1175 return _pop() + _current[axis];
1176 }
1177}
1178
1180{
1181 Coord y = _pop_coord(Y);
1182 Coord x = _pop_coord(X);
1183 return Point(x, y);
1184}
1185
1187{
1188 _pushCurve(NULL); // flush
1189 _sink.moveTo(p);
1191}
1192
1194{
1197}
1198
1199void SVGPathParser::_curveTo(Point const &c0, Point const &c1, Point const &p)
1200{
1201 _pushCurve(new CubicBezier(_current, c0, c1, p));
1202 _quad_tangent = _current = p;
1203 _cubic_tangent = p + ( p - c1 );
1204}
1205
1206void SVGPathParser::_quadTo(Point const &c, Point const &p)
1207{
1210 _quad_tangent = p + ( p - c );
1211}
1212
1214 bool large_arc, bool sweep, Point const &p)
1215{
1216 if (_current == p) {
1217 return; // ignore invalid (ambiguous) arc segments where start and end point are the same (per SVG spec)
1218 }
1219
1220 _pushCurve(new EllipticalArc(_current, fabs(rx), fabs(ry), angle, large_arc, sweep, p));
1222}
1223
1225{
1226 if (_curve && (!_absolute || !_moveto_was_absolute) &&
1228 {
1230 }
1231
1232 _pushCurve(NULL); // flush
1233 _sink.closePath();
1235}
1236
1238{
1239 if (_curve) {
1240 _sink.feed(*_curve, false);
1241 delete _curve;
1242 }
1243 _curve = c;
1244}
1245
1246void SVGPathParser::_parse(char const *str, char const *strend, bool finish)
1247{
1248 char const *p = str;
1249 char const *pe = strend;
1250 char const *eof = finish ? pe : NULL;
1251 char const *start = NULL;
1252
1253
1254#line 1255 "svg-path-parser.cpp"
1255 {
1256 int _klen;
1257 unsigned int _trans;
1258 const char *_acts;
1259 unsigned int _nacts;
1260 const char *_keys;
1261
1262 if ( p == pe )
1263 goto _test_eof;
1264 if ( cs == 0 )
1265 goto _out;
1266_resume:
1268 _trans = _svg_path_index_offsets[cs];
1269
1271 if ( _klen > 0 ) {
1272 const char *_lower = _keys;
1273 const char *_mid;
1274 const char *_upper = _keys + _klen - 1;
1275 while (1) {
1276 if ( _upper < _lower )
1277 break;
1278
1279 _mid = _lower + ((_upper-_lower) >> 1);
1280 if ( (*p) < *_mid )
1281 _upper = _mid - 1;
1282 else if ( (*p) > *_mid )
1283 _lower = _mid + 1;
1284 else {
1285 _trans += (unsigned int)(_mid - _keys);
1286 goto _match;
1287 }
1288 }
1289 _keys += _klen;
1290 _trans += _klen;
1291 }
1292
1293 _klen = _svg_path_range_lengths[cs];
1294 if ( _klen > 0 ) {
1295 const char *_lower = _keys;
1296 const char *_mid;
1297 const char *_upper = _keys + (_klen<<1) - 2;
1298 while (1) {
1299 if ( _upper < _lower )
1300 break;
1301
1302 _mid = _lower + (((_upper-_lower) >> 1) & ~1);
1303 if ( (*p) < _mid[0] )
1304 _upper = _mid - 2;
1305 else if ( (*p) > _mid[1] )
1306 _lower = _mid + 2;
1307 else {
1308 _trans += (unsigned int)((_mid - _keys)>>1);
1309 goto _match;
1310 }
1311 }
1312 _trans += _klen;
1313 }
1314
1315_match:
1316 _trans = _svg_path_indicies[_trans];
1317 cs = _svg_path_trans_targs[_trans];
1318
1319 if ( _svg_path_trans_actions[_trans] == 0 )
1320 goto _again;
1321
1323 _nacts = (unsigned int) *_acts++;
1324 while ( _nacts-- > 0 )
1325 {
1326 switch ( *_acts++ )
1327 {
1328 case 0:
1329#line 209 "svg-path-parser.rl"
1330 {
1331 start = p;
1332 }
1333 break;
1334 case 1:
1335#line 213 "svg-path-parser.rl"
1336 {
1337 if (start) {
1338 std::string buf(start, p);
1339 _push(g_ascii_strtod(buf.c_str(), NULL));
1340 start = NULL;
1341 } else {
1342 std::string buf(str, p);
1343 _push(g_ascii_strtod((_number_part + buf).c_str(), NULL));
1344 _number_part.clear();
1345 }
1346 }
1347 break;
1348 case 2:
1349#line 225 "svg-path-parser.rl"
1350 {
1351 _push(1.0);
1352 }
1353 break;
1354 case 3:
1355#line 229 "svg-path-parser.rl"
1356 {
1357 _push(0.0);
1358 }
1359 break;
1360 case 4:
1361#line 233 "svg-path-parser.rl"
1362 {
1363 _absolute = true;
1364 }
1365 break;
1366 case 5:
1367#line 237 "svg-path-parser.rl"
1368 {
1369 _absolute = false;
1370 }
1371 break;
1372 case 6:
1373#line 241 "svg-path-parser.rl"
1374 {
1377 }
1378 break;
1379 case 7:
1380#line 246 "svg-path-parser.rl"
1381 {
1383 }
1384 break;
1385 case 8:
1386#line 250 "svg-path-parser.rl"
1387 {
1389 }
1390 break;
1391 case 9:
1392#line 254 "svg-path-parser.rl"
1393 {
1395 }
1396 break;
1397 case 10:
1398#line 258 "svg-path-parser.rl"
1399 {
1400 Point p = _pop_point();
1401 Point c1 = _pop_point();
1402 Point c0 = _pop_point();
1403 _curveTo(c0, c1, p);
1404 }
1405 break;
1406 case 11:
1407#line 265 "svg-path-parser.rl"
1408 {
1409 Point p = _pop_point();
1410 Point c1 = _pop_point();
1411 _curveTo(_cubic_tangent, c1, p);
1412 }
1413 break;
1414 case 12:
1415#line 271 "svg-path-parser.rl"
1416 {
1417 Point p = _pop_point();
1418 Point c = _pop_point();
1419 _quadTo(c, p);
1420 }
1421 break;
1422 case 13:
1423#line 277 "svg-path-parser.rl"
1424 {
1425 Point p = _pop_point();
1427 }
1428 break;
1429 case 14:
1430#line 282 "svg-path-parser.rl"
1431 {
1432 Point point = _pop_point();
1433 bool sweep = _pop_flag();
1434 bool large_arc = _pop_flag();
1435 double angle = rad_from_deg(_pop());
1436 double ry = _pop();
1437 double rx = _pop();
1438
1439 _arcTo(rx, ry, angle, large_arc, sweep, point);
1440 }
1441 break;
1442 case 15:
1443#line 293 "svg-path-parser.rl"
1444 {
1445 _closePath();
1446 }
1447 break;
1448#line 1449 "svg-path-parser.cpp"
1449 }
1450 }
1451
1452_again:
1453 if ( cs == 0 )
1454 goto _out;
1455 if ( ++p != pe )
1456 goto _resume;
1457 _test_eof: {}
1458 if ( p == eof )
1459 {
1460 const char *__acts = _svg_path_actions + _svg_path_eof_actions[cs];
1461 unsigned int __nacts = (unsigned int) *__acts++;
1462 while ( __nacts-- > 0 ) {
1463 switch ( *__acts++ ) {
1464 case 1:
1465#line 213 "svg-path-parser.rl"
1466 {
1467 if (start) {
1468 std::string buf(start, p);
1469 _push(g_ascii_strtod(buf.c_str(), NULL));
1470 start = NULL;
1471 } else {
1472 std::string buf(str, p);
1473 _push(g_ascii_strtod((_number_part + buf).c_str(), NULL));
1474 _number_part.clear();
1475 }
1476 }
1477 break;
1478 case 6:
1479#line 241 "svg-path-parser.rl"
1480 {
1483 }
1484 break;
1485 case 7:
1486#line 246 "svg-path-parser.rl"
1487 {
1489 }
1490 break;
1491 case 8:
1492#line 250 "svg-path-parser.rl"
1493 {
1495 }
1496 break;
1497 case 9:
1498#line 254 "svg-path-parser.rl"
1499 {
1501 }
1502 break;
1503 case 10:
1504#line 258 "svg-path-parser.rl"
1505 {
1506 Point p = _pop_point();
1507 Point c1 = _pop_point();
1508 Point c0 = _pop_point();
1509 _curveTo(c0, c1, p);
1510 }
1511 break;
1512 case 11:
1513#line 265 "svg-path-parser.rl"
1514 {
1515 Point p = _pop_point();
1516 Point c1 = _pop_point();
1517 _curveTo(_cubic_tangent, c1, p);
1518 }
1519 break;
1520 case 12:
1521#line 271 "svg-path-parser.rl"
1522 {
1523 Point p = _pop_point();
1524 Point c = _pop_point();
1525 _quadTo(c, p);
1526 }
1527 break;
1528 case 13:
1529#line 277 "svg-path-parser.rl"
1530 {
1531 Point p = _pop_point();
1533 }
1534 break;
1535 case 14:
1536#line 282 "svg-path-parser.rl"
1537 {
1538 Point point = _pop_point();
1539 bool sweep = _pop_flag();
1540 bool large_arc = _pop_flag();
1541 double angle = rad_from_deg(_pop());
1542 double ry = _pop();
1543 double rx = _pop();
1544
1545 _arcTo(rx, ry, angle, large_arc, sweep, point);
1546 }
1547 break;
1548 case 15:
1549#line 293 "svg-path-parser.rl"
1550 {
1551 _closePath();
1552 }
1553 break;
1554#line 1555 "svg-path-parser.cpp"
1555 }
1556 }
1557 }
1558
1559 _out: {}
1560 }
1561
1562#line 435 "svg-path-parser.rl"
1563
1564
1565 if (finish) {
1566 if (cs < svg_path_first_final) {
1567 throw SVGPathParseError();
1568 }
1569 } else if (start != NULL) {
1570 _number_part = std::string(start, pe);
1571 }
1572
1573 if (finish) {
1574 _pushCurve(NULL);
1575 _sink.flush();
1576 reset();
1577 }
1578}
1579
1580void parse_svg_path(char const *str, PathSink &sink)
1581{
1582 SVGPathParser parser(sink);
1583 parser.parse(str);
1584}
1585
1586void parse_svg_path_file(FILE *fi, PathSink &sink)
1587{
1588 static const size_t BUFFER_SIZE = 4096;
1589 char buffer[BUFFER_SIZE];
1590 size_t bytes_read;
1591 SVGPathParser parser(sink);
1592
1593 while (true) {
1594 bytes_read = fread(buffer, 1, BUFFER_SIZE, fi);
1595 if (bytes_read < BUFFER_SIZE) {
1596 parser.parse(buffer, bytes_read);
1597 break;
1598 } else {
1599 parser.feed(buffer, bytes_read);
1600 }
1601 }
1602}
1603
1604} // namespace Geom
1605
1606/*
1607 Local Variables:
1608 mode:c++
1609 c-file-style:"stroustrup"
1610 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
1611 indent-tabs-mode:nil
1612 fill-column:99
1613 End:
1614*/
1615// vim: filetype=ragel:cindent:expandtab:shiftwidth=4:softtabstop=4:fileencoding=utf-8:textwidth=99 :
Cartesian point / 2D vector and related operations.
Various trigoniometric helper functions.
Abstract continuous curve on a plane defined on [0,1].
Definition curve.h:78
virtual void setFinal(Point const &v)=0
Change the ending point of the curve.
Elliptical arc curve.
Callback interface for processing path data.
Definition path-sink.h:56
virtual void flush()=0
Flush any internal state of the generator.
virtual void feed(Curve const &c, bool moveto_initial=true)
Definition path-sink.cpp:39
virtual void closePath()=0
Close the current path with a line segment.
virtual void moveTo(Point const &p)=0
Move to a different point without creating a segment.
Two-dimensional point that doubles as a vector.
Definition point.h:66
Read SVG path data and feed it to a PathSink.
void finish()
Finalize parsing.
Coord _pop_coord(Geom::Dim2 axis)
void _parse(char const *str, char const *strend, bool finish)
void feed(char const *str, int len=-1)
Parse a part of path data stored in a C-style string.
std::vector< Coord > _params
void _quadTo(Point const &c, Point const &p)
SVGPathParser(PathSink &sink)
void parse(char const *str, int len=-1)
Parse a C-style string.
void _curveTo(Point const &c0, Point const &c1, Point const &p)
void _moveTo(Point const &p)
void _lineTo(Point const &p)
void _arcTo(double rx, double ry, double angle, bool large_arc, bool sweep, Point const &p)
void _push(Coord value)
void reset()
Reset internal state.
double c[8][4]
BezierCurveN< 3 > CubicBezier
Cubic (order 3) Bezier curve.
BezierCurveN< 1 > LineSegment
Line segment.
BezierCurveN< 2 > QuadraticBezier
Quadratic (order 2) Bezier curve.
void parse_svg_path(char const *str, PathSink &sink)
Feed SVG path data to the specified sink.
void parse_svg_path_file(FILE *fi, PathSink &sink)
Feed SVG path data from a C stream to the specified sink.
Dim2
2D axis enumeration (X or Y).
Definition coord.h:48
double Coord
Floating point type used to store coordinates.
Definition coord.h:76
@ Y
Definition coord.h:48
@ X
Definition coord.h:48
Geom::Point start
Various utility functions.
Definition affine.h:22
static const char _svg_path_trans_actions[]
static const char _svg_path_eof_actions[]
static const int svg_path_start
static const char _svg_path_trans_keys[]
static const short _svg_path_key_offsets[]
static const char _svg_path_single_lengths[]
static const short _svg_path_trans_targs[]
static const char _svg_path_actions[]
static const char _svg_path_range_lengths[]
static const int svg_path_first_final
static const int svg_path_en_main
bool are_near(Affine const &a1, Affine const &a2, Coord eps=EPSILON)
static const short _svg_path_indicies[]
static const short _svg_path_index_offsets[]
int buf
auto len
Definition safe-printf.h:21
parse SVG path specifications