ag-psd 30.1.1 → 30.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.v8-cache/v24.13.1-x64-cf738c9d/017325ac +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/043c7b90 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/05135617 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/059f8558 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/0706ecb8 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/0db754a7 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/1130885f +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/15f0e479 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/20477c23 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/20dfa422 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/2a19133e +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/2b069ee0 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/2de09439 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/2e44f5f0 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/2fb229a9 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/3144b401 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/37481985 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/4511bacf +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/49d22b79 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/4f5702bd +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/514cc428 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/57d3380b +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/6024ce3f +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/61735b23 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/63dbdb75 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/6cbfc0ec +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/6f08372c +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/7100ee08 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/71df9cb3 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/75e41e43 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/7ea06cea +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/8568576b +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/87372817 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/87cf2209 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/932f0770 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/a79a40bb +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/a7e80865 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/acc36e66 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/b3c2fab7 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/b69ed3a3 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/bdff1628 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/c0b789d2 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/c314aece +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/cfc49f4f +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/cff9434a +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/d02dd6f7 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/dc86f000 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/de74e659 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/e03e2acd +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/e158d332 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/e6735171 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/e6745c2b +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/e6b99945 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/eeeebdfe +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/fbca6276 +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/fc97d72d +0 -0
- package/.v8-cache/v24.13.1-x64-cf738c9d/fd0a2987 +0 -0
- package/CHANGELOG.md +3 -0
- package/README.md +1 -1
- package/README_PSD.md +1 -1
- package/dist/abr.js +43 -56
- package/dist/abr.js.map +1 -1
- package/dist/additionalInfo.js +770 -808
- package/dist/additionalInfo.js.map +1 -1
- package/dist/ase.js +21 -21
- package/dist/ase.js.map +1 -1
- package/dist/bundle.js +2592 -2778
- package/dist/csh.js +18 -29
- package/dist/csh.js.map +1 -1
- package/dist/descriptor.js +234 -269
- package/dist/descriptor.js.map +1 -1
- package/dist/effectsHelpers.js +91 -112
- package/dist/effectsHelpers.js.map +1 -1
- package/dist/engineData.js +45 -51
- package/dist/engineData.js.map +1 -1
- package/dist/engineData2.js +8 -9
- package/dist/engineData2.js.map +1 -1
- package/dist/helpers.js +75 -81
- package/dist/helpers.js.map +1 -1
- package/dist/imageResources.js +342 -381
- package/dist/imageResources.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/initializeCanvas.js +2 -2
- package/dist/initializeCanvas.js.map +1 -1
- package/dist/jpeg.js +279 -279
- package/dist/jpeg.js.map +1 -1
- package/dist/psdReader.js +336 -347
- package/dist/psdReader.js.map +1 -1
- package/dist/psdWriter.d.ts +2 -1
- package/dist/psdWriter.js +225 -206
- package/dist/psdWriter.js.map +1 -1
- package/dist/text.js +98 -122
- package/dist/text.js.map +1 -1
- package/dist/utf8.js +22 -22
- package/dist/utf8.js.map +1 -1
- package/dist-es/abr.js +41 -54
- package/dist-es/abr.js.map +1 -1
- package/dist-es/additionalInfo.js +765 -803
- package/dist-es/additionalInfo.js.map +1 -1
- package/dist-es/ase.js +20 -20
- package/dist-es/ase.js.map +1 -1
- package/dist-es/csh.js +16 -27
- package/dist-es/csh.js.map +1 -1
- package/dist-es/descriptor.js +284 -319
- package/dist-es/descriptor.js.map +1 -1
- package/dist-es/effectsHelpers.js +88 -109
- package/dist-es/effectsHelpers.js.map +1 -1
- package/dist-es/engineData.js +45 -51
- package/dist-es/engineData.js.map +1 -1
- package/dist-es/engineData2.js +8 -9
- package/dist-es/engineData2.js.map +1 -1
- package/dist-es/helpers.js +79 -85
- package/dist-es/helpers.js.map +1 -1
- package/dist-es/imageResources.js +338 -377
- package/dist-es/imageResources.js.map +1 -1
- package/dist-es/index.js +4 -4
- package/dist-es/index.js.map +1 -1
- package/dist-es/jpeg.js +279 -279
- package/dist-es/jpeg.js.map +1 -1
- package/dist-es/psdReader.js +333 -344
- package/dist-es/psdReader.js.map +1 -1
- package/dist-es/psdWriter.d.ts +2 -1
- package/dist-es/psdWriter.js +220 -202
- package/dist-es/psdWriter.js.map +1 -1
- package/dist-es/text.js +98 -122
- package/dist-es/text.js.map +1 -1
- package/dist-es/utf8.js +22 -22
- package/dist-es/utf8.js.map +1 -1
- package/package.json +1 -1
- package/publish.js +24 -0
- package/src/additionalInfo.ts +15 -11
- package/src/psdWriter.ts +76 -1
- package/tsconfig.json +4 -3
package/dist-es/descriptor.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
2
|
var t = {};
|
|
14
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -24,11 +13,11 @@ import { createEnum } from './helpers';
|
|
|
24
13
|
import { readSignature, readUnicodeString, readUint32, readUint8, readFloat64, readBytes, readAsciiString, readInt32, readFloat32, readInt32LE, readUnicodeStringWithLengthLE } from './psdReader';
|
|
25
14
|
import { writeSignature, writeBytes, writeUint32, writeFloat64, writeUint8, writeUnicodeStringWithPadding, writeInt32, writeFloat32, writeUnicodeString, writeInt32LE, writeUnicodeStringWithoutLengthLE } from './psdWriter';
|
|
26
15
|
function revMap(map) {
|
|
27
|
-
|
|
28
|
-
Object.keys(map).forEach(
|
|
16
|
+
const result = {};
|
|
17
|
+
Object.keys(map).forEach(key => result[map[key]] = key);
|
|
29
18
|
return result;
|
|
30
19
|
}
|
|
31
|
-
|
|
20
|
+
const unitsMap = {
|
|
32
21
|
'#Ang': 'Angle',
|
|
33
22
|
'#Rsl': 'Density',
|
|
34
23
|
'#Rlt': 'Distance',
|
|
@@ -41,17 +30,17 @@ var unitsMap = {
|
|
|
41
30
|
'RrIn': 'Inches',
|
|
42
31
|
'RrCm': 'Centimeters',
|
|
43
32
|
};
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
const unitsMapRev = revMap(unitsMap);
|
|
34
|
+
let logErrors = false;
|
|
46
35
|
export function setLogErrors(value) {
|
|
47
36
|
logErrors = value;
|
|
48
37
|
}
|
|
49
38
|
function makeType(name, classID) {
|
|
50
|
-
return { name
|
|
39
|
+
return { name, classID };
|
|
51
40
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
const nullType = makeType('', 'null');
|
|
42
|
+
const USE_CHINESE = false; // Testing
|
|
43
|
+
const fieldToExtType = {
|
|
55
44
|
strokeStyleContent: makeType('', 'solidColorLayer'),
|
|
56
45
|
printProofSetup: makeType(USE_CHINESE ? '校样设置' : 'Proof Setup', 'proofSetup'),
|
|
57
46
|
Grad: makeType(USE_CHINESE ? '渐变' : 'Gradient', 'Grdn'),
|
|
@@ -134,7 +123,7 @@ var fieldToExtType = {
|
|
|
134
123
|
FXRefPoint: nullType,
|
|
135
124
|
ClMg: makeType('', 'ClMg'),
|
|
136
125
|
};
|
|
137
|
-
|
|
126
|
+
const fieldToArrayExtType = {
|
|
138
127
|
'Crv ': makeType('', 'CrPt'),
|
|
139
128
|
Clrs: makeType('', 'Clrt'),
|
|
140
129
|
Trns: makeType('', 'TrnS'),
|
|
@@ -167,7 +156,7 @@ var fieldToArrayExtType = {
|
|
|
167
156
|
list: nullType,
|
|
168
157
|
Adjs: makeType('', 'CrvA'),
|
|
169
158
|
};
|
|
170
|
-
|
|
159
|
+
const typeToField = {
|
|
171
160
|
'TEXT': [
|
|
172
161
|
'Txt ', 'printerName', 'Nm ', 'Idnt', 'blackAndWhitePresetFileName', 'LUT3DFileName',
|
|
173
162
|
'presetFileName', 'curvesPresetFileName', 'mixerPresetFileName', 'placed', 'description', 'reason',
|
|
@@ -241,10 +230,10 @@ var typeToField = {
|
|
|
241
230
|
'obj ': ['null', 'Chnl'],
|
|
242
231
|
'Pth ': ['DspF'],
|
|
243
232
|
};
|
|
244
|
-
|
|
233
|
+
const channels = [
|
|
245
234
|
'Rd ', 'Grn ', 'Bl ', 'Yllw', 'Ylw ', 'Cyn ', 'Mgnt', 'Blck', 'Gry ', 'Lmnc', 'A ', 'B ',
|
|
246
235
|
];
|
|
247
|
-
|
|
236
|
+
const fieldToArrayType = {
|
|
248
237
|
'Mnm ': 'long',
|
|
249
238
|
'Mxm ': 'long',
|
|
250
239
|
FrLs: 'long',
|
|
@@ -284,21 +273,17 @@ var fieldToArrayType = {
|
|
|
284
273
|
compList: 'long',
|
|
285
274
|
Chnl: 'enum',
|
|
286
275
|
};
|
|
287
|
-
|
|
288
|
-
for (
|
|
289
|
-
|
|
290
|
-
for (var _b = 0, _c = typeToField[type]; _b < _c.length; _b++) {
|
|
291
|
-
var field = _c[_b];
|
|
276
|
+
const fieldToType = {};
|
|
277
|
+
for (const type of Object.keys(typeToField)) {
|
|
278
|
+
for (const field of typeToField[type]) {
|
|
292
279
|
fieldToType[field] = type;
|
|
293
280
|
}
|
|
294
281
|
}
|
|
295
|
-
for (
|
|
296
|
-
var field = _e[_d];
|
|
282
|
+
for (const field of Object.keys(fieldToExtType)) {
|
|
297
283
|
if (!fieldToType[field])
|
|
298
284
|
fieldToType[field] = 'Objc';
|
|
299
285
|
}
|
|
300
|
-
for (
|
|
301
|
-
var field = _g[_f];
|
|
286
|
+
for (const field of Object.keys(fieldToArrayExtType)) {
|
|
302
287
|
fieldToArrayType[field] = 'Objc';
|
|
303
288
|
}
|
|
304
289
|
function getTypeByKey(key, value, root, parent) {
|
|
@@ -342,7 +327,7 @@ function getTypeByKey(key, value, root, parent) {
|
|
|
342
327
|
}
|
|
343
328
|
}
|
|
344
329
|
export function readAsciiStringOrClassId(reader) {
|
|
345
|
-
|
|
330
|
+
const length = readInt32(reader);
|
|
346
331
|
return readAsciiString(reader, length || 4);
|
|
347
332
|
}
|
|
348
333
|
function writeAsciiStringOrClassId(writer, value) {
|
|
@@ -354,21 +339,21 @@ function writeAsciiStringOrClassId(writer, value) {
|
|
|
354
339
|
else {
|
|
355
340
|
// write ascii string
|
|
356
341
|
writeInt32(writer, value.length);
|
|
357
|
-
for (
|
|
342
|
+
for (let i = 0; i < value.length; i++) {
|
|
358
343
|
writeUint8(writer, value.charCodeAt(i));
|
|
359
344
|
}
|
|
360
345
|
}
|
|
361
346
|
}
|
|
362
347
|
export function readDescriptorStructure(reader, includeClass) {
|
|
363
|
-
|
|
364
|
-
|
|
348
|
+
const struct = readClassStructure(reader);
|
|
349
|
+
const object = includeClass ? { _name: struct.name, _classID: struct.classID } : {};
|
|
365
350
|
// console.log('>> ', struct);
|
|
366
|
-
|
|
367
|
-
for (
|
|
368
|
-
|
|
369
|
-
|
|
351
|
+
const itemsCount = readUint32(reader);
|
|
352
|
+
for (let i = 0; i < itemsCount; i++) {
|
|
353
|
+
const key = readAsciiStringOrClassId(reader);
|
|
354
|
+
const type = readSignature(reader);
|
|
370
355
|
// console.log(`> '${key}' '${type}'`);
|
|
371
|
-
|
|
356
|
+
const data = readOSType(reader, type, includeClass);
|
|
372
357
|
// if (!getTypeByKey(key, data)) console.log(`> '${key}' '${type}'`, data);
|
|
373
358
|
object[key] = data;
|
|
374
359
|
}
|
|
@@ -380,19 +365,18 @@ export function writeDescriptorStructure(writer, name, classId, value, root) {
|
|
|
380
365
|
// write class structure
|
|
381
366
|
writeUnicodeStringWithPadding(writer, name);
|
|
382
367
|
writeAsciiStringOrClassId(writer, classId);
|
|
383
|
-
|
|
384
|
-
|
|
368
|
+
const keys = Object.keys(value);
|
|
369
|
+
let keyCount = keys.length;
|
|
385
370
|
if ('_name' in value)
|
|
386
371
|
keyCount--;
|
|
387
372
|
if ('_classID' in value)
|
|
388
373
|
keyCount--;
|
|
389
374
|
writeUint32(writer, keyCount);
|
|
390
|
-
for (
|
|
391
|
-
var key = keys_1[_i];
|
|
375
|
+
for (const key of keys) {
|
|
392
376
|
if (key === '_name' || key === '_classID')
|
|
393
377
|
continue;
|
|
394
|
-
|
|
395
|
-
|
|
378
|
+
let type = getTypeByKey(key, value[key], root, value);
|
|
379
|
+
let extType = fieldToExtType[key];
|
|
396
380
|
if (key === 'bounds' && root === 'text') {
|
|
397
381
|
extType = makeType('', 'bounds');
|
|
398
382
|
}
|
|
@@ -496,7 +480,7 @@ export function writeDescriptorStructure(writer, name, classId, value, root) {
|
|
|
496
480
|
writeSignature(writer, type || 'long');
|
|
497
481
|
writeOSType(writer, type || 'long', value[key], key, extType, root);
|
|
498
482
|
if (logErrors && !type)
|
|
499
|
-
console.log(
|
|
483
|
+
console.log(`Missing descriptor field type for: '${key}' in`, value);
|
|
500
484
|
}
|
|
501
485
|
}
|
|
502
486
|
function readOSType(reader, type, includeClass) {
|
|
@@ -507,10 +491,10 @@ function readOSType(reader, type, includeClass) {
|
|
|
507
491
|
case 'GlbO': // GlobalObject same as Descriptor
|
|
508
492
|
return readDescriptorStructure(reader, includeClass);
|
|
509
493
|
case 'VlLs': { // List
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
for (
|
|
513
|
-
|
|
494
|
+
const length = readInt32(reader);
|
|
495
|
+
const items = [];
|
|
496
|
+
for (let i = 0; i < length; i++) {
|
|
497
|
+
const itemType = readSignature(reader);
|
|
514
498
|
// console.log(' >', itemType);
|
|
515
499
|
items.push(readOSType(reader, itemType, includeClass));
|
|
516
500
|
}
|
|
@@ -519,32 +503,32 @@ function readOSType(reader, type, includeClass) {
|
|
|
519
503
|
case 'doub': // Double
|
|
520
504
|
return readFloat64(reader);
|
|
521
505
|
case 'UntF': { // Unit double
|
|
522
|
-
|
|
523
|
-
|
|
506
|
+
const units = readSignature(reader);
|
|
507
|
+
const value = readFloat64(reader);
|
|
524
508
|
if (!unitsMap[units])
|
|
525
|
-
throw new Error(
|
|
526
|
-
return { units: unitsMap[units], value
|
|
509
|
+
throw new Error(`Invalid units: ${units}`);
|
|
510
|
+
return { units: unitsMap[units], value };
|
|
527
511
|
}
|
|
528
512
|
case 'UnFl': { // Unit float
|
|
529
|
-
|
|
530
|
-
|
|
513
|
+
const units = readSignature(reader);
|
|
514
|
+
const value = readFloat32(reader);
|
|
531
515
|
if (!unitsMap[units])
|
|
532
|
-
throw new Error(
|
|
533
|
-
return { units: unitsMap[units], value
|
|
516
|
+
throw new Error(`Invalid units: ${units}`);
|
|
517
|
+
return { units: unitsMap[units], value };
|
|
534
518
|
}
|
|
535
519
|
case 'TEXT': // String
|
|
536
520
|
return readUnicodeString(reader);
|
|
537
521
|
case 'enum': { // Enumerated
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
return
|
|
522
|
+
const enumType = readAsciiStringOrClassId(reader);
|
|
523
|
+
const value = readAsciiStringOrClassId(reader);
|
|
524
|
+
return `${enumType}.${value}`;
|
|
541
525
|
}
|
|
542
526
|
case 'long': // Integer
|
|
543
527
|
return readInt32(reader);
|
|
544
528
|
case 'comp': { // Large Integer
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
return { low
|
|
529
|
+
const low = readUint32(reader);
|
|
530
|
+
const high = readUint32(reader);
|
|
531
|
+
return { low, high };
|
|
548
532
|
}
|
|
549
533
|
case 'bool': // Boolean
|
|
550
534
|
return !!readUint8(reader);
|
|
@@ -552,45 +536,45 @@ function readOSType(reader, type, includeClass) {
|
|
|
552
536
|
case 'GlbC': // Class
|
|
553
537
|
return readClassStructure(reader);
|
|
554
538
|
case 'alis': { // Alias
|
|
555
|
-
|
|
556
|
-
return readAsciiString(reader,
|
|
539
|
+
const length = readInt32(reader);
|
|
540
|
+
return readAsciiString(reader, length);
|
|
557
541
|
}
|
|
558
542
|
case 'tdta': { // Raw Data
|
|
559
|
-
|
|
560
|
-
return readBytes(reader,
|
|
543
|
+
const length = readInt32(reader);
|
|
544
|
+
return readBytes(reader, length);
|
|
561
545
|
}
|
|
562
546
|
case 'ObAr': { // Object array
|
|
563
547
|
readInt32(reader); // version: 16
|
|
564
548
|
readUnicodeString(reader); // name: ''
|
|
565
549
|
readAsciiStringOrClassId(reader); // 'rationalPoint'
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
for (
|
|
569
|
-
|
|
550
|
+
const length = readInt32(reader);
|
|
551
|
+
const items = [];
|
|
552
|
+
for (let i = 0; i < length; i++) {
|
|
553
|
+
const type1 = readAsciiStringOrClassId(reader); // type Hrzn | Vrtc
|
|
570
554
|
readSignature(reader); // UnFl
|
|
571
555
|
readSignature(reader); // units ? '#Pxl'
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
for (
|
|
556
|
+
const valuesCount = readInt32(reader);
|
|
557
|
+
const values = [];
|
|
558
|
+
for (let j = 0; j < valuesCount; j++) {
|
|
575
559
|
values.push(readFloat64(reader));
|
|
576
560
|
}
|
|
577
|
-
items.push({ type: type1, values
|
|
561
|
+
items.push({ type: type1, values });
|
|
578
562
|
}
|
|
579
563
|
return items;
|
|
580
564
|
}
|
|
581
565
|
case 'Pth ': { // File path
|
|
582
566
|
/*const length =*/ readInt32(reader); // total size of all fields below
|
|
583
|
-
|
|
567
|
+
const sig = readSignature(reader);
|
|
584
568
|
/*const pathSize =*/ readInt32LE(reader); // the same as length
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
return { sig
|
|
569
|
+
const charsCount = readInt32LE(reader);
|
|
570
|
+
const path = readUnicodeStringWithLengthLE(reader, charsCount);
|
|
571
|
+
return { sig, path };
|
|
588
572
|
}
|
|
589
573
|
default:
|
|
590
|
-
throw new Error(
|
|
574
|
+
throw new Error(`Invalid TySh descriptor OSType: ${type} at ${reader.offset.toString(16)}`);
|
|
591
575
|
}
|
|
592
576
|
}
|
|
593
|
-
|
|
577
|
+
const ObArTypes = {
|
|
594
578
|
meshPoints: 'rationalPoint',
|
|
595
579
|
quiltSliceX: 'UntF',
|
|
596
580
|
quiltSliceY: 'UntF',
|
|
@@ -603,40 +587,40 @@ function writeOSType(writer, type, value, key, extType, root) {
|
|
|
603
587
|
case 'Objc': // Descriptor
|
|
604
588
|
case 'GlbO': { // GlobalObject same as Descriptor
|
|
605
589
|
if (typeof value !== 'object')
|
|
606
|
-
throw new Error(
|
|
590
|
+
throw new Error(`Invalid struct value: ${JSON.stringify(value)}, key: ${key}`);
|
|
607
591
|
if (!extType)
|
|
608
|
-
throw new Error(
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
writeDescriptorStructure(writer,
|
|
592
|
+
throw new Error(`Missing ext type for: '${key}' (${JSON.stringify(value)})`);
|
|
593
|
+
const name = value._name || extType.name;
|
|
594
|
+
const classID = value._classID || extType.classID;
|
|
595
|
+
writeDescriptorStructure(writer, name, classID, value, root);
|
|
612
596
|
break;
|
|
613
597
|
}
|
|
614
598
|
case 'VlLs': // List
|
|
615
599
|
if (!Array.isArray(value))
|
|
616
|
-
throw new Error(
|
|
600
|
+
throw new Error(`Invalid list value: ${JSON.stringify(value)}, key: ${key}`);
|
|
617
601
|
writeInt32(writer, value.length);
|
|
618
|
-
for (
|
|
619
|
-
|
|
620
|
-
writeSignature(writer,
|
|
621
|
-
writeOSType(writer,
|
|
622
|
-
if (logErrors && !
|
|
623
|
-
console.log(
|
|
602
|
+
for (let i = 0; i < value.length; i++) {
|
|
603
|
+
const type = fieldToArrayType[key];
|
|
604
|
+
writeSignature(writer, type || 'long');
|
|
605
|
+
writeOSType(writer, type || 'long', value[i], `${key}[]`, fieldToArrayExtType[key], root);
|
|
606
|
+
if (logErrors && !type)
|
|
607
|
+
console.log(`Missing descriptor array type for: '${key}' in`, value);
|
|
624
608
|
}
|
|
625
609
|
break;
|
|
626
610
|
case 'doub': // Double
|
|
627
611
|
if (typeof value !== 'number')
|
|
628
|
-
throw new Error(
|
|
612
|
+
throw new Error(`Invalid number value: ${JSON.stringify(value)}, key: ${key}`);
|
|
629
613
|
writeFloat64(writer, value);
|
|
630
614
|
break;
|
|
631
615
|
case 'UntF': // Unit double
|
|
632
616
|
if (!unitsMapRev[value.units])
|
|
633
|
-
throw new Error(
|
|
617
|
+
throw new Error(`Invalid units: ${value.units} in ${key}`);
|
|
634
618
|
writeSignature(writer, unitsMapRev[value.units]);
|
|
635
619
|
writeFloat64(writer, value.value);
|
|
636
620
|
break;
|
|
637
621
|
case 'UnFl': // Unit float
|
|
638
622
|
if (!unitsMapRev[value.units])
|
|
639
|
-
throw new Error(
|
|
623
|
+
throw new Error(`Invalid units: ${value.units} in ${key}`);
|
|
640
624
|
writeSignature(writer, unitsMapRev[value.units]);
|
|
641
625
|
writeFloat32(writer, value.value);
|
|
642
626
|
break;
|
|
@@ -645,22 +629,22 @@ function writeOSType(writer, type, value, key, extType, root) {
|
|
|
645
629
|
break;
|
|
646
630
|
case 'enum': { // Enumerated
|
|
647
631
|
if (typeof value !== 'string')
|
|
648
|
-
throw new Error(
|
|
649
|
-
|
|
632
|
+
throw new Error(`Invalid enum value: ${JSON.stringify(value)}, key: ${key}`);
|
|
633
|
+
const [_type, val] = value.split('.');
|
|
650
634
|
writeAsciiStringOrClassId(writer, _type);
|
|
651
635
|
writeAsciiStringOrClassId(writer, val);
|
|
652
636
|
break;
|
|
653
637
|
}
|
|
654
638
|
case 'long': // Integer
|
|
655
639
|
if (typeof value !== 'number')
|
|
656
|
-
throw new Error(
|
|
640
|
+
throw new Error(`Invalid integer value: ${JSON.stringify(value)}, key: ${key}`);
|
|
657
641
|
writeInt32(writer, value);
|
|
658
642
|
break;
|
|
659
643
|
// case 'comp': // Large Integer
|
|
660
644
|
// writeLargeInteger(reader);
|
|
661
645
|
case 'bool': // Boolean
|
|
662
646
|
if (typeof value !== 'boolean')
|
|
663
|
-
throw new Error(
|
|
647
|
+
throw new Error(`Invalid boolean value: ${JSON.stringify(value)}, key: ${key}`);
|
|
664
648
|
writeUint8(writer, value ? 1 : 0);
|
|
665
649
|
break;
|
|
666
650
|
// case 'type': // Class
|
|
@@ -675,44 +659,44 @@ function writeOSType(writer, type, value, key, extType, root) {
|
|
|
675
659
|
case 'ObAr': { // Object array
|
|
676
660
|
writeInt32(writer, 16); // version
|
|
677
661
|
writeUnicodeStringWithPadding(writer, ''); // name
|
|
678
|
-
|
|
679
|
-
if (!
|
|
680
|
-
throw new Error(
|
|
681
|
-
writeAsciiStringOrClassId(writer,
|
|
662
|
+
const type = ObArTypes[key];
|
|
663
|
+
if (!type)
|
|
664
|
+
throw new Error(`Not implemented ObArType for: ${key}`);
|
|
665
|
+
writeAsciiStringOrClassId(writer, type);
|
|
682
666
|
writeInt32(writer, value.length);
|
|
683
|
-
for (
|
|
667
|
+
for (let i = 0; i < value.length; i++) {
|
|
684
668
|
writeAsciiStringOrClassId(writer, value[i].type); // Hrzn | Vrtc
|
|
685
669
|
writeSignature(writer, 'UnFl');
|
|
686
670
|
writeSignature(writer, '#Pxl');
|
|
687
671
|
writeInt32(writer, value[i].values.length);
|
|
688
|
-
for (
|
|
672
|
+
for (let j = 0; j < value[i].values.length; j++) {
|
|
689
673
|
writeFloat64(writer, value[i].values[j]);
|
|
690
674
|
}
|
|
691
675
|
}
|
|
692
676
|
break;
|
|
693
677
|
}
|
|
694
678
|
case 'Pth ': { // File path
|
|
695
|
-
|
|
696
|
-
writeInt32(writer,
|
|
679
|
+
const length = 4 + 4 + 4 + value.path.length * 2;
|
|
680
|
+
writeInt32(writer, length);
|
|
697
681
|
writeSignature(writer, value.sig);
|
|
698
|
-
writeInt32LE(writer,
|
|
682
|
+
writeInt32LE(writer, length);
|
|
699
683
|
writeInt32LE(writer, value.path.length);
|
|
700
684
|
writeUnicodeStringWithoutLengthLE(writer, value.path);
|
|
701
685
|
break;
|
|
702
686
|
}
|
|
703
687
|
default:
|
|
704
|
-
throw new Error(
|
|
688
|
+
throw new Error(`Not implemented descriptor OSType: ${type}`);
|
|
705
689
|
}
|
|
706
690
|
}
|
|
707
691
|
function readReferenceStructure(reader) {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
for (
|
|
711
|
-
|
|
692
|
+
const itemsCount = readInt32(reader);
|
|
693
|
+
const items = [];
|
|
694
|
+
for (let i = 0; i < itemsCount; i++) {
|
|
695
|
+
const type = readSignature(reader);
|
|
712
696
|
switch (type) {
|
|
713
697
|
case 'prop': { // Property
|
|
714
698
|
readClassStructure(reader);
|
|
715
|
-
|
|
699
|
+
const keyID = readAsciiStringOrClassId(reader);
|
|
716
700
|
items.push(keyID);
|
|
717
701
|
break;
|
|
718
702
|
}
|
|
@@ -721,9 +705,9 @@ function readReferenceStructure(reader) {
|
|
|
721
705
|
break;
|
|
722
706
|
case 'Enmr': { // Enumerated Reference
|
|
723
707
|
readClassStructure(reader);
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
items.push(
|
|
708
|
+
const typeID = readAsciiStringOrClassId(reader);
|
|
709
|
+
const value = readAsciiStringOrClassId(reader);
|
|
710
|
+
items.push(`${typeID}.${value}`);
|
|
727
711
|
break;
|
|
728
712
|
}
|
|
729
713
|
case 'rele': { // Offset
|
|
@@ -744,16 +728,16 @@ function readReferenceStructure(reader) {
|
|
|
744
728
|
break;
|
|
745
729
|
}
|
|
746
730
|
default:
|
|
747
|
-
throw new Error(
|
|
731
|
+
throw new Error(`Invalid descriptor reference type: ${type}`);
|
|
748
732
|
}
|
|
749
733
|
}
|
|
750
734
|
return items;
|
|
751
735
|
}
|
|
752
736
|
function writeReferenceStructure(writer, _key, items) {
|
|
753
737
|
writeInt32(writer, items.length);
|
|
754
|
-
for (
|
|
755
|
-
|
|
756
|
-
|
|
738
|
+
for (let i = 0; i < items.length; i++) {
|
|
739
|
+
const value = items[i];
|
|
740
|
+
let type = 'unknown';
|
|
757
741
|
if (typeof value === 'string') {
|
|
758
742
|
if (/^[a-z ]+\.[a-z ]+$/i.test(value)) {
|
|
759
743
|
type = 'Enmr';
|
|
@@ -767,7 +751,7 @@ function writeReferenceStructure(writer, _key, items) {
|
|
|
767
751
|
// case 'prop': // Property
|
|
768
752
|
// case 'Clss': // Class
|
|
769
753
|
case 'Enmr': { // Enumerated Reference
|
|
770
|
-
|
|
754
|
+
const [typeID, enumValue] = value.split('.');
|
|
771
755
|
writeClassStructure(writer, '\0', typeID);
|
|
772
756
|
writeAsciiStringOrClassId(writer, typeID);
|
|
773
757
|
writeAsciiStringOrClassId(writer, enumValue);
|
|
@@ -782,31 +766,29 @@ function writeReferenceStructure(writer, _key, items) {
|
|
|
782
766
|
break;
|
|
783
767
|
}
|
|
784
768
|
default:
|
|
785
|
-
throw new Error(
|
|
769
|
+
throw new Error(`Invalid descriptor reference type: ${type}`);
|
|
786
770
|
}
|
|
787
771
|
}
|
|
788
772
|
return items;
|
|
789
773
|
}
|
|
790
774
|
function readClassStructure(reader) {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
return { name
|
|
775
|
+
const name = readUnicodeString(reader);
|
|
776
|
+
const classID = readAsciiStringOrClassId(reader);
|
|
777
|
+
return { name, classID };
|
|
794
778
|
}
|
|
795
779
|
function writeClassStructure(writer, name, classID) {
|
|
796
780
|
writeUnicodeString(writer, name);
|
|
797
781
|
writeAsciiStringOrClassId(writer, classID);
|
|
798
782
|
}
|
|
799
|
-
export function readVersionAndDescriptor(reader, includeClass) {
|
|
800
|
-
|
|
801
|
-
var version = readUint32(reader);
|
|
783
|
+
export function readVersionAndDescriptor(reader, includeClass = false) {
|
|
784
|
+
const version = readUint32(reader);
|
|
802
785
|
if (version !== 16)
|
|
803
|
-
throw new Error(
|
|
804
|
-
|
|
786
|
+
throw new Error(`Invalid descriptor version: ${version}`);
|
|
787
|
+
const desc = readDescriptorStructure(reader, includeClass);
|
|
805
788
|
// console.log(require('util').inspect(desc, false, 99, true));
|
|
806
789
|
return desc;
|
|
807
790
|
}
|
|
808
|
-
export function writeVersionAndDescriptor(writer, name, classID, descriptor, root) {
|
|
809
|
-
if (root === void 0) { root = ''; }
|
|
791
|
+
export function writeVersionAndDescriptor(writer, name, classID, descriptor, root = '') {
|
|
810
792
|
writeUint32(writer, 16); // version
|
|
811
793
|
writeDescriptorStructure(writer, name, classID, descriptor, root);
|
|
812
794
|
}
|
|
@@ -825,17 +807,15 @@ export function descBoundsToBounds(desc) {
|
|
|
825
807
|
};
|
|
826
808
|
}
|
|
827
809
|
export function boundsToDescBounds(bounds) {
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
_a.Btom = unitsValue(bounds.bottom, 'bounds.bottom'),
|
|
835
|
-
_a;
|
|
810
|
+
return {
|
|
811
|
+
Left: unitsValue(bounds.left, 'bounds.left'),
|
|
812
|
+
['Top ']: unitsValue(bounds.top, 'bounds.top'),
|
|
813
|
+
Rght: unitsValue(bounds.right, 'bounds.right'),
|
|
814
|
+
Btom: unitsValue(bounds.bottom, 'bounds.bottom'),
|
|
815
|
+
};
|
|
836
816
|
}
|
|
837
817
|
function parseFxObject(fx) {
|
|
838
|
-
|
|
818
|
+
const stroke = {
|
|
839
819
|
enabled: !!fx.enab,
|
|
840
820
|
position: FStl.decode(fx.Styl),
|
|
841
821
|
fillType: FrFl.decode(fx.PntT),
|
|
@@ -858,7 +838,7 @@ function parseFxObject(fx) {
|
|
|
858
838
|
return stroke;
|
|
859
839
|
}
|
|
860
840
|
function serializeFxObject(stroke) {
|
|
861
|
-
|
|
841
|
+
let FrFX = {};
|
|
862
842
|
FrFX.enab = !!stroke.enabled;
|
|
863
843
|
if (stroke.present !== undefined)
|
|
864
844
|
FrFX.present = !!stroke.present;
|
|
@@ -872,46 +852,45 @@ function serializeFxObject(stroke) {
|
|
|
872
852
|
if (stroke.color)
|
|
873
853
|
FrFX['Clr '] = serializeColor(stroke.color);
|
|
874
854
|
if (stroke.gradient)
|
|
875
|
-
FrFX =
|
|
855
|
+
FrFX = Object.assign(Object.assign({}, FrFX), serializeGradientContent(stroke.gradient));
|
|
876
856
|
if (stroke.pattern)
|
|
877
|
-
FrFX =
|
|
857
|
+
FrFX = Object.assign(Object.assign({}, FrFX), serializePatternContent(stroke.pattern));
|
|
878
858
|
if (stroke.overprint !== undefined)
|
|
879
859
|
FrFX.overprint = !!stroke.overprint;
|
|
880
860
|
return FrFX;
|
|
881
861
|
}
|
|
882
862
|
export function serializeEffects(e, log, multi) {
|
|
883
863
|
var _a, _b, _c;
|
|
884
|
-
|
|
864
|
+
const info = multi ? {
|
|
885
865
|
'Scl ': unitsPercentF((_a = e.scale) !== null && _a !== void 0 ? _a : 1),
|
|
886
866
|
masterFXSwitch: !e.disabled,
|
|
887
867
|
} : {
|
|
888
868
|
masterFXSwitch: !e.disabled,
|
|
889
869
|
'Scl ': unitsPercentF((_b = e.scale) !== null && _b !== void 0 ? _b : 1),
|
|
890
870
|
};
|
|
891
|
-
|
|
892
|
-
for (
|
|
893
|
-
var key = arrayKeys_1[_i];
|
|
871
|
+
const arrayKeys = ['dropShadow', 'innerShadow', 'solidFill', 'gradientOverlay', 'stroke'];
|
|
872
|
+
for (const key of arrayKeys) {
|
|
894
873
|
if (e[key] && !Array.isArray(e[key]))
|
|
895
|
-
throw new Error(
|
|
874
|
+
throw new Error(`${key} should be an array`);
|
|
896
875
|
}
|
|
897
|
-
|
|
898
|
-
|
|
876
|
+
const useMulti = (arr) => !!arr && arr.length > 1 && multi;
|
|
877
|
+
const useSingle = (arr) => !!arr && arr.length >= 1 && (!multi || arr.length === 1);
|
|
899
878
|
if (useSingle(e.dropShadow))
|
|
900
879
|
info.DrSh = serializeEffectObject(e.dropShadow[0], 'dropShadow', log);
|
|
901
880
|
if (useMulti(e.dropShadow))
|
|
902
|
-
info.dropShadowMulti = e.dropShadow.map(
|
|
881
|
+
info.dropShadowMulti = e.dropShadow.map(i => serializeEffectObject(i, 'dropShadow', log));
|
|
903
882
|
if (useSingle(e.innerShadow))
|
|
904
883
|
info.IrSh = serializeEffectObject(e.innerShadow[0], 'innerShadow', log);
|
|
905
884
|
if (useMulti(e.innerShadow))
|
|
906
|
-
info.innerShadowMulti = e.innerShadow.map(
|
|
885
|
+
info.innerShadowMulti = e.innerShadow.map(i => serializeEffectObject(i, 'innerShadow', log));
|
|
907
886
|
if (e.outerGlow)
|
|
908
887
|
info.OrGl = serializeEffectObject(e.outerGlow, 'outerGlow', log);
|
|
909
888
|
if (useMulti(e.solidFill))
|
|
910
|
-
info.solidFillMulti = e.solidFill.map(
|
|
889
|
+
info.solidFillMulti = e.solidFill.map(i => serializeEffectObject(i, 'solidFill', log));
|
|
911
890
|
if (useMulti(e.gradientOverlay))
|
|
912
|
-
info.gradientFillMulti = e.gradientOverlay.map(
|
|
891
|
+
info.gradientFillMulti = e.gradientOverlay.map(i => serializeEffectObject(i, 'gradientOverlay', log));
|
|
913
892
|
if (useMulti(e.stroke))
|
|
914
|
-
info.frameFXMulti = e.stroke.map(
|
|
893
|
+
info.frameFXMulti = e.stroke.map(i => serializeFxObject(i));
|
|
915
894
|
if (e.innerGlow)
|
|
916
895
|
info.IrGl = serializeEffectObject(e.innerGlow, 'innerGlow', log);
|
|
917
896
|
if (e.bevel)
|
|
@@ -928,12 +907,10 @@ export function serializeEffects(e, log, multi) {
|
|
|
928
907
|
info.FrFX = serializeFxObject((_c = e.stroke) === null || _c === void 0 ? void 0 : _c[0]);
|
|
929
908
|
if (multi) {
|
|
930
909
|
info.numModifyingFX = 0;
|
|
931
|
-
for (
|
|
932
|
-
|
|
933
|
-
var value = e[key];
|
|
910
|
+
for (const key of Object.keys(e)) {
|
|
911
|
+
const value = e[key];
|
|
934
912
|
if (Array.isArray(value)) {
|
|
935
|
-
for (
|
|
936
|
-
var effect = value_1[_f];
|
|
913
|
+
for (const effect of value) {
|
|
937
914
|
if (effect.enabled)
|
|
938
915
|
info.numModifyingFX++;
|
|
939
916
|
}
|
|
@@ -946,8 +923,8 @@ export function serializeEffects(e, log, multi) {
|
|
|
946
923
|
return info;
|
|
947
924
|
}
|
|
948
925
|
export function parseEffects(info, log) {
|
|
949
|
-
|
|
950
|
-
|
|
926
|
+
const effects = {};
|
|
927
|
+
const { masterFXSwitch, DrSh, dropShadowMulti, IrSh, innerShadowMulti, OrGl, IrGl, ebbl, SoFi, solidFillMulti, patternFill, GrFl, gradientFillMulti, ChFX, FrFX, frameFXMulti, numModifyingFX } = info, rest = __rest(info, ["masterFXSwitch", "DrSh", "dropShadowMulti", "IrSh", "innerShadowMulti", "OrGl", "IrGl", "ebbl", "SoFi", "solidFillMulti", "patternFill", "GrFl", "gradientFillMulti", "ChFX", "FrFX", "frameFXMulti", "numModifyingFX"]);
|
|
951
928
|
if (!masterFXSwitch)
|
|
952
929
|
effects.disabled = true;
|
|
953
930
|
if (info['Scl '])
|
|
@@ -955,11 +932,11 @@ export function parseEffects(info, log) {
|
|
|
955
932
|
if (DrSh)
|
|
956
933
|
effects.dropShadow = [parseEffectObject(DrSh, log)];
|
|
957
934
|
if (dropShadowMulti)
|
|
958
|
-
effects.dropShadow = dropShadowMulti.map(
|
|
935
|
+
effects.dropShadow = dropShadowMulti.map(i => parseEffectObject(i, log));
|
|
959
936
|
if (IrSh)
|
|
960
937
|
effects.innerShadow = [parseEffectObject(IrSh, log)];
|
|
961
938
|
if (innerShadowMulti)
|
|
962
|
-
effects.innerShadow = innerShadowMulti.map(
|
|
939
|
+
effects.innerShadow = innerShadowMulti.map(i => parseEffectObject(i, log));
|
|
963
940
|
if (OrGl)
|
|
964
941
|
effects.outerGlow = parseEffectObject(OrGl, log);
|
|
965
942
|
if (IrGl)
|
|
@@ -969,75 +946,69 @@ export function parseEffects(info, log) {
|
|
|
969
946
|
if (SoFi)
|
|
970
947
|
effects.solidFill = [parseEffectObject(SoFi, log)];
|
|
971
948
|
if (solidFillMulti)
|
|
972
|
-
effects.solidFill = solidFillMulti.map(
|
|
949
|
+
effects.solidFill = solidFillMulti.map(i => parseEffectObject(i, log));
|
|
973
950
|
if (patternFill)
|
|
974
951
|
effects.patternOverlay = parseEffectObject(patternFill, log);
|
|
975
952
|
if (GrFl)
|
|
976
953
|
effects.gradientOverlay = [parseEffectObject(GrFl, log)];
|
|
977
954
|
if (gradientFillMulti)
|
|
978
|
-
effects.gradientOverlay = gradientFillMulti.map(
|
|
955
|
+
effects.gradientOverlay = gradientFillMulti.map(i => parseEffectObject(i, log));
|
|
979
956
|
if (ChFX)
|
|
980
957
|
effects.satin = parseEffectObject(ChFX, log);
|
|
981
958
|
if (FrFX)
|
|
982
959
|
effects.stroke = [parseFxObject(FrFX)];
|
|
983
960
|
if (frameFXMulti)
|
|
984
|
-
effects.stroke = frameFXMulti.map(
|
|
961
|
+
effects.stroke = frameFXMulti.map(i => parseFxObject(i));
|
|
985
962
|
if (log && Object.keys(rest).length > 1)
|
|
986
963
|
console.log('Unhandled effect keys:', rest);
|
|
987
964
|
return effects;
|
|
988
965
|
}
|
|
989
966
|
function parseKeyList(keyList, logMissingFeatures) {
|
|
990
|
-
|
|
991
|
-
for (
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
967
|
+
const keys = [];
|
|
968
|
+
for (let j = 0; j < keyList.length; j++) {
|
|
969
|
+
const key = keyList[j];
|
|
970
|
+
const { time: { denominator, numerator }, selected, animKey } = key;
|
|
971
|
+
const time = { numerator, denominator };
|
|
972
|
+
const interpolation = animInterpStyleEnum.decode(key.animInterpStyle);
|
|
996
973
|
switch (animKey.Type) {
|
|
997
974
|
case 'keyType.Opct':
|
|
998
|
-
keys.push({ interpolation
|
|
975
|
+
keys.push({ interpolation, time, selected, type: 'opacity', value: parsePercent(animKey.Opct) });
|
|
999
976
|
break;
|
|
1000
977
|
case 'keyType.Pstn':
|
|
1001
|
-
keys.push({ interpolation
|
|
978
|
+
keys.push({ interpolation, time, selected, type: 'position', x: animKey.Hrzn, y: animKey.Vrtc });
|
|
1002
979
|
break;
|
|
1003
980
|
case 'keyType.Trnf':
|
|
1004
981
|
keys.push({
|
|
1005
|
-
interpolation:
|
|
1006
|
-
time: time,
|
|
1007
|
-
selected: selected,
|
|
1008
|
-
type: 'transform',
|
|
982
|
+
interpolation, time, selected, type: 'transform',
|
|
1009
983
|
scale: horzVrtcToXY(animKey['Scl ']), skew: horzVrtcToXY(animKey.Skew), rotation: animKey.rotation, translation: horzVrtcToXY(animKey.translation)
|
|
1010
984
|
});
|
|
1011
985
|
break;
|
|
1012
986
|
case 'keyType.sheetStyle': {
|
|
1013
|
-
|
|
987
|
+
const key = { interpolation, time, selected, type: 'style' };
|
|
1014
988
|
if (animKey.sheetStyle.Lefx)
|
|
1015
|
-
|
|
1016
|
-
keys.push(
|
|
989
|
+
key.style = parseEffects(animKey.sheetStyle.Lefx, logMissingFeatures);
|
|
990
|
+
keys.push(key);
|
|
1017
991
|
break;
|
|
1018
992
|
}
|
|
1019
993
|
case 'keyType.globalLighting': {
|
|
1020
994
|
keys.push({
|
|
1021
|
-
interpolation:
|
|
1022
|
-
time: time,
|
|
1023
|
-
selected: selected,
|
|
1024
|
-
type: 'globalLighting',
|
|
995
|
+
interpolation, time, selected, type: 'globalLighting',
|
|
1025
996
|
globalAngle: animKey.gblA, globalAltitude: animKey.globalAltitude
|
|
1026
997
|
});
|
|
1027
998
|
break;
|
|
1028
999
|
}
|
|
1029
|
-
default: throw new Error(
|
|
1000
|
+
default: throw new Error(`Unsupported keyType value`);
|
|
1030
1001
|
}
|
|
1031
1002
|
}
|
|
1032
1003
|
return keys;
|
|
1033
1004
|
}
|
|
1034
1005
|
function serializeKeyList(keys) {
|
|
1035
|
-
|
|
1036
|
-
for (
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1006
|
+
const keyList = [];
|
|
1007
|
+
for (let j = 0; j < keys.length; j++) {
|
|
1008
|
+
const key = keys[j];
|
|
1009
|
+
const { time, selected = false, interpolation } = key;
|
|
1010
|
+
const animInterpStyle = animInterpStyleEnum.encode(interpolation);
|
|
1011
|
+
let animKey;
|
|
1041
1012
|
switch (key.type) {
|
|
1042
1013
|
case 'opacity':
|
|
1043
1014
|
animKey = { Type: 'keyType.Opct', Opct: unitsPercent(key.value) };
|
|
@@ -1057,17 +1028,17 @@ function serializeKeyList(keys) {
|
|
|
1057
1028
|
animKey = { Type: 'keyType.globalLighting', gblA: key.globalAngle, globalAltitude: key.globalAltitude };
|
|
1058
1029
|
break;
|
|
1059
1030
|
}
|
|
1060
|
-
default: throw new Error(
|
|
1031
|
+
default: throw new Error(`Unsupported keyType value`);
|
|
1061
1032
|
}
|
|
1062
|
-
keyList.push({ Vrsn: 1, animInterpStyle
|
|
1033
|
+
keyList.push({ Vrsn: 1, animInterpStyle, time, animKey, selected });
|
|
1063
1034
|
}
|
|
1064
1035
|
return keyList;
|
|
1065
1036
|
}
|
|
1066
1037
|
export function parseTrackList(trackList, logMissingFeatures) {
|
|
1067
|
-
|
|
1068
|
-
for (
|
|
1069
|
-
|
|
1070
|
-
|
|
1038
|
+
const tracks = [];
|
|
1039
|
+
for (let i = 0; i < trackList.length; i++) {
|
|
1040
|
+
const tr = trackList[i];
|
|
1041
|
+
const track = {
|
|
1071
1042
|
type: stdTrackID.decode(tr.trackID),
|
|
1072
1043
|
enabled: tr.enab,
|
|
1073
1044
|
keys: parseKeyList(tr.keyList, logMissingFeatures),
|
|
@@ -1084,10 +1055,10 @@ export function parseTrackList(trackList, logMissingFeatures) {
|
|
|
1084
1055
|
return tracks;
|
|
1085
1056
|
}
|
|
1086
1057
|
export function serializeTrackList(tracks) {
|
|
1087
|
-
|
|
1088
|
-
for (
|
|
1089
|
-
|
|
1090
|
-
trackList.push(
|
|
1058
|
+
const trackList = [];
|
|
1059
|
+
for (let i = 0; i < tracks.length; i++) {
|
|
1060
|
+
const t = tracks[i];
|
|
1061
|
+
trackList.push(Object.assign(Object.assign({ trackID: stdTrackID.encode(t.type), Vrsn: 1, enab: !!t.enabled, Effc: !!t.effectParams }, (t.effectParams ? {
|
|
1091
1062
|
effectParams: {
|
|
1092
1063
|
keyList: serializeKeyList(t.keys),
|
|
1093
1064
|
fillCanvas: t.effectParams.fillCanvas,
|
|
@@ -1098,10 +1069,9 @@ export function serializeTrackList(tracks) {
|
|
|
1098
1069
|
return trackList;
|
|
1099
1070
|
}
|
|
1100
1071
|
function parseEffectObject(obj, reportErrors) {
|
|
1101
|
-
|
|
1102
|
-
for (
|
|
1103
|
-
|
|
1104
|
-
var val = obj[key];
|
|
1072
|
+
const result = {};
|
|
1073
|
+
for (const key of Object.keys(obj)) {
|
|
1074
|
+
const val = obj[key];
|
|
1105
1075
|
switch (key) {
|
|
1106
1076
|
case 'enab':
|
|
1107
1077
|
result.enabled = !!val;
|
|
@@ -1224,7 +1194,7 @@ function parseEffectObject(obj, reportErrors) {
|
|
|
1224
1194
|
case 'TrnS':
|
|
1225
1195
|
result.contour = {
|
|
1226
1196
|
name: val['Nm '],
|
|
1227
|
-
curve: val['Crv '].map(
|
|
1197
|
+
curve: val['Crv '].map(p => ({ x: p.Hrzn, y: p.Vrtc })),
|
|
1228
1198
|
};
|
|
1229
1199
|
break;
|
|
1230
1200
|
case 'Grad':
|
|
@@ -1242,22 +1212,21 @@ function parseEffectObject(obj, reportErrors) {
|
|
|
1242
1212
|
case '_classID':
|
|
1243
1213
|
break;
|
|
1244
1214
|
default:
|
|
1245
|
-
reportErrors && console.log(
|
|
1215
|
+
reportErrors && console.log(`Invalid effect key: '${key}', value:`, val);
|
|
1246
1216
|
}
|
|
1247
1217
|
}
|
|
1248
1218
|
return result;
|
|
1249
1219
|
}
|
|
1250
1220
|
function serializeEffectObject(obj, objName, reportErrors) {
|
|
1251
|
-
|
|
1221
|
+
const result = {
|
|
1252
1222
|
enab: false,
|
|
1253
1223
|
};
|
|
1254
1224
|
if (objName === 'dropShadow') {
|
|
1255
1225
|
result.TrnS = { 'Nm ': '', 'Crv ': [] };
|
|
1256
1226
|
}
|
|
1257
|
-
for (
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
var val = obj[key];
|
|
1227
|
+
for (const objKey of Object.keys(obj)) {
|
|
1228
|
+
const key = objKey;
|
|
1229
|
+
const val = obj[key];
|
|
1261
1230
|
switch (key) {
|
|
1262
1231
|
case 'enabled':
|
|
1263
1232
|
result.enab = !!val;
|
|
@@ -1383,7 +1352,7 @@ function serializeEffectObject(obj, objName, reportErrors) {
|
|
|
1383
1352
|
case 'contour': {
|
|
1384
1353
|
result[objName === 'satin' ? 'MpgS' : 'TrnS'] = {
|
|
1385
1354
|
'Nm ': val.name,
|
|
1386
|
-
'Crv ': val.curve.map(
|
|
1355
|
+
'Crv ': val.curve.map(p => ({ Hrzn: p.x, Vrtc: p.y })),
|
|
1387
1356
|
};
|
|
1388
1357
|
break;
|
|
1389
1358
|
}
|
|
@@ -1399,28 +1368,28 @@ function serializeEffectObject(obj, objName, reportErrors) {
|
|
|
1399
1368
|
result[key] = val;
|
|
1400
1369
|
break;
|
|
1401
1370
|
default:
|
|
1402
|
-
reportErrors && console.log(
|
|
1371
|
+
reportErrors && console.log(`Invalid effect key: '${key}', value:`, val);
|
|
1403
1372
|
}
|
|
1404
1373
|
}
|
|
1405
1374
|
return result;
|
|
1406
1375
|
}
|
|
1407
1376
|
function parseGradient(grad) {
|
|
1408
1377
|
if (grad.GrdF === 'GrdF.CstS') {
|
|
1409
|
-
|
|
1378
|
+
const samples = grad.Intr || 4096;
|
|
1410
1379
|
return {
|
|
1411
1380
|
type: 'solid',
|
|
1412
1381
|
name: grad['Nm '],
|
|
1413
1382
|
smoothness: grad.Intr / 4096,
|
|
1414
|
-
colorStops: grad.Clrs.map(
|
|
1383
|
+
colorStops: grad.Clrs.map(s => ({
|
|
1415
1384
|
color: parseColor(s['Clr ']),
|
|
1416
|
-
location: s.Lctn /
|
|
1385
|
+
location: s.Lctn / samples,
|
|
1417
1386
|
midpoint: s.Mdpn / 100,
|
|
1418
|
-
})
|
|
1419
|
-
opacityStops: grad.Trns.map(
|
|
1387
|
+
})),
|
|
1388
|
+
opacityStops: grad.Trns.map(s => ({
|
|
1420
1389
|
opacity: parsePercent(s.Opct),
|
|
1421
|
-
location: s.Lctn /
|
|
1390
|
+
location: s.Lctn / samples,
|
|
1422
1391
|
midpoint: s.Mdpn / 100,
|
|
1423
|
-
})
|
|
1392
|
+
})),
|
|
1424
1393
|
};
|
|
1425
1394
|
}
|
|
1426
1395
|
else {
|
|
@@ -1432,33 +1401,33 @@ function parseGradient(grad) {
|
|
|
1432
1401
|
randomSeed: grad.RndS,
|
|
1433
1402
|
restrictColors: !!grad.VctC,
|
|
1434
1403
|
addTransparency: !!grad.ShTr,
|
|
1435
|
-
min: grad['Mnm '].map(
|
|
1436
|
-
max: grad['Mxm '].map(
|
|
1404
|
+
min: grad['Mnm '].map(x => x / 100),
|
|
1405
|
+
max: grad['Mxm '].map(x => x / 100),
|
|
1437
1406
|
};
|
|
1438
1407
|
}
|
|
1439
1408
|
}
|
|
1440
1409
|
function serializeGradient(grad) {
|
|
1441
1410
|
var _a, _b;
|
|
1442
1411
|
if (grad.type === 'solid') {
|
|
1443
|
-
|
|
1412
|
+
const samples = Math.round(((_a = grad.smoothness) !== null && _a !== void 0 ? _a : 1) * 4096);
|
|
1444
1413
|
return {
|
|
1445
1414
|
'Nm ': grad.name || '',
|
|
1446
1415
|
GrdF: 'GrdF.CstS',
|
|
1447
|
-
Intr:
|
|
1448
|
-
Clrs: grad.colorStops.map(
|
|
1416
|
+
Intr: samples,
|
|
1417
|
+
Clrs: grad.colorStops.map(s => {
|
|
1449
1418
|
var _a;
|
|
1450
1419
|
return ({
|
|
1451
1420
|
'Clr ': serializeColor(s.color),
|
|
1452
1421
|
Type: 'Clry.UsrS',
|
|
1453
|
-
Lctn: Math.round(s.location *
|
|
1422
|
+
Lctn: Math.round(s.location * samples),
|
|
1454
1423
|
Mdpn: Math.round(((_a = s.midpoint) !== null && _a !== void 0 ? _a : 0.5) * 100),
|
|
1455
1424
|
});
|
|
1456
1425
|
}),
|
|
1457
|
-
Trns: grad.opacityStops.map(
|
|
1426
|
+
Trns: grad.opacityStops.map(s => {
|
|
1458
1427
|
var _a;
|
|
1459
1428
|
return ({
|
|
1460
1429
|
Opct: unitsPercent(s.opacity),
|
|
1461
|
-
Lctn: Math.round(s.location *
|
|
1430
|
+
Lctn: Math.round(s.location * samples),
|
|
1462
1431
|
Mdpn: Math.round(((_a = s.midpoint) !== null && _a !== void 0 ? _a : 0.5) * 100),
|
|
1463
1432
|
});
|
|
1464
1433
|
}),
|
|
@@ -1473,13 +1442,13 @@ function serializeGradient(grad) {
|
|
|
1473
1442
|
ClrS: ClrS.encode(grad.colorModel),
|
|
1474
1443
|
RndS: grad.randomSeed || 0,
|
|
1475
1444
|
Smth: Math.round(((_b = grad.roughness) !== null && _b !== void 0 ? _b : 1) * 4096),
|
|
1476
|
-
'Mnm ': (grad.min || [0, 0, 0, 0]).map(
|
|
1477
|
-
'Mxm ': (grad.max || [1, 1, 1, 1]).map(
|
|
1445
|
+
'Mnm ': (grad.min || [0, 0, 0, 0]).map(x => x * 100),
|
|
1446
|
+
'Mxm ': (grad.max || [1, 1, 1, 1]).map(x => x * 100),
|
|
1478
1447
|
};
|
|
1479
1448
|
}
|
|
1480
1449
|
}
|
|
1481
1450
|
function parseGradientContent(descriptor) {
|
|
1482
|
-
|
|
1451
|
+
const result = parseGradient(descriptor.Grad);
|
|
1483
1452
|
result.style = GrdT.decode(descriptor.Type);
|
|
1484
1453
|
if (descriptor.Dthr !== undefined)
|
|
1485
1454
|
result.dither = descriptor.Dthr;
|
|
@@ -1502,7 +1471,7 @@ function parseGradientContent(descriptor) {
|
|
|
1502
1471
|
return result;
|
|
1503
1472
|
}
|
|
1504
1473
|
function parsePatternContent(descriptor) {
|
|
1505
|
-
|
|
1474
|
+
const result = {
|
|
1506
1475
|
name: descriptor.Ptrn['Nm '],
|
|
1507
1476
|
id: descriptor.Ptrn.Idnt,
|
|
1508
1477
|
};
|
|
@@ -1517,7 +1486,7 @@ export function parseVectorContent(descriptor) {
|
|
|
1517
1486
|
return parseGradientContent(descriptor);
|
|
1518
1487
|
}
|
|
1519
1488
|
else if ('Ptrn' in descriptor) {
|
|
1520
|
-
return
|
|
1489
|
+
return Object.assign({ type: 'pattern' }, parsePatternContent(descriptor));
|
|
1521
1490
|
}
|
|
1522
1491
|
else if ('Clr ' in descriptor) {
|
|
1523
1492
|
return { type: 'color', color: parseColor(descriptor['Clr ']) };
|
|
@@ -1527,7 +1496,7 @@ export function parseVectorContent(descriptor) {
|
|
|
1527
1496
|
}
|
|
1528
1497
|
}
|
|
1529
1498
|
function serializeGradientContent(content) {
|
|
1530
|
-
|
|
1499
|
+
const result = {};
|
|
1531
1500
|
if (content.dither !== undefined)
|
|
1532
1501
|
result.Dthr = content.dither;
|
|
1533
1502
|
if (content.interpolationMethod !== undefined)
|
|
@@ -1551,7 +1520,7 @@ function serializeGradientContent(content) {
|
|
|
1551
1520
|
return result;
|
|
1552
1521
|
}
|
|
1553
1522
|
function serializePatternContent(content) {
|
|
1554
|
-
|
|
1523
|
+
const result = {
|
|
1555
1524
|
Ptrn: {
|
|
1556
1525
|
'Nm ': content.name || '',
|
|
1557
1526
|
Idnt: content.id || '',
|
|
@@ -1627,14 +1596,14 @@ export function parseAngle(x) {
|
|
|
1627
1596
|
if (x === undefined)
|
|
1628
1597
|
return 0;
|
|
1629
1598
|
if (x.units !== 'Angle')
|
|
1630
|
-
throw new Error(
|
|
1599
|
+
throw new Error(`Invalid units: ${x.units}`);
|
|
1631
1600
|
return x.value;
|
|
1632
1601
|
}
|
|
1633
1602
|
export function parsePercent(x) {
|
|
1634
1603
|
if (x === undefined)
|
|
1635
1604
|
return 1;
|
|
1636
1605
|
if (x.units !== 'Percent')
|
|
1637
|
-
throw new Error(
|
|
1606
|
+
throw new Error(`Invalid units: ${x.units}`);
|
|
1638
1607
|
return x.value / 100;
|
|
1639
1608
|
}
|
|
1640
1609
|
export function parsePercentOrAngle(x) {
|
|
@@ -1644,26 +1613,23 @@ export function parsePercentOrAngle(x) {
|
|
|
1644
1613
|
return x.value / 100;
|
|
1645
1614
|
if (x.units === 'Angle')
|
|
1646
1615
|
return x.value / 360;
|
|
1647
|
-
throw new Error(
|
|
1616
|
+
throw new Error(`Invalid units: ${x.units}`);
|
|
1648
1617
|
}
|
|
1649
|
-
export function parseUnits(
|
|
1650
|
-
var units = _a.units, value = _a.value;
|
|
1618
|
+
export function parseUnits({ units, value }) {
|
|
1651
1619
|
if (units !== 'Pixels' && units !== 'Millimeters' && units !== 'Points' && units !== 'None' &&
|
|
1652
1620
|
units !== 'Picas' && units !== 'Inches' && units !== 'Centimeters' && units !== 'Density') {
|
|
1653
|
-
throw new Error(
|
|
1621
|
+
throw new Error(`Invalid units: ${JSON.stringify({ units, value })}`);
|
|
1654
1622
|
}
|
|
1655
|
-
return { value
|
|
1623
|
+
return { value, units };
|
|
1656
1624
|
}
|
|
1657
|
-
export function parseUnitsOrNumber(value, units) {
|
|
1658
|
-
if (units === void 0) { units = 'Pixels'; }
|
|
1625
|
+
export function parseUnitsOrNumber(value, units = 'Pixels') {
|
|
1659
1626
|
if (typeof value === 'number')
|
|
1660
|
-
return { value
|
|
1627
|
+
return { value, units };
|
|
1661
1628
|
return parseUnits(value);
|
|
1662
1629
|
}
|
|
1663
|
-
export function parseUnitsToNumber(
|
|
1664
|
-
var units = _a.units, value = _a.value;
|
|
1630
|
+
export function parseUnitsToNumber({ units, value }, expectedUnits) {
|
|
1665
1631
|
if (units !== expectedUnits)
|
|
1666
|
-
throw new Error(
|
|
1632
|
+
throw new Error(`Invalid units: ${JSON.stringify({ units, value })}`);
|
|
1667
1633
|
return value;
|
|
1668
1634
|
}
|
|
1669
1635
|
export function unitsAngle(value) {
|
|
@@ -1679,29 +1645,28 @@ export function unitsValue(x, key) {
|
|
|
1679
1645
|
if (x == null)
|
|
1680
1646
|
return { units: 'Pixels', value: 0 };
|
|
1681
1647
|
if (typeof x !== 'object')
|
|
1682
|
-
throw new Error(
|
|
1683
|
-
|
|
1648
|
+
throw new Error(`Invalid value: ${JSON.stringify(x)} (key: ${key}) (should have value and units)`);
|
|
1649
|
+
const { units, value } = x;
|
|
1684
1650
|
if (typeof value !== 'number')
|
|
1685
|
-
throw new Error(
|
|
1651
|
+
throw new Error(`Invalid value in ${JSON.stringify(x)} (key: ${key})`);
|
|
1686
1652
|
if (units !== 'Pixels' && units !== 'Millimeters' && units !== 'Points' && units !== 'None' &&
|
|
1687
1653
|
units !== 'Picas' && units !== 'Inches' && units !== 'Centimeters' && units !== 'Density') {
|
|
1688
|
-
throw new Error(
|
|
1654
|
+
throw new Error(`Invalid units in ${JSON.stringify(x)} (key: ${key})`);
|
|
1689
1655
|
}
|
|
1690
|
-
return { units
|
|
1656
|
+
return { units, value };
|
|
1691
1657
|
}
|
|
1692
|
-
export function frac(
|
|
1693
|
-
|
|
1694
|
-
return { numerator: numerator, denominator: denominator };
|
|
1658
|
+
export function frac({ numerator, denominator }) {
|
|
1659
|
+
return { numerator, denominator };
|
|
1695
1660
|
}
|
|
1696
|
-
export
|
|
1661
|
+
export const textGridding = createEnum('textGridding', 'none', {
|
|
1697
1662
|
none: 'None',
|
|
1698
1663
|
round: 'Rnd ',
|
|
1699
1664
|
});
|
|
1700
|
-
export
|
|
1665
|
+
export const Ornt = createEnum('Ornt', 'horizontal', {
|
|
1701
1666
|
horizontal: 'Hrzn',
|
|
1702
1667
|
vertical: 'Vrtc',
|
|
1703
1668
|
});
|
|
1704
|
-
export
|
|
1669
|
+
export const Annt = createEnum('Annt', 'sharp', {
|
|
1705
1670
|
none: 'Anno',
|
|
1706
1671
|
sharp: 'antiAliasSharp',
|
|
1707
1672
|
crisp: 'AnCr',
|
|
@@ -1710,7 +1675,7 @@ export var Annt = createEnum('Annt', 'sharp', {
|
|
|
1710
1675
|
platform: 'antiAliasPlatformGray',
|
|
1711
1676
|
platformLCD: 'antiAliasPlatformLCD',
|
|
1712
1677
|
});
|
|
1713
|
-
export
|
|
1678
|
+
export const warpStyle = createEnum('warpStyle', 'none', {
|
|
1714
1679
|
none: 'warpNone',
|
|
1715
1680
|
arc: 'warpArc',
|
|
1716
1681
|
arcLower: 'warpArcLower',
|
|
@@ -1730,7 +1695,7 @@ export var warpStyle = createEnum('warpStyle', 'none', {
|
|
|
1730
1695
|
cylinder: 'warpCylinder',
|
|
1731
1696
|
custom: 'warpCustom',
|
|
1732
1697
|
});
|
|
1733
|
-
export
|
|
1698
|
+
export const BlnM = createEnum('BlnM', 'normal', {
|
|
1734
1699
|
'normal': 'Nrml',
|
|
1735
1700
|
'dissolve': 'Dslv',
|
|
1736
1701
|
'darken': 'Drkn',
|
|
@@ -1763,168 +1728,168 @@ export var BlnM = createEnum('BlnM', 'normal', {
|
|
|
1763
1728
|
'height': 'Hght',
|
|
1764
1729
|
'subtraction': 'Sbtr', // 2nd version of subtract ?
|
|
1765
1730
|
});
|
|
1766
|
-
export
|
|
1731
|
+
export const BESl = createEnum('BESl', 'inner bevel', {
|
|
1767
1732
|
'inner bevel': 'InrB',
|
|
1768
1733
|
'outer bevel': 'OtrB',
|
|
1769
1734
|
'emboss': 'Embs',
|
|
1770
1735
|
'pillow emboss': 'PlEb',
|
|
1771
1736
|
'stroke emboss': 'strokeEmboss',
|
|
1772
1737
|
});
|
|
1773
|
-
export
|
|
1738
|
+
export const bvlT = createEnum('bvlT', 'smooth', {
|
|
1774
1739
|
'smooth': 'SfBL',
|
|
1775
1740
|
'chisel hard': 'PrBL',
|
|
1776
1741
|
'chisel soft': 'Slmt',
|
|
1777
1742
|
});
|
|
1778
|
-
export
|
|
1743
|
+
export const BESs = createEnum('BESs', 'up', {
|
|
1779
1744
|
up: 'In ',
|
|
1780
1745
|
down: 'Out ',
|
|
1781
1746
|
});
|
|
1782
|
-
export
|
|
1747
|
+
export const BETE = createEnum('BETE', 'softer', {
|
|
1783
1748
|
softer: 'SfBL',
|
|
1784
1749
|
precise: 'PrBL',
|
|
1785
1750
|
});
|
|
1786
|
-
export
|
|
1751
|
+
export const IGSr = createEnum('IGSr', 'edge', {
|
|
1787
1752
|
edge: 'SrcE',
|
|
1788
1753
|
center: 'SrcC',
|
|
1789
1754
|
});
|
|
1790
|
-
export
|
|
1755
|
+
export const GrdT = createEnum('GrdT', 'linear', {
|
|
1791
1756
|
linear: 'Lnr ',
|
|
1792
1757
|
radial: 'Rdl ',
|
|
1793
1758
|
angle: 'Angl',
|
|
1794
1759
|
reflected: 'Rflc',
|
|
1795
1760
|
diamond: 'Dmnd',
|
|
1796
1761
|
});
|
|
1797
|
-
export
|
|
1762
|
+
export const animInterpStyleEnum = createEnum('animInterpStyle', 'linear', {
|
|
1798
1763
|
linear: 'Lnr ',
|
|
1799
1764
|
hold: 'hold',
|
|
1800
1765
|
});
|
|
1801
|
-
export
|
|
1766
|
+
export const stdTrackID = createEnum('stdTrackID', 'opacity', {
|
|
1802
1767
|
opacity: 'opacityTrack',
|
|
1803
1768
|
style: 'styleTrack',
|
|
1804
1769
|
sheetTransform: 'sheetTransformTrack',
|
|
1805
1770
|
sheetPosition: 'sheetPositionTrack',
|
|
1806
1771
|
globalLighting: 'globalLightingTrack',
|
|
1807
1772
|
});
|
|
1808
|
-
export
|
|
1773
|
+
export const gradientInterpolationMethodType = createEnum('gradientInterpolationMethodType', 'perceptual', {
|
|
1809
1774
|
perceptual: 'Perc',
|
|
1810
1775
|
linear: 'Lnr ',
|
|
1811
1776
|
classic: 'Gcls',
|
|
1812
1777
|
smooth: 'Smoo',
|
|
1813
1778
|
// TODO: stripes
|
|
1814
1779
|
});
|
|
1815
|
-
export
|
|
1780
|
+
export const ClrS = createEnum('ClrS', 'rgb', {
|
|
1816
1781
|
rgb: 'RGBC',
|
|
1817
1782
|
hsb: 'HSBl',
|
|
1818
1783
|
lab: 'LbCl',
|
|
1819
1784
|
hsl: 'HSLC',
|
|
1820
1785
|
});
|
|
1821
|
-
export
|
|
1786
|
+
export const FStl = createEnum('FStl', 'outside', {
|
|
1822
1787
|
outside: 'OutF',
|
|
1823
1788
|
center: 'CtrF',
|
|
1824
1789
|
inside: 'InsF'
|
|
1825
1790
|
});
|
|
1826
|
-
export
|
|
1791
|
+
export const FrFl = createEnum('FrFl', 'color', {
|
|
1827
1792
|
color: 'SClr',
|
|
1828
1793
|
gradient: 'GrFl',
|
|
1829
1794
|
pattern: 'Ptrn',
|
|
1830
1795
|
});
|
|
1831
|
-
export
|
|
1796
|
+
export const ESliceType = createEnum('ESliceType', 'image', {
|
|
1832
1797
|
image: 'Img ',
|
|
1833
1798
|
noImage: 'noImage',
|
|
1834
1799
|
});
|
|
1835
|
-
export
|
|
1800
|
+
export const ESliceHorzAlign = createEnum('ESliceHorzAlign', 'default', {
|
|
1836
1801
|
default: 'default',
|
|
1837
1802
|
});
|
|
1838
|
-
export
|
|
1803
|
+
export const ESliceVertAlign = createEnum('ESliceVertAlign', 'default', {
|
|
1839
1804
|
default: 'default',
|
|
1840
1805
|
});
|
|
1841
|
-
export
|
|
1806
|
+
export const ESliceOrigin = createEnum('ESliceOrigin', 'userGenerated', {
|
|
1842
1807
|
userGenerated: 'userGenerated',
|
|
1843
1808
|
autoGenerated: 'autoGenerated',
|
|
1844
1809
|
layer: 'layer',
|
|
1845
1810
|
});
|
|
1846
|
-
export
|
|
1811
|
+
export const ESliceBGColorType = createEnum('ESliceBGColorType', 'none', {
|
|
1847
1812
|
none: 'None',
|
|
1848
1813
|
matte: 'matte',
|
|
1849
1814
|
color: 'Clr ',
|
|
1850
1815
|
});
|
|
1851
|
-
export
|
|
1816
|
+
export const strokeStyleLineCapType = createEnum('strokeStyleLineCapType', 'butt', {
|
|
1852
1817
|
butt: 'strokeStyleButtCap',
|
|
1853
1818
|
round: 'strokeStyleRoundCap',
|
|
1854
1819
|
square: 'strokeStyleSquareCap',
|
|
1855
1820
|
});
|
|
1856
|
-
export
|
|
1821
|
+
export const strokeStyleLineJoinType = createEnum('strokeStyleLineJoinType', 'miter', {
|
|
1857
1822
|
miter: 'strokeStyleMiterJoin',
|
|
1858
1823
|
round: 'strokeStyleRoundJoin',
|
|
1859
1824
|
bevel: 'strokeStyleBevelJoin',
|
|
1860
1825
|
});
|
|
1861
|
-
export
|
|
1826
|
+
export const strokeStyleLineAlignment = createEnum('strokeStyleLineAlignment', 'inside', {
|
|
1862
1827
|
inside: 'strokeStyleAlignInside',
|
|
1863
1828
|
center: 'strokeStyleAlignCenter',
|
|
1864
1829
|
outside: 'strokeStyleAlignOutside',
|
|
1865
1830
|
});
|
|
1866
|
-
export
|
|
1831
|
+
export const BlrM = createEnum('BlrM', 'ispinmage', {
|
|
1867
1832
|
spin: 'Spn ',
|
|
1868
1833
|
zoom: 'Zm ',
|
|
1869
1834
|
});
|
|
1870
|
-
export
|
|
1835
|
+
export const BlrQ = createEnum('BlrQ', 'good', {
|
|
1871
1836
|
draft: 'Drft',
|
|
1872
1837
|
good: 'Gd ',
|
|
1873
1838
|
best: 'Bst ',
|
|
1874
1839
|
});
|
|
1875
|
-
export
|
|
1840
|
+
export const SmBM = createEnum('SmBM', 'normal', {
|
|
1876
1841
|
normal: 'SBMN',
|
|
1877
1842
|
'edge only': 'SBME',
|
|
1878
1843
|
'overlay edge': 'SBMO',
|
|
1879
1844
|
});
|
|
1880
|
-
export
|
|
1845
|
+
export const SmBQ = createEnum('SmBQ', 'medium', {
|
|
1881
1846
|
low: 'SBQL',
|
|
1882
1847
|
medium: 'SBQM',
|
|
1883
1848
|
high: 'SBQH',
|
|
1884
1849
|
});
|
|
1885
|
-
export
|
|
1850
|
+
export const DspM = createEnum('DspM', 'stretch to fit', {
|
|
1886
1851
|
'stretch to fit': 'StrF',
|
|
1887
1852
|
'tile': 'Tile',
|
|
1888
1853
|
});
|
|
1889
|
-
export
|
|
1854
|
+
export const UndA = createEnum('UndA', 'repeat edge pixels', {
|
|
1890
1855
|
'wrap around': 'WrpA',
|
|
1891
1856
|
'repeat edge pixels': 'RptE',
|
|
1892
1857
|
});
|
|
1893
|
-
export
|
|
1858
|
+
export const Cnvr = createEnum('Cnvr', 'rectangular to polar', {
|
|
1894
1859
|
'rectangular to polar': 'RctP',
|
|
1895
1860
|
'polar to rectangular': 'PlrR',
|
|
1896
1861
|
});
|
|
1897
|
-
export
|
|
1862
|
+
export const RplS = createEnum('RplS', 'medium', {
|
|
1898
1863
|
small: 'Sml ',
|
|
1899
1864
|
medium: 'Mdm ',
|
|
1900
1865
|
large: 'Lrg ',
|
|
1901
1866
|
});
|
|
1902
|
-
export
|
|
1867
|
+
export const SphM = createEnum('SphM', 'normal', {
|
|
1903
1868
|
'normal': 'Nrml',
|
|
1904
1869
|
'horizontal only': 'HrzO',
|
|
1905
1870
|
'vertical only': 'VrtO',
|
|
1906
1871
|
});
|
|
1907
|
-
export
|
|
1872
|
+
export const Wvtp = createEnum('Wvtp', 'sine', {
|
|
1908
1873
|
sine: 'WvSn',
|
|
1909
1874
|
triangle: 'WvTr',
|
|
1910
1875
|
square: 'WvSq',
|
|
1911
1876
|
});
|
|
1912
|
-
export
|
|
1877
|
+
export const ZZTy = createEnum('ZZTy', 'pond ripples', {
|
|
1913
1878
|
'around center': 'ArnC',
|
|
1914
1879
|
'out from center': 'OtFr',
|
|
1915
1880
|
'pond ripples': 'PndR',
|
|
1916
1881
|
});
|
|
1917
|
-
export
|
|
1882
|
+
export const Dstr = createEnum('Dstr', 'uniform', {
|
|
1918
1883
|
uniform: 'Unfr',
|
|
1919
1884
|
gaussian: 'Gsn ',
|
|
1920
1885
|
});
|
|
1921
|
-
export
|
|
1886
|
+
export const Chnl = createEnum('Chnl', 'composite', {
|
|
1922
1887
|
red: 'Rd ',
|
|
1923
1888
|
green: 'Grn ',
|
|
1924
1889
|
blue: 'Bl ',
|
|
1925
1890
|
composite: 'Cmps',
|
|
1926
1891
|
});
|
|
1927
|
-
export
|
|
1892
|
+
export const MztT = createEnum('MztT', 'fine dots', {
|
|
1928
1893
|
'fine dots': 'FnDt',
|
|
1929
1894
|
'medium dots': 'MdmD',
|
|
1930
1895
|
'grainy dots': 'GrnD',
|
|
@@ -1936,70 +1901,70 @@ export var MztT = createEnum('MztT', 'fine dots', {
|
|
|
1936
1901
|
'medium strokes': 'MdmS',
|
|
1937
1902
|
'long strokes': 'LngS',
|
|
1938
1903
|
});
|
|
1939
|
-
export
|
|
1904
|
+
export const Lns = createEnum('Lns ', '50-300mm zoom', {
|
|
1940
1905
|
'50-300mm zoom': 'Zm ',
|
|
1941
1906
|
'32mm prime': 'Nkn ',
|
|
1942
1907
|
'105mm prime': 'Nkn1',
|
|
1943
1908
|
'movie prime': 'PnVs',
|
|
1944
1909
|
});
|
|
1945
|
-
export
|
|
1910
|
+
export const blurType = createEnum('blurType', 'gaussian blur', {
|
|
1946
1911
|
'gaussian blur': 'GsnB',
|
|
1947
1912
|
'lens blur': 'lensBlur',
|
|
1948
1913
|
'motion blur': 'MtnB',
|
|
1949
1914
|
});
|
|
1950
|
-
export
|
|
1915
|
+
export const DfsM = createEnum('DfsM', 'normal', {
|
|
1951
1916
|
'normal': 'Nrml',
|
|
1952
1917
|
'darken only': 'DrkO',
|
|
1953
1918
|
'lighten only': 'LghO',
|
|
1954
1919
|
'anisotropic': 'anisotropic',
|
|
1955
1920
|
});
|
|
1956
|
-
export
|
|
1921
|
+
export const ExtT = createEnum('ExtT', 'blocks', {
|
|
1957
1922
|
blocks: 'Blks',
|
|
1958
1923
|
pyramids: 'Pyrm',
|
|
1959
1924
|
});
|
|
1960
|
-
export
|
|
1925
|
+
export const ExtR = createEnum('ExtR', 'random', {
|
|
1961
1926
|
random: 'Rndm',
|
|
1962
1927
|
'level-based': 'LvlB',
|
|
1963
1928
|
});
|
|
1964
|
-
export
|
|
1929
|
+
export const FlCl = createEnum('FlCl', 'background color', {
|
|
1965
1930
|
'background color': 'FlBc',
|
|
1966
1931
|
'foreground color': 'FlFr',
|
|
1967
1932
|
'inverse image': 'FlIn',
|
|
1968
1933
|
'unaltered image': 'FlSm',
|
|
1969
1934
|
});
|
|
1970
|
-
export
|
|
1935
|
+
export const CntE = createEnum('CntE', 'upper', {
|
|
1971
1936
|
lower: 'Lwr ',
|
|
1972
1937
|
upper: 'Upr ',
|
|
1973
1938
|
});
|
|
1974
|
-
export
|
|
1939
|
+
export const WndM = createEnum('WndM', 'wind', {
|
|
1975
1940
|
wind: 'Wnd ',
|
|
1976
1941
|
blast: 'Blst',
|
|
1977
1942
|
stagger: 'Stgr',
|
|
1978
1943
|
});
|
|
1979
|
-
export
|
|
1944
|
+
export const Drct = createEnum('Drct', 'from the right', {
|
|
1980
1945
|
left: 'Left',
|
|
1981
1946
|
right: 'Rght',
|
|
1982
1947
|
});
|
|
1983
|
-
export
|
|
1948
|
+
export const IntE = createEnum('IntE', 'odd lines', {
|
|
1984
1949
|
'odd lines': 'ElmO',
|
|
1985
1950
|
'even lines': 'ElmE',
|
|
1986
1951
|
});
|
|
1987
|
-
export
|
|
1952
|
+
export const IntC = createEnum('IntC', 'interpolation', {
|
|
1988
1953
|
duplication: 'CrtD',
|
|
1989
1954
|
interpolation: 'CrtI',
|
|
1990
1955
|
});
|
|
1991
|
-
export
|
|
1956
|
+
export const FlMd = createEnum('FlMd', 'wrap around', {
|
|
1992
1957
|
'set to transparent': 'Bckg',
|
|
1993
1958
|
'repeat edge pixels': 'Rpt ',
|
|
1994
1959
|
'wrap around': 'Wrp ',
|
|
1995
1960
|
});
|
|
1996
|
-
export
|
|
1961
|
+
export const prjM = createEnum('prjM', 'fisheye', {
|
|
1997
1962
|
'fisheye': 'fisP',
|
|
1998
1963
|
'perspective': 'perP',
|
|
1999
1964
|
'auto': 'auto',
|
|
2000
1965
|
'full spherical': 'fusP',
|
|
2001
1966
|
});
|
|
2002
|
-
export
|
|
1967
|
+
export const presetKindType = createEnum('presetKindType', 'presetKindCustom', {
|
|
2003
1968
|
custom: 'presetKindCustom',
|
|
2004
1969
|
default: 'presetKindDefault',
|
|
2005
1970
|
});
|