ag-psd 17.0.3 → 17.0.5
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/CHANGELOG.md +7 -0
- package/dist/additionalInfo.js +96 -47
- package/dist/additionalInfo.js.map +1 -1
- package/dist/bundle.js +96 -47
- package/dist/psd.d.ts +4 -4
- package/dist-es/additionalInfo.js +96 -47
- package/dist-es/additionalInfo.js.map +1 -1
- package/dist-es/psd.d.ts +4 -4
- package/package.json +1 -1
- package/src/additionalInfo.ts +101 -53
- package/src/psd.ts +4 -4
package/dist/bundle.js
CHANGED
|
@@ -1137,9 +1137,10 @@ addHandler('PlLd', hasKey('placedLayer'), function (reader, target, left) {
|
|
|
1137
1137
|
for (var i = 0; i < 8; i++)
|
|
1138
1138
|
(0, psdWriter_1.writeFloat64)(writer, placed.transform[i]);
|
|
1139
1139
|
(0, psdWriter_1.writeInt32)(writer, 0); // warp version
|
|
1140
|
-
var
|
|
1140
|
+
var warp = getWarpFromPlacedLayer(placed);
|
|
1141
|
+
var isQuilt = isQuiltWarp(warp);
|
|
1141
1142
|
var type = isQuilt ? 'quiltWarp' : 'warp';
|
|
1142
|
-
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', type, encodeWarp(
|
|
1143
|
+
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', type, encodeWarp(warp), type);
|
|
1143
1144
|
});
|
|
1144
1145
|
function uint8ToFloat32(array) {
|
|
1145
1146
|
return new Float32Array(array.buffer.slice(array.byteOffset), 0, array.byteLength / 4);
|
|
@@ -1963,6 +1964,39 @@ function serializeFilterFXItem(f) {
|
|
|
1963
1964
|
}
|
|
1964
1965
|
}
|
|
1965
1966
|
// let t: any;
|
|
1967
|
+
function getWarpFromPlacedLayer(placed) {
|
|
1968
|
+
if (placed.warp)
|
|
1969
|
+
return placed.warp;
|
|
1970
|
+
if (!placed.width || !placed.height)
|
|
1971
|
+
throw new Error('You must provide width and height of the linked image in placedLayer');
|
|
1972
|
+
var w = placed.width;
|
|
1973
|
+
var h = placed.height;
|
|
1974
|
+
var x0 = 0, x1 = w / 3, x2 = w * 2 / 3, x3 = w;
|
|
1975
|
+
var y0 = 0, y1 = h / 3, y2 = h * 2 / 3, y3 = h;
|
|
1976
|
+
return {
|
|
1977
|
+
style: 'custom',
|
|
1978
|
+
value: 0,
|
|
1979
|
+
perspective: 0,
|
|
1980
|
+
perspectiveOther: 0,
|
|
1981
|
+
rotate: 'horizontal',
|
|
1982
|
+
bounds: {
|
|
1983
|
+
top: { value: 0, units: 'Pixels' },
|
|
1984
|
+
left: { value: 0, units: 'Pixels' },
|
|
1985
|
+
bottom: { value: h, units: 'Pixels' },
|
|
1986
|
+
right: { value: w, units: 'Pixels' },
|
|
1987
|
+
},
|
|
1988
|
+
uOrder: 4,
|
|
1989
|
+
vOrder: 4,
|
|
1990
|
+
customEnvelopeWarp: {
|
|
1991
|
+
meshPoints: [
|
|
1992
|
+
{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x2, y: y0 }, { x: x3, y: y0 },
|
|
1993
|
+
{ x: x0, y: y1 }, { x: x1, y: y1 }, { x: x2, y: y1 }, { x: x3, y: y1 },
|
|
1994
|
+
{ x: x0, y: y2 }, { x: x1, y: y2 }, { x: x2, y: y2 }, { x: x3, y: y2 },
|
|
1995
|
+
{ x: x0, y: y3 }, { x: x1, y: y3 }, { x: x2, y: y3 }, { x: x3, y: y3 },
|
|
1996
|
+
],
|
|
1997
|
+
},
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
1966
2000
|
addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
|
|
1967
2001
|
if ((0, psdReader_1.readSignature)(reader) !== 'soLD')
|
|
1968
2002
|
throw new Error("Invalid SoLd type");
|
|
@@ -2014,44 +2048,12 @@ addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
|
|
|
2014
2048
|
(0, psdWriter_1.writeSignature)(writer, 'soLD');
|
|
2015
2049
|
(0, psdWriter_1.writeInt32)(writer, 4); // version
|
|
2016
2050
|
var placed = target.placedLayer;
|
|
2017
|
-
var warp = placed.warp;
|
|
2018
|
-
if (!warp) {
|
|
2019
|
-
if (!placed.width || !placed.height)
|
|
2020
|
-
throw new Error('You must provide width and height of the linked image in placedLayer');
|
|
2021
|
-
var w = placed.width;
|
|
2022
|
-
var h = placed.height;
|
|
2023
|
-
var x0 = 0, x1 = w / 3, x2 = w * 2 / 3, x3 = w;
|
|
2024
|
-
var y0 = 0, y1 = h / 3, y2 = h * 2 / 3, y3 = h;
|
|
2025
|
-
warp = {
|
|
2026
|
-
style: 'custom',
|
|
2027
|
-
value: 0,
|
|
2028
|
-
perspective: 0,
|
|
2029
|
-
perspectiveOther: 0,
|
|
2030
|
-
rotate: 'horizontal',
|
|
2031
|
-
bounds: {
|
|
2032
|
-
top: { value: 0, units: 'Pixels' },
|
|
2033
|
-
left: { value: 0, units: 'Pixels' },
|
|
2034
|
-
bottom: { value: h, units: 'Pixels' },
|
|
2035
|
-
right: { value: w, units: 'Pixels' },
|
|
2036
|
-
},
|
|
2037
|
-
uOrder: 4,
|
|
2038
|
-
vOrder: 4,
|
|
2039
|
-
customEnvelopeWarp: {
|
|
2040
|
-
meshPoints: [
|
|
2041
|
-
{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x2, y: y0 }, { x: x3, y: y0 },
|
|
2042
|
-
{ x: x0, y: y1 }, { x: x1, y: y1 }, { x: x2, y: y1 }, { x: x3, y: y1 },
|
|
2043
|
-
{ x: x0, y: y2 }, { x: x1, y: y2 }, { x: x2, y: y2 }, { x: x3, y: y2 },
|
|
2044
|
-
{ x: x0, y: y3 }, { x: x1, y: y3 }, { x: x2, y: y3 }, { x: x3, y: y3 },
|
|
2045
|
-
],
|
|
2046
|
-
},
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
2051
|
if (!placed.id || typeof placed.id !== 'string' || !/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(placed.id)) {
|
|
2050
2052
|
throw new Error('Placed layer ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)');
|
|
2051
2053
|
}
|
|
2052
2054
|
var desc = __assign(__assign({ Idnt: placed.id, placed: (_a = placed.placed) !== null && _a !== void 0 ? _a : placed.id, PgNm: placed.pageNumber || 1, totalPages: placed.totalPages || 1 }, (placed.crop ? { Crop: placed.crop } : {})), { frameStep: placed.frameStep || { numerator: 0, denominator: 600 }, duration: placed.duration || { numerator: 0, denominator: 600 }, frameCount: placed.frameCount || 0, Annt: 16, Type: placedLayerTypes.indexOf(placed.type), Trnf: placed.transform, nonAffineTransform: (_b = placed.nonAffineTransform) !== null && _b !== void 0 ? _b : placed.transform,
|
|
2053
2055
|
// quiltWarp: {} as any,
|
|
2054
|
-
warp: encodeWarp(
|
|
2056
|
+
warp: encodeWarp(getWarpFromPlacedLayer(placed)), 'Sz ': {
|
|
2055
2057
|
_name: '',
|
|
2056
2058
|
_classID: 'Pnt ',
|
|
2057
2059
|
Wdth: placed.width || 0,
|
|
@@ -2131,6 +2133,42 @@ else {
|
|
|
2131
2133
|
}, function (_writer, _target) {
|
|
2132
2134
|
});
|
|
2133
2135
|
}
|
|
2136
|
+
/*
|
|
2137
|
+
interface CAIDesc {
|
|
2138
|
+
enab: boolean;
|
|
2139
|
+
generationalGuid: string;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
addHandler(
|
|
2143
|
+
'CAI ', // content credentials ? something to do with generative tech
|
|
2144
|
+
() => false,
|
|
2145
|
+
(reader, _target, left) => {
|
|
2146
|
+
const version = readUint32(reader); // 3
|
|
2147
|
+
const desc = readVersionAndDescriptor(reader) as CAIDesc;
|
|
2148
|
+
console.log('CAI', require('util').inspect(desc, false, 99, true));
|
|
2149
|
+
console.log('CAI', { version });
|
|
2150
|
+
console.log('CAI left', readBytes(reader, left())); // 8 bytes left, all zeroes
|
|
2151
|
+
},
|
|
2152
|
+
(_writer, _target) => {
|
|
2153
|
+
},
|
|
2154
|
+
);
|
|
2155
|
+
*/
|
|
2156
|
+
/*
|
|
2157
|
+
interface GenIDesc {
|
|
2158
|
+
isUsingGenTech: number;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
addHandler(
|
|
2162
|
+
'GenI', // generative tech
|
|
2163
|
+
() => false,
|
|
2164
|
+
(reader, _target, left) => {
|
|
2165
|
+
const desc = readVersionAndDescriptor(reader) as GenIDesc;
|
|
2166
|
+
console.log('GenI', require('util').inspect(desc, false, 99, true));
|
|
2167
|
+
},
|
|
2168
|
+
(_writer, _target) => {
|
|
2169
|
+
},
|
|
2170
|
+
);
|
|
2171
|
+
*/
|
|
2134
2172
|
function readRect(reader) {
|
|
2135
2173
|
var top = (0, psdReader_1.readInt32)(reader);
|
|
2136
2174
|
var left = (0, psdReader_1.readInt32)(reader);
|
|
@@ -2247,6 +2285,9 @@ addHandler('lnk2', function (target) { return !!target.linkedFiles && target.lin
|
|
|
2247
2285
|
var size = readLength64(reader); // size
|
|
2248
2286
|
var startOffset = reader.offset;
|
|
2249
2287
|
var type = (0, psdReader_1.readSignature)(reader);
|
|
2288
|
+
// liFD - linked file data
|
|
2289
|
+
// liFE - linked file external
|
|
2290
|
+
// liFA - linked file alias
|
|
2250
2291
|
var version = (0, psdReader_1.readInt32)(reader);
|
|
2251
2292
|
var id = (0, psdReader_1.readPascalString)(reader, 1);
|
|
2252
2293
|
var name_3 = (0, psdReader_1.readUnicodeString)(reader);
|
|
@@ -2256,7 +2297,7 @@ addHandler('lnk2', function (target) { return !!target.linkedFiles && target.lin
|
|
|
2256
2297
|
var hasFileOpenDescriptor = (0, psdReader_1.readUint8)(reader);
|
|
2257
2298
|
var fileOpenDescriptor = hasFileOpenDescriptor ? (0, descriptor_1.readVersionAndDescriptor)(reader) : undefined;
|
|
2258
2299
|
var linkedFileDescriptor = type === 'liFE' ? (0, descriptor_1.readVersionAndDescriptor)(reader) : undefined;
|
|
2259
|
-
var file = { id: id, name: name_3
|
|
2300
|
+
var file = { id: id, name: name_3 };
|
|
2260
2301
|
if (fileType)
|
|
2261
2302
|
file.type = fileType;
|
|
2262
2303
|
if (fileCreator)
|
|
@@ -2284,14 +2325,14 @@ addHandler('lnk2', function (target) { return !!target.linkedFiles && target.lin
|
|
|
2284
2325
|
if (type === 'liFA')
|
|
2285
2326
|
(0, psdReader_1.skipBytes)(reader, 8);
|
|
2286
2327
|
if (type === 'liFD')
|
|
2287
|
-
file.data = (0, psdReader_1.readBytes)(reader, dataSize);
|
|
2328
|
+
file.data = (0, psdReader_1.readBytes)(reader, dataSize); // seems to be a typo in docs
|
|
2288
2329
|
if (version >= 5)
|
|
2289
2330
|
file.childDocumentID = (0, psdReader_1.readUnicodeString)(reader);
|
|
2290
2331
|
if (version >= 6)
|
|
2291
2332
|
file.assetModTime = (0, psdReader_1.readFloat64)(reader);
|
|
2292
2333
|
if (version >= 7)
|
|
2293
2334
|
file.assetLockedState = (0, psdReader_1.readUint8)(reader);
|
|
2294
|
-
if (type === 'liFE')
|
|
2335
|
+
if (type === 'liFE' && version === 2)
|
|
2295
2336
|
file.data = (0, psdReader_1.readBytes)(reader, fileSize);
|
|
2296
2337
|
if (options.skipLinkedFilesData)
|
|
2297
2338
|
file.data = undefined;
|
|
@@ -3232,11 +3273,15 @@ addHandler('cinf', hasKey('compositorUsed'), function (reader, target, left) {
|
|
|
3232
3273
|
description: desc.description,
|
|
3233
3274
|
reason: desc.reason,
|
|
3234
3275
|
engine: enumValue(desc.Engn),
|
|
3235
|
-
enableCompCore: enumValue(desc.enableCompCore),
|
|
3236
|
-
enableCompCoreGPU: enumValue(desc.enableCompCoreGPU),
|
|
3237
|
-
compCoreSupport: enumValue(desc.compCoreSupport),
|
|
3238
|
-
compCoreGPUSupport: enumValue(desc.compCoreGPUSupport),
|
|
3239
3276
|
};
|
|
3277
|
+
if (desc.enableCompCore)
|
|
3278
|
+
target.compositorUsed.enableCompCore = enumValue(desc.enableCompCore);
|
|
3279
|
+
if (desc.enableCompCoreGPU)
|
|
3280
|
+
target.compositorUsed.enableCompCoreGPU = enumValue(desc.enableCompCoreGPU);
|
|
3281
|
+
if (desc.compCoreSupport)
|
|
3282
|
+
target.compositorUsed.compCoreSupport = enumValue(desc.compCoreSupport);
|
|
3283
|
+
if (desc.compCoreGPUSupport)
|
|
3284
|
+
target.compositorUsed.compCoreGPUSupport = enumValue(desc.compCoreGPUSupport);
|
|
3240
3285
|
(0, psdReader_1.skipBytes)(reader, left());
|
|
3241
3286
|
}, function (writer, target) {
|
|
3242
3287
|
var cinf = target.compositorUsed;
|
|
@@ -3246,12 +3291,16 @@ addHandler('cinf', hasKey('compositorUsed'), function (reader, target, left) {
|
|
|
3246
3291
|
description: cinf.description,
|
|
3247
3292
|
reason: cinf.reason,
|
|
3248
3293
|
Engn: "Engn.".concat(cinf.engine),
|
|
3249
|
-
enableCompCore: "enable.".concat(cinf.enableCompCore),
|
|
3250
|
-
enableCompCoreGPU: "enable.".concat(cinf.enableCompCoreGPU),
|
|
3251
|
-
// enableCompCoreThreads: `enable.feature`, // TESTING
|
|
3252
|
-
compCoreSupport: "reason.".concat(cinf.compCoreSupport),
|
|
3253
|
-
compCoreGPUSupport: "reason.".concat(cinf.compCoreGPUSupport),
|
|
3254
3294
|
};
|
|
3295
|
+
if (cinf.enableCompCore)
|
|
3296
|
+
desc.enableCompCore = "enable.".concat(cinf.enableCompCore);
|
|
3297
|
+
if (cinf.enableCompCoreGPU)
|
|
3298
|
+
desc.enableCompCoreGPU = "enable.".concat(cinf.enableCompCoreGPU);
|
|
3299
|
+
// desc.enableCompCoreThreads = `enable.feature`; // TESTING
|
|
3300
|
+
if (cinf.compCoreSupport)
|
|
3301
|
+
desc.compCoreSupport = "reason.".concat(cinf.compCoreSupport);
|
|
3302
|
+
if (cinf.compCoreGPUSupport)
|
|
3303
|
+
desc.compCoreGPUSupport = "reason.".concat(cinf.compCoreGPUSupport);
|
|
3255
3304
|
(0, descriptor_1.writeVersionAndDescriptor)(writer, '', 'null', desc);
|
|
3256
3305
|
});
|
|
3257
3306
|
// extension settings ?, ignore it
|
package/dist/psd.d.ts
CHANGED
|
@@ -1311,10 +1311,10 @@ export interface LayerAdditionalInfo {
|
|
|
1311
1311
|
description: string;
|
|
1312
1312
|
reason: string;
|
|
1313
1313
|
engine: string;
|
|
1314
|
-
enableCompCore
|
|
1315
|
-
enableCompCoreGPU
|
|
1316
|
-
compCoreSupport
|
|
1317
|
-
compCoreGPUSupport
|
|
1314
|
+
enableCompCore?: string;
|
|
1315
|
+
enableCompCoreGPU?: string;
|
|
1316
|
+
compCoreSupport?: string;
|
|
1317
|
+
compCoreGPUSupport?: string;
|
|
1318
1318
|
};
|
|
1319
1319
|
artboard?: {
|
|
1320
1320
|
rect: {
|
|
@@ -860,9 +860,10 @@ addHandler('PlLd', hasKey('placedLayer'), function (reader, target, left) {
|
|
|
860
860
|
for (var i = 0; i < 8; i++)
|
|
861
861
|
writeFloat64(writer, placed.transform[i]);
|
|
862
862
|
writeInt32(writer, 0); // warp version
|
|
863
|
-
var
|
|
863
|
+
var warp = getWarpFromPlacedLayer(placed);
|
|
864
|
+
var isQuilt = isQuiltWarp(warp);
|
|
864
865
|
var type = isQuilt ? 'quiltWarp' : 'warp';
|
|
865
|
-
writeVersionAndDescriptor(writer, '', type, encodeWarp(
|
|
866
|
+
writeVersionAndDescriptor(writer, '', type, encodeWarp(warp), type);
|
|
866
867
|
});
|
|
867
868
|
function uint8ToFloat32(array) {
|
|
868
869
|
return new Float32Array(array.buffer.slice(array.byteOffset), 0, array.byteLength / 4);
|
|
@@ -1686,6 +1687,39 @@ function serializeFilterFXItem(f) {
|
|
|
1686
1687
|
}
|
|
1687
1688
|
}
|
|
1688
1689
|
// let t: any;
|
|
1690
|
+
function getWarpFromPlacedLayer(placed) {
|
|
1691
|
+
if (placed.warp)
|
|
1692
|
+
return placed.warp;
|
|
1693
|
+
if (!placed.width || !placed.height)
|
|
1694
|
+
throw new Error('You must provide width and height of the linked image in placedLayer');
|
|
1695
|
+
var w = placed.width;
|
|
1696
|
+
var h = placed.height;
|
|
1697
|
+
var x0 = 0, x1 = w / 3, x2 = w * 2 / 3, x3 = w;
|
|
1698
|
+
var y0 = 0, y1 = h / 3, y2 = h * 2 / 3, y3 = h;
|
|
1699
|
+
return {
|
|
1700
|
+
style: 'custom',
|
|
1701
|
+
value: 0,
|
|
1702
|
+
perspective: 0,
|
|
1703
|
+
perspectiveOther: 0,
|
|
1704
|
+
rotate: 'horizontal',
|
|
1705
|
+
bounds: {
|
|
1706
|
+
top: { value: 0, units: 'Pixels' },
|
|
1707
|
+
left: { value: 0, units: 'Pixels' },
|
|
1708
|
+
bottom: { value: h, units: 'Pixels' },
|
|
1709
|
+
right: { value: w, units: 'Pixels' },
|
|
1710
|
+
},
|
|
1711
|
+
uOrder: 4,
|
|
1712
|
+
vOrder: 4,
|
|
1713
|
+
customEnvelopeWarp: {
|
|
1714
|
+
meshPoints: [
|
|
1715
|
+
{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x2, y: y0 }, { x: x3, y: y0 },
|
|
1716
|
+
{ x: x0, y: y1 }, { x: x1, y: y1 }, { x: x2, y: y1 }, { x: x3, y: y1 },
|
|
1717
|
+
{ x: x0, y: y2 }, { x: x1, y: y2 }, { x: x2, y: y2 }, { x: x3, y: y2 },
|
|
1718
|
+
{ x: x0, y: y3 }, { x: x1, y: y3 }, { x: x2, y: y3 }, { x: x3, y: y3 },
|
|
1719
|
+
],
|
|
1720
|
+
},
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1689
1723
|
addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
|
|
1690
1724
|
if (readSignature(reader) !== 'soLD')
|
|
1691
1725
|
throw new Error("Invalid SoLd type");
|
|
@@ -1737,44 +1771,12 @@ addHandler('SoLd', hasKey('placedLayer'), function (reader, target, left) {
|
|
|
1737
1771
|
writeSignature(writer, 'soLD');
|
|
1738
1772
|
writeInt32(writer, 4); // version
|
|
1739
1773
|
var placed = target.placedLayer;
|
|
1740
|
-
var warp = placed.warp;
|
|
1741
|
-
if (!warp) {
|
|
1742
|
-
if (!placed.width || !placed.height)
|
|
1743
|
-
throw new Error('You must provide width and height of the linked image in placedLayer');
|
|
1744
|
-
var w = placed.width;
|
|
1745
|
-
var h = placed.height;
|
|
1746
|
-
var x0 = 0, x1 = w / 3, x2 = w * 2 / 3, x3 = w;
|
|
1747
|
-
var y0 = 0, y1 = h / 3, y2 = h * 2 / 3, y3 = h;
|
|
1748
|
-
warp = {
|
|
1749
|
-
style: 'custom',
|
|
1750
|
-
value: 0,
|
|
1751
|
-
perspective: 0,
|
|
1752
|
-
perspectiveOther: 0,
|
|
1753
|
-
rotate: 'horizontal',
|
|
1754
|
-
bounds: {
|
|
1755
|
-
top: { value: 0, units: 'Pixels' },
|
|
1756
|
-
left: { value: 0, units: 'Pixels' },
|
|
1757
|
-
bottom: { value: h, units: 'Pixels' },
|
|
1758
|
-
right: { value: w, units: 'Pixels' },
|
|
1759
|
-
},
|
|
1760
|
-
uOrder: 4,
|
|
1761
|
-
vOrder: 4,
|
|
1762
|
-
customEnvelopeWarp: {
|
|
1763
|
-
meshPoints: [
|
|
1764
|
-
{ x: x0, y: y0 }, { x: x1, y: y0 }, { x: x2, y: y0 }, { x: x3, y: y0 },
|
|
1765
|
-
{ x: x0, y: y1 }, { x: x1, y: y1 }, { x: x2, y: y1 }, { x: x3, y: y1 },
|
|
1766
|
-
{ x: x0, y: y2 }, { x: x1, y: y2 }, { x: x2, y: y2 }, { x: x3, y: y2 },
|
|
1767
|
-
{ x: x0, y: y3 }, { x: x1, y: y3 }, { x: x2, y: y3 }, { x: x3, y: y3 },
|
|
1768
|
-
],
|
|
1769
|
-
},
|
|
1770
|
-
};
|
|
1771
|
-
}
|
|
1772
1774
|
if (!placed.id || typeof placed.id !== 'string' || !/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(placed.id)) {
|
|
1773
1775
|
throw new Error('Placed layer ID must be in a GUID format (example: 20953ddb-9391-11ec-b4f1-c15674f50bc4)');
|
|
1774
1776
|
}
|
|
1775
1777
|
var desc = __assign(__assign({ Idnt: placed.id, placed: (_a = placed.placed) !== null && _a !== void 0 ? _a : placed.id, PgNm: placed.pageNumber || 1, totalPages: placed.totalPages || 1 }, (placed.crop ? { Crop: placed.crop } : {})), { frameStep: placed.frameStep || { numerator: 0, denominator: 600 }, duration: placed.duration || { numerator: 0, denominator: 600 }, frameCount: placed.frameCount || 0, Annt: 16, Type: placedLayerTypes.indexOf(placed.type), Trnf: placed.transform, nonAffineTransform: (_b = placed.nonAffineTransform) !== null && _b !== void 0 ? _b : placed.transform,
|
|
1776
1778
|
// quiltWarp: {} as any,
|
|
1777
|
-
warp: encodeWarp(
|
|
1779
|
+
warp: encodeWarp(getWarpFromPlacedLayer(placed)), 'Sz ': {
|
|
1778
1780
|
_name: '',
|
|
1779
1781
|
_classID: 'Pnt ',
|
|
1780
1782
|
Wdth: placed.width || 0,
|
|
@@ -1854,6 +1856,42 @@ else {
|
|
|
1854
1856
|
}, function (_writer, _target) {
|
|
1855
1857
|
});
|
|
1856
1858
|
}
|
|
1859
|
+
/*
|
|
1860
|
+
interface CAIDesc {
|
|
1861
|
+
enab: boolean;
|
|
1862
|
+
generationalGuid: string;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
addHandler(
|
|
1866
|
+
'CAI ', // content credentials ? something to do with generative tech
|
|
1867
|
+
() => false,
|
|
1868
|
+
(reader, _target, left) => {
|
|
1869
|
+
const version = readUint32(reader); // 3
|
|
1870
|
+
const desc = readVersionAndDescriptor(reader) as CAIDesc;
|
|
1871
|
+
console.log('CAI', require('util').inspect(desc, false, 99, true));
|
|
1872
|
+
console.log('CAI', { version });
|
|
1873
|
+
console.log('CAI left', readBytes(reader, left())); // 8 bytes left, all zeroes
|
|
1874
|
+
},
|
|
1875
|
+
(_writer, _target) => {
|
|
1876
|
+
},
|
|
1877
|
+
);
|
|
1878
|
+
*/
|
|
1879
|
+
/*
|
|
1880
|
+
interface GenIDesc {
|
|
1881
|
+
isUsingGenTech: number;
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
addHandler(
|
|
1885
|
+
'GenI', // generative tech
|
|
1886
|
+
() => false,
|
|
1887
|
+
(reader, _target, left) => {
|
|
1888
|
+
const desc = readVersionAndDescriptor(reader) as GenIDesc;
|
|
1889
|
+
console.log('GenI', require('util').inspect(desc, false, 99, true));
|
|
1890
|
+
},
|
|
1891
|
+
(_writer, _target) => {
|
|
1892
|
+
},
|
|
1893
|
+
);
|
|
1894
|
+
*/
|
|
1857
1895
|
function readRect(reader) {
|
|
1858
1896
|
var top = readInt32(reader);
|
|
1859
1897
|
var left = readInt32(reader);
|
|
@@ -1970,6 +2008,9 @@ addHandler('lnk2', function (target) { return !!target.linkedFiles && target.lin
|
|
|
1970
2008
|
var size = readLength64(reader); // size
|
|
1971
2009
|
var startOffset = reader.offset;
|
|
1972
2010
|
var type = readSignature(reader);
|
|
2011
|
+
// liFD - linked file data
|
|
2012
|
+
// liFE - linked file external
|
|
2013
|
+
// liFA - linked file alias
|
|
1973
2014
|
var version = readInt32(reader);
|
|
1974
2015
|
var id = readPascalString(reader, 1);
|
|
1975
2016
|
var name_3 = readUnicodeString(reader);
|
|
@@ -1979,7 +2020,7 @@ addHandler('lnk2', function (target) { return !!target.linkedFiles && target.lin
|
|
|
1979
2020
|
var hasFileOpenDescriptor = readUint8(reader);
|
|
1980
2021
|
var fileOpenDescriptor = hasFileOpenDescriptor ? readVersionAndDescriptor(reader) : undefined;
|
|
1981
2022
|
var linkedFileDescriptor = type === 'liFE' ? readVersionAndDescriptor(reader) : undefined;
|
|
1982
|
-
var file = { id: id, name: name_3
|
|
2023
|
+
var file = { id: id, name: name_3 };
|
|
1983
2024
|
if (fileType)
|
|
1984
2025
|
file.type = fileType;
|
|
1985
2026
|
if (fileCreator)
|
|
@@ -2007,14 +2048,14 @@ addHandler('lnk2', function (target) { return !!target.linkedFiles && target.lin
|
|
|
2007
2048
|
if (type === 'liFA')
|
|
2008
2049
|
skipBytes(reader, 8);
|
|
2009
2050
|
if (type === 'liFD')
|
|
2010
|
-
file.data = readBytes(reader, dataSize);
|
|
2051
|
+
file.data = readBytes(reader, dataSize); // seems to be a typo in docs
|
|
2011
2052
|
if (version >= 5)
|
|
2012
2053
|
file.childDocumentID = readUnicodeString(reader);
|
|
2013
2054
|
if (version >= 6)
|
|
2014
2055
|
file.assetModTime = readFloat64(reader);
|
|
2015
2056
|
if (version >= 7)
|
|
2016
2057
|
file.assetLockedState = readUint8(reader);
|
|
2017
|
-
if (type === 'liFE')
|
|
2058
|
+
if (type === 'liFE' && version === 2)
|
|
2018
2059
|
file.data = readBytes(reader, fileSize);
|
|
2019
2060
|
if (options.skipLinkedFilesData)
|
|
2020
2061
|
file.data = undefined;
|
|
@@ -2954,11 +2995,15 @@ addHandler('cinf', hasKey('compositorUsed'), function (reader, target, left) {
|
|
|
2954
2995
|
description: desc.description,
|
|
2955
2996
|
reason: desc.reason,
|
|
2956
2997
|
engine: enumValue(desc.Engn),
|
|
2957
|
-
enableCompCore: enumValue(desc.enableCompCore),
|
|
2958
|
-
enableCompCoreGPU: enumValue(desc.enableCompCoreGPU),
|
|
2959
|
-
compCoreSupport: enumValue(desc.compCoreSupport),
|
|
2960
|
-
compCoreGPUSupport: enumValue(desc.compCoreGPUSupport),
|
|
2961
2998
|
};
|
|
2999
|
+
if (desc.enableCompCore)
|
|
3000
|
+
target.compositorUsed.enableCompCore = enumValue(desc.enableCompCore);
|
|
3001
|
+
if (desc.enableCompCoreGPU)
|
|
3002
|
+
target.compositorUsed.enableCompCoreGPU = enumValue(desc.enableCompCoreGPU);
|
|
3003
|
+
if (desc.compCoreSupport)
|
|
3004
|
+
target.compositorUsed.compCoreSupport = enumValue(desc.compCoreSupport);
|
|
3005
|
+
if (desc.compCoreGPUSupport)
|
|
3006
|
+
target.compositorUsed.compCoreGPUSupport = enumValue(desc.compCoreGPUSupport);
|
|
2962
3007
|
skipBytes(reader, left());
|
|
2963
3008
|
}, function (writer, target) {
|
|
2964
3009
|
var cinf = target.compositorUsed;
|
|
@@ -2968,12 +3013,16 @@ addHandler('cinf', hasKey('compositorUsed'), function (reader, target, left) {
|
|
|
2968
3013
|
description: cinf.description,
|
|
2969
3014
|
reason: cinf.reason,
|
|
2970
3015
|
Engn: "Engn.".concat(cinf.engine),
|
|
2971
|
-
enableCompCore: "enable.".concat(cinf.enableCompCore),
|
|
2972
|
-
enableCompCoreGPU: "enable.".concat(cinf.enableCompCoreGPU),
|
|
2973
|
-
// enableCompCoreThreads: `enable.feature`, // TESTING
|
|
2974
|
-
compCoreSupport: "reason.".concat(cinf.compCoreSupport),
|
|
2975
|
-
compCoreGPUSupport: "reason.".concat(cinf.compCoreGPUSupport),
|
|
2976
3016
|
};
|
|
3017
|
+
if (cinf.enableCompCore)
|
|
3018
|
+
desc.enableCompCore = "enable.".concat(cinf.enableCompCore);
|
|
3019
|
+
if (cinf.enableCompCoreGPU)
|
|
3020
|
+
desc.enableCompCoreGPU = "enable.".concat(cinf.enableCompCoreGPU);
|
|
3021
|
+
// desc.enableCompCoreThreads = `enable.feature`; // TESTING
|
|
3022
|
+
if (cinf.compCoreSupport)
|
|
3023
|
+
desc.compCoreSupport = "reason.".concat(cinf.compCoreSupport);
|
|
3024
|
+
if (cinf.compCoreGPUSupport)
|
|
3025
|
+
desc.compCoreGPUSupport = "reason.".concat(cinf.compCoreGPUSupport);
|
|
2977
3026
|
writeVersionAndDescriptor(writer, '', 'null', desc);
|
|
2978
3027
|
});
|
|
2979
3028
|
// extension settings ?, ignore it
|