ag-psd 24.0.0 → 26.0.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.
Files changed (53) hide show
  1. package/.v8-cache/v22.13.1-x64-00250a7c/4511bacf +0 -0
  2. package/.v8-cache/v22.13.1-x64-00250a7c/57d3380b +0 -0
  3. package/.v8-cache/v22.13.1-x64-00250a7c/6cbfc0ec +0 -0
  4. package/.v8-cache/v22.13.1-x64-00250a7c/7100ee08 +0 -0
  5. package/.v8-cache/v22.13.1-x64-00250a7c/75e41e43 +0 -0
  6. package/.v8-cache/v22.13.1-x64-00250a7c/8d0bf0b5 +0 -0
  7. package/.v8-cache/v22.13.1-x64-00250a7c/acc36e66 +0 -0
  8. package/.v8-cache/v22.13.1-x64-00250a7c/b3c2fab7 +0 -0
  9. package/.v8-cache/v22.13.1-x64-00250a7c/c314aece +0 -0
  10. package/.v8-cache/v22.13.1-x64-00250a7c/cfc49f4f +0 -0
  11. package/.v8-cache/v22.13.1-x64-00250a7c/e03e2acd +0 -0
  12. package/CHANGELOG.md +7 -0
  13. package/{TODO → TODO.md} +46 -0
  14. package/accept.js +18 -1
  15. package/dist/additionalInfo.js +62 -63
  16. package/dist/additionalInfo.js.map +1 -1
  17. package/dist/bundle.js +246 -186
  18. package/dist/descriptor.d.ts +4 -3
  19. package/dist/descriptor.js +9 -5
  20. package/dist/descriptor.js.map +1 -1
  21. package/dist/helpers.d.ts +1 -0
  22. package/dist/helpers.js.map +1 -1
  23. package/dist/imageResources.js +39 -5
  24. package/dist/imageResources.js.map +1 -1
  25. package/dist/psd.d.ts +12 -1
  26. package/dist/psd.js.map +1 -1
  27. package/dist/psdReader.js +39 -36
  28. package/dist/psdReader.js.map +1 -1
  29. package/dist/psdWriter.js +96 -76
  30. package/dist/psdWriter.js.map +1 -1
  31. package/dist-es/additionalInfo.js +62 -63
  32. package/dist-es/additionalInfo.js.map +1 -1
  33. package/dist-es/descriptor.d.ts +4 -3
  34. package/dist-es/descriptor.js +9 -5
  35. package/dist-es/descriptor.js.map +1 -1
  36. package/dist-es/helpers.d.ts +1 -0
  37. package/dist-es/helpers.js.map +1 -1
  38. package/dist-es/imageResources.js +41 -7
  39. package/dist-es/imageResources.js.map +1 -1
  40. package/dist-es/psd.d.ts +12 -1
  41. package/dist-es/psd.js.map +1 -1
  42. package/dist-es/psdReader.js +39 -36
  43. package/dist-es/psdReader.js.map +1 -1
  44. package/dist-es/psdWriter.js +96 -76
  45. package/dist-es/psdWriter.js.map +1 -1
  46. package/package.json +1 -1
  47. package/src/additionalInfo.ts +66 -66
  48. package/src/descriptor.ts +12 -8
  49. package/src/helpers.ts +1 -0
  50. package/src/imageResources.ts +46 -20
  51. package/src/psd.ts +9 -1
  52. package/src/psdReader.ts +43 -40
  53. package/src/psdWriter.ts +92 -78
@@ -273,6 +273,13 @@ addHandler('vmsk', hasKey('vectorMask'), function (reader, target, left, _a) {
273
273
  });
274
274
  // TODO: need to write vmsk if has outline ?
275
275
  addHandlerAlias('vsms', 'vmsk');
276
+ // addHandlerAlias('vmsk', 'vsms');
277
+ addHandler('vowv', // something with vectors?
278
+ hasKey('vowv'), function (reader, target) {
279
+ target.vowv = readUint32(reader); // always 2 ????
280
+ }, function (writer, target) {
281
+ writeUint32(writer, target.vowv);
282
+ });
276
283
  addHandler('vogk', hasKey('vectorOrigination'), function (reader, target, left) {
277
284
  if (readInt32(reader) !== 1)
278
285
  throw new Error("Invalid vogk version");
@@ -327,58 +334,55 @@ addHandler('vogk', hasKey('vectorOrigination'), function (reader, target, left)
327
334
  var desc = { keyDescriptorList: [] };
328
335
  for (var i = 0; i < orig.keyDescriptorList.length; i++) {
329
336
  var item = orig.keyDescriptorList[i];
330
- if (item.keyShapeInvalidated) {
331
- desc.keyDescriptorList.push({ keyShapeInvalidated: true, keyOriginIndex: i });
337
+ desc.keyDescriptorList.push({}); // we're adding keyOriginIndex at the end
338
+ var out = desc.keyDescriptorList[desc.keyDescriptorList.length - 1];
339
+ if (item.keyOriginType != null)
340
+ out.keyOriginType = item.keyOriginType;
341
+ if (item.keyOriginResolution != null)
342
+ out.keyOriginResolution = item.keyOriginResolution;
343
+ var radii = item.keyOriginRRectRadii;
344
+ if (radii) {
345
+ out.keyOriginRRectRadii = {
346
+ unitValueQuadVersion: 1,
347
+ topRight: unitsValue(radii.topRight, 'topRight'),
348
+ topLeft: unitsValue(radii.topLeft, 'topLeft'),
349
+ bottomLeft: unitsValue(radii.bottomLeft, 'bottomLeft'),
350
+ bottomRight: unitsValue(radii.bottomRight, 'bottomRight'),
351
+ };
332
352
  }
333
- else {
334
- desc.keyDescriptorList.push({}); // we're adding keyOriginIndex at the end
335
- var out = desc.keyDescriptorList[desc.keyDescriptorList.length - 1];
336
- if (item.keyOriginType != null)
337
- out.keyOriginType = item.keyOriginType;
338
- if (item.keyOriginResolution != null)
339
- out.keyOriginResolution = item.keyOriginResolution;
340
- var radii = item.keyOriginRRectRadii;
341
- if (radii) {
342
- out.keyOriginRRectRadii = {
343
- unitValueQuadVersion: 1,
344
- topRight: unitsValue(radii.topRight, 'topRight'),
345
- topLeft: unitsValue(radii.topLeft, 'topLeft'),
346
- bottomLeft: unitsValue(radii.bottomLeft, 'bottomLeft'),
347
- bottomRight: unitsValue(radii.bottomRight, 'bottomRight'),
348
- };
349
- }
350
- var box = item.keyOriginShapeBoundingBox;
351
- if (box) {
352
- out.keyOriginShapeBBox = {
353
- unitValueQuadVersion: 1,
354
- 'Top ': unitsValue(box.top, 'top'),
355
- Left: unitsValue(box.left, 'left'),
356
- Btom: unitsValue(box.bottom, 'bottom'),
357
- Rght: unitsValue(box.right, 'right'),
358
- };
359
- }
360
- var corners = item.keyOriginBoxCorners;
361
- if (corners && corners.length === 4) {
362
- out.keyOriginBoxCorners = {
363
- rectangleCornerA: { Hrzn: corners[0].x, Vrtc: corners[0].y },
364
- rectangleCornerB: { Hrzn: corners[1].x, Vrtc: corners[1].y },
365
- rectangleCornerC: { Hrzn: corners[2].x, Vrtc: corners[2].y },
366
- rectangleCornerD: { Hrzn: corners[3].x, Vrtc: corners[3].y },
367
- };
368
- }
369
- var transform = item.transform;
370
- if (transform && transform.length === 6) {
371
- out.Trnf = {
372
- xx: transform[0],
373
- xy: transform[1],
374
- yx: transform[2],
375
- yy: transform[3],
376
- tx: transform[4],
377
- ty: transform[5],
378
- };
379
- }
380
- out.keyOriginIndex = i;
353
+ var box = item.keyOriginShapeBoundingBox;
354
+ if (box) {
355
+ out.keyOriginShapeBBox = {
356
+ unitValueQuadVersion: 1,
357
+ 'Top ': unitsValue(box.top, 'top'),
358
+ Left: unitsValue(box.left, 'left'),
359
+ Btom: unitsValue(box.bottom, 'bottom'),
360
+ Rght: unitsValue(box.right, 'right'),
361
+ };
362
+ }
363
+ var corners = item.keyOriginBoxCorners;
364
+ if (corners && corners.length === 4) {
365
+ out.keyOriginBoxCorners = {
366
+ rectangleCornerA: { Hrzn: corners[0].x, Vrtc: corners[0].y },
367
+ rectangleCornerB: { Hrzn: corners[1].x, Vrtc: corners[1].y },
368
+ rectangleCornerC: { Hrzn: corners[2].x, Vrtc: corners[2].y },
369
+ rectangleCornerD: { Hrzn: corners[3].x, Vrtc: corners[3].y },
370
+ };
371
+ }
372
+ var transform = item.transform;
373
+ if (transform && transform.length === 6) {
374
+ out.Trnf = {
375
+ xx: transform[0],
376
+ xy: transform[1],
377
+ yx: transform[2],
378
+ yy: transform[3],
379
+ tx: transform[4],
380
+ ty: transform[5],
381
+ };
381
382
  }
383
+ if (item.keyShapeInvalidated != null)
384
+ out.keyShapeInvalidated = item.keyShapeInvalidated;
385
+ out.keyOriginIndex = i;
382
386
  }
383
387
  writeInt32(writer, 1); // version
384
388
  writeVersionAndDescriptor(writer, '', 'null', desc);
@@ -850,7 +854,13 @@ function isQuiltWarp(warp) {
850
854
  }
851
855
  function encodeWarp(warp) {
852
856
  var bounds = warp.bounds;
853
- var desc = __assign(__assign({ warpStyle: warpStyle.encode(warp.style) }, (warp.values ? { warpValues: warp.values } : { warpValue: warp.value || 0 })), { warpPerspective: warp.perspective || 0, warpPerspectiveOther: warp.perspectiveOther || 0, warpRotate: Ornt.encode(warp.rotate), bounds: {
857
+ var desc = __assign(__assign({ warpStyle: warpStyle.encode(warp.style) }, (warp.values ? { warpValues: warp.values } : { warpValue: warp.value || 0 })), { warpPerspective: warp.perspective || 0, warpPerspectiveOther: warp.perspectiveOther || 0, warpRotate: Ornt.encode(warp.rotate), bounds: /*1 ? { // testing
858
+ _classID: 'classFloatRect',
859
+ 'Top ': bounds && bounds.top && bounds.top.value || 0,
860
+ Left: bounds && bounds.left && bounds.left.value || 0,
861
+ Btom: bounds && bounds.bottom && bounds.bottom.value || 0,
862
+ Rght: bounds && bounds.right && bounds.right.value || 0,
863
+ } :*/ {
854
864
  'Top ': unitsValue(bounds && bounds.top || { units: 'Pixels', value: 0 }, 'bounds.top'),
855
865
  Left: unitsValue(bounds && bounds.left || { units: 'Pixels', value: 0 }, 'bounds.left'),
856
866
  Btom: unitsValue(bounds && bounds.bottom || { units: 'Pixels', value: 0 }, 'bounds.bottom'),
@@ -1415,6 +1425,7 @@ function serializeFilterFXItem(f) {
1415
1425
  'Rds ': uvRadius(f.filter),
1416
1426
  }, filterID: 697 });
1417
1427
  case 'gaussian blur': return __assign(__assign({}, base), { Fltr: {
1428
+ // _name: '高斯模糊', // Testing
1418
1429
  _name: 'Gaussian Blur',
1419
1430
  _classID: 'GsnB',
1420
1431
  'Rds ': uvRadius(f.filter),
@@ -2027,18 +2038,6 @@ addHandler('LMsk', hasKey('userMask'), function (reader, target) {
2027
2038
  writeUint8(writer, 128);
2028
2039
  writeZeros(writer, 1);
2029
2040
  });
2030
- if (MOCK_HANDLERS) {
2031
- addHandler('vowv', // appears with Lr16 section ?
2032
- function (// appears with Lr16 section ?
2033
- _) { return false; }, function (reader, target, left) {
2034
- var value = readUint32(reader); // always 2 ????
2035
- reader;
2036
- target;
2037
- console.log('vowv', { value: value }, left());
2038
- }, function (_writer, _target) {
2039
- // TODO: write
2040
- });
2041
- }
2042
2041
  if (MOCK_HANDLERS) {
2043
2042
  addHandler('Patt', function (target) { return target._Patt !== undefined; }, function (reader, target, left) {
2044
2043
  // console.log('additional info: Patt');