| 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509 |
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
221×
1×
220×
220×
220×
220×
220×
220×
220×
208×
208×
30×
30×
178×
220×
427×
427×
427×
427×
14201×
14201×
1763×
1763×
1283×
480×
13721×
13721×
444×
444×
409×
35×
13686×
11765×
2141×
2141×
410×
410×
11355×
227×
227×
227×
225×
225×
11130×
11130×
9247×
9247×
1883×
1883×
1335×
1335×
1045×
1045×
1045×
290×
15×
15×
15×
275×
823×
529×
529×
212×
212×
212×
317×
611×
19×
2532×
2187×
79×
15×
64×
64×
64×
64×
79×
2108×
48×
15×
33×
33×
33×
33×
48×
2060×
628×
35×
593×
283×
310×
310×
310×
310×
310×
98×
98×
628×
1432×
818×
34×
784×
106×
678×
139×
539×
137×
402×
135×
267×
134×
133×
133×
133×
133×
133×
818×
614×
119×
3×
116×
29×
87×
31×
56×
29×
27×
27×
27×
27×
27×
119×
495×
107×
3×
104×
26×
78×
28×
50×
26×
24×
24×
24×
24×
24×
107×
388×
388×
7×
381×
54×
1×
53×
327×
59×
1×
58×
268×
57×
211×
56×
1×
55×
155×
54×
1×
53×
101×
51×
50×
50×
50×
50×
50×
384×
2183×
2183×
1688×
495×
143×
143×
143×
352×
19×
19×
19×
678×
677×
6×
6×
672×
672×
323×
349×
672×
72×
72×
72×
600×
64×
64×
536×
33×
33×
503×
101×
101×
402×
157×
157×
245×
107×
107×
138×
30×
30×
108×
27×
27×
81×
25×
25×
56×
55×
55×
1×
599×
416×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
| 'use strict';
// Parse SVG PathData
// http://www.w3.org/TR/SVG/paths.html#PathDataBNF
// Access to SVGPathData constructor
var SVGPathData = require('./SVGPathData.js');
// TransformStream inherance required modules
var TransformStream = require('readable-stream').Transform;
var util = require('util');
// Private consts : Char groups
var WSP = [' ', '\t', '\r', '\n'];
var DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
var SIGNS = ['-', '+'];
var EXPONENTS = ['e', 'E'];
var DECPOINT = ['.'];
var FLAGS = ['0', '1'];
var COMMA = [','];
var COMMANDS = [
'm', 'M', 'z', 'Z', 'l', 'L', 'h', 'H', 'v', 'V', 'c', 'C',
's', 'S', 'q', 'Q', 't', 'T', 'a', 'A',
];
// Inherit of transform stream
util.inherits(SVGPathDataParser, TransformStream);
// Constructor
function SVGPathDataParser(options) {
// Ensure new were used
if(!(this instanceof SVGPathDataParser)) {
return new SVGPathDataParser(options);
}
// Parent constructor
TransformStream.call(this, {
objectMode: true,
});
// Setting objectMode separately
this._writableState.objectMode = false;
this._readableState.objectMode = true;
// Parsing vars
this.state = SVGPathDataParser.STATE_COMMAS_WSPS;
this.curNumber = '';
this.curCommand = null;
this._flush = function(callback) {
this._transform(new Buffer(' '), 'utf-8', function() {});
// Adding residual command
if(null !== this.curCommand) {
Eif(this.curCommand.invalid) {
this.emit('error',
new SyntaxError('Unterminated command at the path end.'));
}
this.push(this.curCommand);
this.curCommand = null;
this.state ^= this.state & SVGPathDataParser.STATE_COMMANDS_MASK;
}
callback();
};
this._transform = function(chunk, encoding, callback) {
var str = chunk.toString('buffer' !== encoding ? encoding : 'utf8');
var i;
var j;
for(i = 0, j = str.length; i < j; i++) {
// White spaces parsing
Eif(this.state & SVGPathDataParser.STATE_WSP ||
this.state & SVGPathDataParser.STATE_WSPS) {
if(-1 !== WSP.indexOf(str[i])) {
this.state ^= this.state & SVGPathDataParser.STATE_WSP;
// any space stops current number parsing
if('' !== this.curNumber) {
this.state ^= this.state & SVGPathDataParser.STATE_NUMBER_MASK;
} else {
continue;
}
}
}
// Commas parsing
Eif(this.state & SVGPathDataParser.STATE_COMMA ||
this.state & SVGPathDataParser.STATE_COMMAS) {
if(-1 !== COMMA.indexOf(str[i])) {
this.state ^= this.state & SVGPathDataParser.STATE_COMMA;
// any comma stops current number parsing
if('' !== this.curNumber) {
this.state ^= this.state & SVGPathDataParser.STATE_NUMBER_MASK;
} else {
continue;
}
}
}
// Numbers parsing : -125.25e-125
if(this.state & SVGPathDataParser.STATE_NUMBER) {
// Reading the sign
if((this.state & SVGPathDataParser.STATE_NUMBER_MASK) ===
SVGPathDataParser.STATE_NUMBER) {
this.state |= SVGPathDataParser.STATE_NUMBER_INT |
SVGPathDataParser.STATE_NUMBER_DIGITS;
if(-1 !== SIGNS.indexOf(str[i])) {
this.curNumber += str[i];
continue;
}
}
// Reading the exponent sign
if(this.state & SVGPathDataParser.STATE_NUMBER_EXPSIGN) {
this.state ^= SVGPathDataParser.STATE_NUMBER_EXPSIGN;
this.state |= SVGPathDataParser.STATE_NUMBER_DIGITS;
if(-1 !== SIGNS.indexOf(str[i])) {
this.curNumber += str[i];
continue;
}
}
// Reading digits
Eif(this.state & SVGPathDataParser.STATE_NUMBER_DIGITS) {
if(-1 !== DIGITS.indexOf(str[i])) {
this.curNumber += str[i];
continue;
}
this.state ^= SVGPathDataParser.STATE_NUMBER_DIGITS;
}
// Ended reading left side digits
if(this.state & SVGPathDataParser.STATE_NUMBER_INT) {
this.state ^= SVGPathDataParser.STATE_NUMBER_INT;
// if got a point, reading right side digits
if(-1 !== DECPOINT.indexOf(str[i])) {
this.curNumber += str[i];
this.state |= SVGPathDataParser.STATE_NUMBER_FLOAT |
SVGPathDataParser.STATE_NUMBER_DIGITS;
continue;
// if got e/E, reading the exponent
} else if(-1 !== EXPONENTS.indexOf(str[i])) {
this.curNumber += str[i];
this.state |= SVGPathDataParser.STATE_NUMBER_EXP |
SVGPathDataParser.STATE_NUMBER_EXPSIGN;
continue;
}
// else we're done with that number
this.state ^= this.state & SVGPathDataParser.STATE_NUMBER_MASK;
}
// Ended reading decimal digits
if(this.state & SVGPathDataParser.STATE_NUMBER_FLOAT) {
this.state ^= SVGPathDataParser.STATE_NUMBER_FLOAT;
// if got e/E, reading the exponent
if(-1 !== EXPONENTS.indexOf(str[i])) {
this.curNumber += str[i];
this.state |= SVGPathDataParser.STATE_NUMBER_EXP |
SVGPathDataParser.STATE_NUMBER_EXPSIGN;
continue;
}
// else we're done with that number
this.state ^= this.state & SVGPathDataParser.STATE_NUMBER_MASK;
}
// Ended reading exponent digits
if(this.state & SVGPathDataParser.STATE_NUMBER_EXP) {
// we're done with that number
this.state ^= this.state & SVGPathDataParser.STATE_NUMBER_MASK;
}
}
// New number
if(this.curNumber) {
// Horizontal move to command (x)
if(this.state & SVGPathDataParser.STATE_HORIZ_LINE_TO) {
if(null === this.curCommand) {
this.push({
type: SVGPathData.HORIZ_LINE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
x: Number(this.curNumber),
});
} else {
this.curCommand.x = Number(this.curNumber);
delete this.curCommand.invalid;
this.push(this.curCommand);
this.curCommand = null;
}
this.state |= SVGPathDataParser.STATE_NUMBER;
// Vertical move to command (y)
} else if(this.state & SVGPathDataParser.STATE_VERT_LINE_TO) {
if(null === this.curCommand) {
this.push({
type: SVGPathData.VERT_LINE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
y: Number(this.curNumber),
});
} else {
this.curCommand.y = Number(this.curNumber);
delete this.curCommand.invalid;
this.push(this.curCommand);
this.curCommand = null;
}
this.state |= SVGPathDataParser.STATE_NUMBER;
// Move to / line to / smooth quadratic curve to commands (x, y)
} else if(this.state & SVGPathDataParser.STATE_MOVE_TO ||
this.state & SVGPathDataParser.STATE_LINE_TO ||
this.state & SVGPathDataParser.STATE_SMOOTH_QUAD_TO) {
if(null === this.curCommand) {
this.curCommand = {
type: (this.state & SVGPathDataParser.STATE_MOVE_TO ?
SVGPathData.MOVE_TO :
(this.state & SVGPathDataParser.STATE_LINE_TO ?
SVGPathData.LINE_TO : SVGPathData.SMOOTH_QUAD_TO
)
),
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
x: Number(this.curNumber),
};
} else if('undefined' === typeof this.curCommand.x) {
this.curCommand.x = Number(this.curNumber);
} else {
delete this.curCommand.invalid;
this.curCommand.y = Number(this.curNumber);
this.push(this.curCommand);
this.curCommand = null;
// Switch to line to state
if(this.state & SVGPathDataParser.STATE_MOVE_TO) {
this.state ^= SVGPathDataParser.STATE_MOVE_TO;
this.state |= SVGPathDataParser.STATE_LINE_TO;
}
}
this.state |= SVGPathDataParser.STATE_NUMBER;
// Curve to commands (x1, y1, x2, y2, x, y)
} else if(this.state & SVGPathDataParser.STATE_CURVE_TO) {
if(null === this.curCommand) {
this.curCommand = {
type: SVGPathData.CURVE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
x2: Number(this.curNumber),
};
} else if('undefined' === typeof this.curCommand.x2) {
this.curCommand.x2 = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.y2) {
this.curCommand.y2 = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.x1) {
this.curCommand.x1 = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.y1) {
this.curCommand.y1 = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.x) {
this.curCommand.x = Number(this.curNumber);
} else Eif('undefined' === typeof this.curCommand.y) {
this.curCommand.y = Number(this.curNumber);
delete this.curCommand.invalid;
this.push(this.curCommand);
this.curCommand = null;
}
this.state |= SVGPathDataParser.STATE_NUMBER;
// Smooth curve to commands (x1, y1, x, y)
} else if(this.state & SVGPathDataParser.STATE_SMOOTH_CURVE_TO) {
if(null === this.curCommand) {
this.curCommand = {
type: SVGPathData.SMOOTH_CURVE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
x2: Number(this.curNumber),
};
} else if('undefined' === typeof this.curCommand.x2) {
this.curCommand.x2 = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.y2) {
this.curCommand.y2 = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.x) {
this.curCommand.x = Number(this.curNumber);
} else Eif('undefined' === typeof this.curCommand.y) {
this.curCommand.y = Number(this.curNumber);
delete this.curCommand.invalid;
this.push(this.curCommand);
this.curCommand = null;
}
this.state |= SVGPathDataParser.STATE_NUMBER;
// Quadratic bezier curve to commands (x1, y1, x, y)
} else if(this.state & SVGPathDataParser.STATE_QUAD_TO) {
if(null === this.curCommand) {
this.curCommand = {
type: SVGPathData.QUAD_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
x1: Number(this.curNumber),
};
} else if('undefined' === typeof this.curCommand.x1) {
this.curCommand.x1 = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.y1) {
this.curCommand.y1 = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.x) {
this.curCommand.x = Number(this.curNumber);
} else Eif('undefined' === typeof this.curCommand.y) {
this.curCommand.y = Number(this.curNumber);
delete this.curCommand.invalid;
this.push(this.curCommand);
this.curCommand = null;
}
this.state |= SVGPathDataParser.STATE_NUMBER;
// Elliptic arc commands (rX, rY, xRot, lArcFlag, sweepFlag, x, y)
} else Eif(this.state & SVGPathDataParser.STATE_ARC) {
if(null === this.curCommand) {
this.curCommand = {
type: SVGPathData.ARC,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
rX: Number(this.curNumber),
};
} else if('undefined' === typeof this.curCommand.rX) {
if(0 > Number(this.curNumber)) {
this.emit('error', new SyntaxError('Expected positive number,' +
' got "' + this.curNumber + '" at index "' + i + '"'));
}
this.curCommand.rX = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.rY) {
if(0 > Number(this.curNumber)) {
this.emit('error', new SyntaxError('Expected positive number,' +
' got "' + this.curNumber + '" at index "' + i + '"'));
}
this.curCommand.rY = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.xRot) {
this.curCommand.xRot = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.lArcFlag) {
if(-1 === FLAGS.indexOf(this.curNumber)) {
this.emit('error', new SyntaxError('Expected a flag, got "' +
this.curNumber + '" at index "' + i + '"'));
}
this.curCommand.lArcFlag = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.sweepFlag) {
if('0' !== this.curNumber && '1' !== this.curNumber) {
this.emit('error', new SyntaxError('Expected a flag, got "' +
this.curNumber + '" at index "' + i + '"'));
}
this.curCommand.sweepFlag = Number(this.curNumber);
} else if('undefined' === typeof this.curCommand.x) {
this.curCommand.x = Number(this.curNumber);
} else Eif('undefined' === typeof this.curCommand.y) {
this.curCommand.y = Number(this.curNumber);
delete this.curCommand.invalid;
this.push(this.curCommand);
this.curCommand = null;
}
this.state |= SVGPathDataParser.STATE_NUMBER;
}
this.curNumber = '';
// Continue if a white space or a comma was detected
if(-1 !== WSP.indexOf(str[i]) || -1 !== COMMA.indexOf(str[i])) {
continue;
}
// if a sign is detected, then parse the new number
if(-1 !== SIGNS.indexOf(str[i])) {
this.curNumber = str[i];
this.state |= SVGPathDataParser.STATE_NUMBER_INT |
SVGPathDataParser.STATE_NUMBER_DIGITS;
continue;
}
// if the decpoint is detected, then parse the new number
if(-1 !== DECPOINT.indexOf(str[i])) {
this.curNumber = str[i];
this.state |= SVGPathDataParser.STATE_NUMBER_FLOAT |
SVGPathDataParser.STATE_NUMBER_DIGITS;
continue;
}
}
// End of a command
if(-1 !== COMMANDS.indexOf(str[i])) {
// Adding residual command
if(null !== this.curCommand) {
Eif(this.curCommand.invalid) {
this.emit('error',
new SyntaxError('Unterminated command at index ' + i + '.'));
}
this.push(this.curCommand);
this.curCommand = null;
this.state ^= this.state & SVGPathDataParser.STATE_COMMANDS_MASK;
}
}
// Detecting the next command
this.state ^= this.state & SVGPathDataParser.STATE_COMMANDS_MASK;
// Is the command relative
if(str[i] === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_RELATIVE;
} else {
this.state ^= this.state & SVGPathDataParser.STATE_RELATIVE;
}
// Horizontal move to command
if('z' === str[i].toLowerCase()) {
this.push({
type: SVGPathData.CLOSE_PATH,
});
this.state = SVGPathDataParser.STATE_COMMAS_WSPS;
continue;
// Horizontal move to command
} else if('h' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_HORIZ_LINE_TO;
this.curCommand = {
type: SVGPathData.HORIZ_LINE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Vertical move to command
} else if('v' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_VERT_LINE_TO;
this.curCommand = {
type: SVGPathData.VERT_LINE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Move to command
} else if('m' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_MOVE_TO;
this.curCommand = {
type: SVGPathData.MOVE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Line to command
} else if('l' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_LINE_TO;
this.curCommand = {
type: SVGPathData.LINE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Curve to command
} else if('c' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_CURVE_TO;
this.curCommand = {
type: SVGPathData.CURVE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Smooth curve to command
} else if('s' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_SMOOTH_CURVE_TO;
this.curCommand = {
type: SVGPathData.SMOOTH_CURVE_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Quadratic bezier curve to command
} else if('q' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_QUAD_TO;
this.curCommand = {
type: SVGPathData.QUAD_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Smooth quadratic bezier curve to command
} else if('t' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_SMOOTH_QUAD_TO;
this.curCommand = {
type: SVGPathData.SMOOTH_QUAD_TO,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Elliptic arc command
} else if('a' === str[i].toLowerCase()) {
this.state |= SVGPathDataParser.STATE_ARC;
this.curCommand = {
type: SVGPathData.ARC,
relative: !!(this.state & SVGPathDataParser.STATE_RELATIVE),
invalid: true,
};
// Unkown command
} else {
this.emit('error', new SyntaxError('Unexpected character "' + str[i] +
'" at index ' + i + '.'));
}
// White spaces can follow a command
this.state |= SVGPathDataParser.STATE_COMMAS_WSPS |
SVGPathDataParser.STATE_NUMBER;
}
callback();
};
}
// Static consts
// Parsing states
SVGPathDataParser.STATE_WSP = 1;
SVGPathDataParser.STATE_WSPS = 2;
SVGPathDataParser.STATE_COMMA = 4;
SVGPathDataParser.STATE_COMMAS = 8;
SVGPathDataParser.STATE_COMMAS_WSPS =
SVGPathDataParser.STATE_WSP | SVGPathDataParser.STATE_WSPS |
SVGPathDataParser.STATE_COMMA | SVGPathDataParser.STATE_COMMAS;
SVGPathDataParser.STATE_NUMBER = 16;
SVGPathDataParser.STATE_NUMBER_DIGITS = 32;
SVGPathDataParser.STATE_NUMBER_INT = 64;
SVGPathDataParser.STATE_NUMBER_FLOAT = 128;
SVGPathDataParser.STATE_NUMBER_EXP = 256;
SVGPathDataParser.STATE_NUMBER_EXPSIGN = 512;
SVGPathDataParser.STATE_NUMBER_MASK = SVGPathDataParser.STATE_NUMBER |
SVGPathDataParser.STATE_NUMBER_DIGITS | SVGPathDataParser.STATE_NUMBER_INT |
SVGPathDataParser.STATE_NUMBER_EXP | SVGPathDataParser.STATE_NUMBER_FLOAT;
SVGPathDataParser.STATE_RELATIVE = 1024;
SVGPathDataParser.STATE_CLOSE_PATH = 2048; // Close path command (z/Z)
SVGPathDataParser.STATE_MOVE_TO = 4096; // Move to command (m/M)
SVGPathDataParser.STATE_LINE_TO = 8192; // Line to command (l/L=)
SVGPathDataParser.STATE_HORIZ_LINE_TO = 16384; // Horizontal line to command (h/H)
SVGPathDataParser.STATE_VERT_LINE_TO = 32768; // Vertical line to command (v/V)
SVGPathDataParser.STATE_CURVE_TO = 65536; // Curve to command (c/C)
SVGPathDataParser.STATE_SMOOTH_CURVE_TO = 131072; // Smooth curve to command (s/S)
SVGPathDataParser.STATE_QUAD_TO = 262144; // Quadratic bezier curve to command (q/Q)
SVGPathDataParser.STATE_SMOOTH_QUAD_TO = 524288; // Smooth quadratic bezier curve to command (t/T)
SVGPathDataParser.STATE_ARC = 1048576; // Elliptic arc command (a/A)
SVGPathDataParser.STATE_COMMANDS_MASK =
SVGPathDataParser.STATE_CLOSE_PATH | SVGPathDataParser.STATE_MOVE_TO |
SVGPathDataParser.STATE_LINE_TO | SVGPathDataParser.STATE_HORIZ_LINE_TO |
SVGPathDataParser.STATE_VERT_LINE_TO | SVGPathDataParser.STATE_CURVE_TO |
SVGPathDataParser.STATE_SMOOTH_CURVE_TO | SVGPathDataParser.STATE_QUAD_TO |
SVGPathDataParser.STATE_SMOOTH_QUAD_TO | SVGPathDataParser.STATE_ARC;
module.exports = SVGPathDataParser;
|