ag-psd 28.1.1 → 28.2.1

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/dist/psd.d.ts CHANGED
@@ -1147,7 +1147,7 @@ type FilterVariant = {
1147
1147
  type: 'curves';
1148
1148
  filter: {
1149
1149
  presetKind: 'custom' | 'default';
1150
- adjustments: ({
1150
+ adjustments?: ({
1151
1151
  channels: ('composite' | 'red' | 'green' | 'blue')[];
1152
1152
  curve: {
1153
1153
  x: number;
@@ -1159,6 +1159,15 @@ type FilterVariant = {
1159
1159
  values: number[];
1160
1160
  })[];
1161
1161
  };
1162
+ } | {
1163
+ type: 'invert';
1164
+ } | {
1165
+ type: 'brightness/contrast';
1166
+ filter: {
1167
+ brightness: number;
1168
+ contrast: number;
1169
+ useLegacy: boolean;
1170
+ };
1162
1171
  };
1163
1172
  export type Filter = FilterVariant & {
1164
1173
  name: string;
package/dist/psd.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"psd.js","sourceRoot":"../src/","sources":["psd.ts"],"names":[],"mappings":";;;AAMA,IAAkB,SASjB;AATD,WAAkB,SAAS;IAC1B,6CAAU,CAAA;IACV,mDAAa,CAAA;IACb,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,yCAAQ,CAAA;IACR,yDAAgB,CAAA;IAChB,+CAAW,CAAA;IACX,uCAAO,CAAA;AACR,CAAC,EATiB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAS1B;AAED,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IACnC,6DAAS,CAAA;IACT,uEAAc,CAAA;IACd,2EAAgB,CAAA;IAChB,+FAA0B,CAAA;AAC3B,CAAC,EALiB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAKnC;AAy7CD,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAChC,iEAAQ,CAAA;IACR,6EAAc,CAAA;IACd,yEAAY,CAAA;IACZ,6EAAc,CAAA;AACf,CAAC,EALW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAKhC"}
1
+ {"version":3,"file":"psd.js","sourceRoot":"../src/","sources":["psd.ts"],"names":[],"mappings":";;;AAMA,IAAkB,SASjB;AATD,WAAkB,SAAS;IAC1B,6CAAU,CAAA;IACV,mDAAa,CAAA;IACb,+CAAW,CAAA;IACX,uCAAO,CAAA;IACP,yCAAQ,CAAA;IACR,yDAAgB,CAAA;IAChB,+CAAW,CAAA;IACX,uCAAO,CAAA;AACR,CAAC,EATiB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAS1B;AAED,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IACnC,6DAAS,CAAA;IACT,uEAAc,CAAA;IACd,2EAAgB,CAAA;IAChB,+FAA0B,CAAA;AAC3B,CAAC,EALiB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAKnC;AAk8CD,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAChC,iEAAQ,CAAA;IACR,6EAAc,CAAA;IACd,yEAAY,CAAA;IACZ,6EAAc,CAAA;AACf,CAAC,EALW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAKhC"}
@@ -1106,7 +1106,7 @@ function parseFilterFXItem(f, options) {
1106
1106
  removeJpegArtifact: f.Fltr.removeJPEGArtifact,
1107
1107
  reduceColorNoise: parsePercent(f.Fltr.ClNs),
1108
1108
  sharpenDetails: parsePercent(f.Fltr.Shrp),
1109
- channelDenoise: f.Fltr.channelDenoise.map(function (c) { return (__assign({ channels: c.Chnl.map(function (i) { return Chnl.decode(i); }), amount: c.Amnt }, (c.EdgF ? { preserveDetails: c.EdgF } : {}))); }),
1109
+ channelDenoise: f.Fltr.channelDenoise.map(function (c) { return (__assign({ channels: c.Chnl.map(Chnl.decode), amount: c.Amnt }, (c.EdgF ? { preserveDetails: c.EdgF } : {}))); }),
1110
1110
  } });
1111
1111
  case 'ClrH': return __assign(__assign({}, base), { type: 'color halftone', filter: {
1112
1112
  radius: f.Fltr['Rds '],
@@ -1333,10 +1333,9 @@ function parseFilterFXItem(f, options) {
1333
1333
  ;
1334
1334
  case 'Crvs':
1335
1335
  {
1336
- return __assign(__assign({}, base), { type: 'curves', filter: {
1337
- presetKind: presetKindType.decode(f.Fltr.presetKind),
1336
+ return __assign(__assign({}, base), { type: 'curves', filter: __assign({ presetKind: presetKindType.decode(f.Fltr.presetKind) }, (f.Fltr.Adjs ? {
1338
1337
  adjustments: f.Fltr.Adjs.map(function (a) {
1339
- var channels = a.Chnl.map(function (c) { return Chnl.decode(c); });
1338
+ var channels = a.Chnl.map(Chnl.decode);
1340
1339
  if (a['Crv ']) {
1341
1340
  return {
1342
1341
  channels: channels,
@@ -1354,12 +1353,22 @@ function parseFilterFXItem(f, options) {
1354
1353
  else {
1355
1354
  throw new Error("Unknown curve adjustment");
1356
1355
  }
1357
- }),
1356
+ })
1357
+ } : {})) });
1358
+ }
1359
+ ;
1360
+ case 'BrgC':
1361
+ {
1362
+ return __assign(__assign({}, base), { type: 'brightness/contrast', filter: {
1363
+ brightness: f.Fltr.Brgh,
1364
+ contrast: f.Fltr.Cntr,
1365
+ useLegacy: !!f.Fltr.useLegacy,
1358
1366
  } });
1359
1367
  }
1360
1368
  ;
1361
1369
  default:
1362
1370
  if (options.throwForMissingFeatures) {
1371
+ console.log('FILTER', require('util').inspect(f, false, 99, true));
1363
1372
  throw new Error("Unknown filter classId: ".concat(f.Fltr._classID));
1364
1373
  }
1365
1374
  return undefined;
@@ -1379,9 +1388,10 @@ function parseFilterFXItem(f, options) {
1379
1388
  case 1181639749: return __assign(__assign({}, base), { type: 'find edges' });
1380
1389
  case 1399616122: return __assign(__assign({}, base), { type: 'solarize' });
1381
1390
  case 1314149187: return __assign(__assign({}, base), { type: 'ntsc colors' });
1391
+ case 1231976050: return __assign(__assign({}, base), { type: 'invert' });
1382
1392
  default:
1383
1393
  if (options.throwForMissingFeatures) {
1384
- // console.log('FILTER', require('util').inspect(f, false, 99, true));
1394
+ console.log('FILTER', require('util').inspect(f, false, 99, true));
1385
1395
  throw new Error("Unknown filterID: ".concat(f.filterID));
1386
1396
  }
1387
1397
  }
@@ -1717,6 +1727,7 @@ function serializeFilterFXItem(f) {
1717
1727
  IntC: IntC.encode(f.filter.newFieldsBy),
1718
1728
  }, filterID: 1148089458 });
1719
1729
  case 'ntsc colors': return __assign(__assign({}, base), { filterID: 1314149187 });
1730
+ case 'invert': return __assign(__assign({}, base), { filterID: 1231976050 });
1720
1731
  case 'custom': return __assign(__assign({}, base), { Fltr: {
1721
1732
  _name: 'Custom',
1722
1733
  _classID: 'Cstm',
@@ -1838,22 +1849,26 @@ function serializeFilterFXItem(f) {
1838
1849
  warpedVertices: f.filter.warpedVertices.map(pointToHrznVrtc),
1839
1850
  quads: f.filter.quads.map(function (indices) { return ({ indices: indices }); }),
1840
1851
  }, filterID: 442 });
1841
- case 'curves': return __assign(__assign({}, base), { Fltr: {
1842
- _name: 'Curves',
1843
- _classID: 'Crvs',
1844
- presetKind: presetKindType.encode(f.filter.presetKind),
1852
+ case 'curves': return __assign(__assign({}, base), { Fltr: __assign({ _name: 'Curves', _classID: 'Crvs', presetKind: presetKindType.encode(f.filter.presetKind) }, (f.filter.adjustments ? {
1845
1853
  Adjs: f.filter.adjustments.map(function (a) { return 'curve' in a ? {
1846
1854
  _name: '',
1847
1855
  _classID: 'CrvA',
1848
- Chnl: a.channels.map(function (c) { return Chnl.encode(c); }),
1856
+ Chnl: a.channels.map(Chnl.encode),
1849
1857
  'Crv ': a.curve.map(function (c) { return (__assign({ _name: '', _classID: 'Pnt ', Hrzn: c.x, Vrtc: c.y }, (c.curved ? { Cnty: true } : {}))); }),
1850
1858
  } : {
1851
1859
  _name: '',
1852
1860
  _classID: 'CrvA',
1853
- Chnl: a.channels.map(function (c) { return Chnl.encode(c); }),
1861
+ Chnl: a.channels.map(Chnl.encode),
1854
1862
  Mpng: a.values,
1855
- }; }),
1856
- }, filterID: 1131574899 });
1863
+ }; })
1864
+ } : {})), filterID: 1131574899 });
1865
+ case 'brightness/contrast': return __assign(__assign({}, base), { Fltr: {
1866
+ _name: 'Brightness/Contrast',
1867
+ _classID: 'BrgC',
1868
+ Brgh: f.filter.brightness,
1869
+ Cntr: f.filter.contrast,
1870
+ useLegacy: !!f.filter.useLegacy,
1871
+ }, filterID: 1114793795 });
1857
1872
  // case 'hsb/hsl': return {
1858
1873
  // TODO: ...
1859
1874
  // };