@pixerate/editor 0.210.0 → 0.211.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/dist/{chunk-QE7D7TZR.cjs → chunk-H65IBXFI.cjs} +74 -25
- package/dist/{chunk-KFIOEOCQ.js → chunk-W3TOZTL7.js} +55 -6
- package/dist/image-editor/controller.d.cts +51 -0
- package/dist/image-editor/controller.d.ts +51 -0
- package/dist/image-editor/index.cjs +1464 -1005
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +473 -14
- package/dist/image-editor/layers/serialize.d.cts +5 -8
- package/dist/image-editor/layers/serialize.d.ts +5 -8
- package/dist/image-editor/paths.d.cts +41 -0
- package/dist/image-editor/paths.d.ts +41 -0
- package/dist/image-editor/psd/export.d.cts +8 -1
- package/dist/image-editor/psd/export.d.ts +8 -1
- package/dist/image-editor/psd/import.d.cts +7 -0
- package/dist/image-editor/psd/import.d.ts +7 -0
- package/dist/image-editor/psd/paths.d.cts +11 -0
- package/dist/image-editor/psd/paths.d.ts +11 -0
- package/dist/image-editor/selection/gesture.d.cts +10 -2
- package/dist/image-editor/selection/gesture.d.ts +10 -2
- package/dist/image-editor/selection/select-and-mask.d.cts +5 -0
- package/dist/image-editor/selection/select-and-mask.d.ts +5 -0
- package/dist/image-editor/types.d.cts +12 -0
- package/dist/image-editor/types.d.ts +12 -0
- package/dist/paint-editor/index.cjs +6 -6
- package/dist/paint-editor/index.js +1 -1
- package/package.json +1 -1
|
@@ -5168,9 +5168,9 @@ function serializeVectorMask(vm) {
|
|
|
5168
5168
|
if (vm.feather) out.feather = vm.feather;
|
|
5169
5169
|
return out;
|
|
5170
5170
|
}
|
|
5171
|
-
function
|
|
5172
|
-
if (!Array.isArray(
|
|
5173
|
-
|
|
5171
|
+
function readShapeComponents(stored) {
|
|
5172
|
+
if (!Array.isArray(stored)) throw new Error("its components are missing");
|
|
5173
|
+
return stored.map((raw, i) => {
|
|
5174
5174
|
const c = raw;
|
|
5175
5175
|
const op = requireOperation(_optionalChain([c, 'optionalAccess', _133 => _133.op]), `components[${i}].op`);
|
|
5176
5176
|
if (_optionalChain([c, 'optionalAccess', _134 => _134.live])) {
|
|
@@ -5179,7 +5179,9 @@ function readVectorMask(r) {
|
|
|
5179
5179
|
}
|
|
5180
5180
|
return { op, subpaths: Array.isArray(_optionalChain([c, 'optionalAccess', _135 => _135.subpaths])) && !c.subpaths.length ? [] : normalizeSubpaths(_optionalChain([c, 'optionalAccess', _136 => _136.subpaths]), `components[${i}].subpaths`) };
|
|
5181
5181
|
});
|
|
5182
|
-
|
|
5182
|
+
}
|
|
5183
|
+
function readVectorMask(r) {
|
|
5184
|
+
const vm = { components: readShapeComponents(r.components) };
|
|
5183
5185
|
if (r.fillRule === "evenodd") vm.fillRule = "evenodd";
|
|
5184
5186
|
if (r.inverted === true) vm.inverted = true;
|
|
5185
5187
|
if (r.enabled === false) vm.enabled = false;
|
|
@@ -6957,6 +6959,19 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
6957
6959
|
});
|
|
6958
6960
|
return writeVectorBlock({ subpaths, initialFill: subpaths.length === 0 && inverted }, flags & ~VMSK_INVERT | (inverted && subpaths.length ? VMSK_INVERT : 0));
|
|
6959
6961
|
}
|
|
6962
|
+
var RESOURCE_WORK_PATH = 1025;
|
|
6963
|
+
var RESOURCE_PATH_FIRST = 2e3;
|
|
6964
|
+
var RESOURCE_PATH_LAST = 2997;
|
|
6965
|
+
function componentsFromPathResource(data, width, height) {
|
|
6966
|
+
const block = new Uint8Array(8 + data.length);
|
|
6967
|
+
new DataView(block.buffer).setUint32(0, 3);
|
|
6968
|
+
block.set(data, 8);
|
|
6969
|
+
const read2 = componentsFromVectorBlock(block, width, height);
|
|
6970
|
+
return read2 ? { components: read2.components, inverted: read2.inverted } : null;
|
|
6971
|
+
}
|
|
6972
|
+
function pathResourceForComponents(components, width, height) {
|
|
6973
|
+
return vectorBlockForComponents(components, false, width, height).slice(8);
|
|
6974
|
+
}
|
|
6960
6975
|
|
|
6961
6976
|
// src/image-editor/psd/channels.ts
|
|
6962
6977
|
var hexToRgb2 = (hex) => {
|
|
@@ -8986,12 +9001,14 @@ function writeBlocks(w, blocks, psb, alignment) {
|
|
|
8986
9001
|
function writeMask(w, m) {
|
|
8987
9002
|
writeRect(w, m.rect);
|
|
8988
9003
|
w.u8(m.defaultColor);
|
|
8989
|
-
const pf = (m.userDensity !== void 0 ? 1 : 0) | (m.userFeather !== void 0 ? 2 : 0);
|
|
9004
|
+
const pf = (m.userDensity !== void 0 ? 1 : 0) | (m.userFeather !== void 0 ? 2 : 0) | (m.vectorDensity !== void 0 ? 4 : 0) | (m.vectorFeather !== void 0 ? 8 : 0);
|
|
8990
9005
|
w.u8(pf ? m.flags | MASK_FLAG_PARAMETERS : m.flags & ~MASK_FLAG_PARAMETERS);
|
|
8991
9006
|
if (pf) {
|
|
8992
9007
|
w.u8(pf);
|
|
8993
9008
|
if (m.userDensity !== void 0) w.u8(m.userDensity);
|
|
8994
9009
|
if (m.userFeather !== void 0) w.f64(m.userFeather);
|
|
9010
|
+
if (m.vectorDensity !== void 0) w.u8(m.vectorDensity);
|
|
9011
|
+
if (m.vectorFeather !== void 0) w.f64(m.vectorFeather);
|
|
8995
9012
|
}
|
|
8996
9013
|
const len = 18 + (pf ? 1 + maskParameterBytes(pf) : 0);
|
|
8997
9014
|
w.zeros(Math.max(0, 20 - len) + (4 - Math.max(20, len) % 4) % 4);
|
|
@@ -10179,6 +10196,16 @@ function psdToLayers(file, options = {}) {
|
|
|
10179
10196
|
warn.extra.push(`The alpha channels could not be read (${e instanceof Error ? e.message : String(e)}).`);
|
|
10180
10197
|
}
|
|
10181
10198
|
}
|
|
10199
|
+
const paths = [];
|
|
10200
|
+
for (const r of file.resources) {
|
|
10201
|
+
const saved = r.id >= RESOURCE_PATH_FIRST && r.id <= RESOURCE_PATH_LAST;
|
|
10202
|
+
if (!saved && r.id !== RESOURCE_WORK_PATH) continue;
|
|
10203
|
+
const read2 = componentsFromPathResource(r.data, header.width, header.height);
|
|
10204
|
+
if (!_optionalChain([read2, 'optionalAccess', _272 => _272.components, 'access', _273 => _273.length])) continue;
|
|
10205
|
+
if (read2.inverted) warn.extra.push(`The path "${r.name || "Work Path"}" starts by subtracting, which Pixerate's paths do not keep; it came in without that.`);
|
|
10206
|
+
paths.push(saved ? { name: r.name || `Path ${paths.length + 1}`, components: read2.components } : { name: "Work Path", components: read2.components, work: true });
|
|
10207
|
+
}
|
|
10208
|
+
paths.sort((a, b) => Number(Boolean(a.work)) - Number(Boolean(b.work)));
|
|
10182
10209
|
const i32 = (b) => b && b.length >= 4 ? new DataView(b.buffer, b.byteOffset, 4).getInt32(0) : void 0;
|
|
10183
10210
|
const angle = i32(resource(file, 1037));
|
|
10184
10211
|
const altitude = i32(resource(file, 1049));
|
|
@@ -10193,6 +10220,7 @@ function psdToLayers(file, options = {}) {
|
|
|
10193
10220
|
...angle !== void 0 || altitude !== void 0 ? { globalLight: { angle: Math.max(-360, Math.min(360, _nullishCoalesce(angle, () => ( 120)))), altitude: Math.max(0, Math.min(90, _nullishCoalesce(altitude, () => ( 30)))) } } : {},
|
|
10194
10221
|
info: { psb: header.psb, depth: header.depth, colorMode: mode, channels: header.channels },
|
|
10195
10222
|
...alphaChannels.length ? { alphaChannels } : {},
|
|
10223
|
+
...paths.length ? { paths } : {},
|
|
10196
10224
|
...cmykProfile ? { sourceMode: { mode: "cmyk", profile: cmykProfile } } : header.colorMode === MODE_LAB ? { sourceMode: { mode: "lab" } } : {},
|
|
10197
10225
|
...resource(file, 1039) ? { iccProfile: resource(file, 1039).slice() } : {},
|
|
10198
10226
|
bitDepth: (header.depth === 16 || header.depth === 32) && header.colorMode !== MODE_INDEXED && header.colorMode !== MODE_BITMAP ? header.depth : 8
|
|
@@ -10263,15 +10291,15 @@ var pct = (d, key, fallback) => num3(d, key, fallback * 100) / 100;
|
|
|
10263
10291
|
var bool = (d, key) => descBool(d, key) === true;
|
|
10264
10292
|
var enumOf3 = (d, key) => {
|
|
10265
10293
|
const v = descGet(d, key);
|
|
10266
|
-
return _optionalChain([v, 'optionalAccess',
|
|
10294
|
+
return _optionalChain([v, 'optionalAccess', _274 => _274.type]) === "enum" ? v.value : void 0;
|
|
10267
10295
|
};
|
|
10268
10296
|
var text2 = (d, key) => {
|
|
10269
10297
|
const v = d ? descGet(d, key) : void 0;
|
|
10270
|
-
return _optionalChain([v, 'optionalAccess',
|
|
10298
|
+
return _optionalChain([v, 'optionalAccess', _275 => _275.type]) === "TEXT" ? v.value : "";
|
|
10271
10299
|
};
|
|
10272
10300
|
var list = (d, key) => {
|
|
10273
10301
|
const v = descGet(d, key);
|
|
10274
|
-
if (_optionalChain([v, 'optionalAccess',
|
|
10302
|
+
if (_optionalChain([v, 'optionalAccess', _276 => _276.type]) !== "VlLs") return [];
|
|
10275
10303
|
return v.items.flatMap((it) => it.type === "Objc" || it.type === "GlbO" ? [it.value] : []);
|
|
10276
10304
|
};
|
|
10277
10305
|
var clamp3 = (v, lo, hi) => Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : lo;
|
|
@@ -10341,8 +10369,8 @@ function contourOf(d, key) {
|
|
|
10341
10369
|
return { name, points };
|
|
10342
10370
|
}
|
|
10343
10371
|
function contourDesc(c) {
|
|
10344
|
-
const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
10345
|
-
const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
10372
|
+
const name = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _277 => _277.name]), () => ( "Linear"));
|
|
10373
|
+
const points = _nullishCoalesce(_optionalChain([c, 'optionalAccess', _278 => _278.points]), () => ( [
|
|
10346
10374
|
{ input: 0, output: 0 },
|
|
10347
10375
|
{ input: 1, output: 1 }
|
|
10348
10376
|
]));
|
|
@@ -10377,7 +10405,7 @@ function gradientOf(d, notes) {
|
|
|
10377
10405
|
{ position: 0, color: "#000000" },
|
|
10378
10406
|
{ position: 1, color: "#ffffff" }
|
|
10379
10407
|
],
|
|
10380
|
-
style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access',
|
|
10408
|
+
style: _nullishCoalesce(_optionalChain([GRADIENT_STYLES, 'access', _279 => _279.find, 'call', _280 => _280(([, id]) => id === enumOf3(d, "Type")), 'optionalAccess', _281 => _281[0]]), () => ( "linear")),
|
|
10381
10409
|
angle: clamp3(num3(d, "Angl", 90), -360, 360),
|
|
10382
10410
|
scale: clamp3(pct(d, "Scl ", 1), 0.1, 1.5),
|
|
10383
10411
|
reverse: bool(d, "Rvrs"),
|
|
@@ -10431,7 +10459,7 @@ function gradientItems(g) {
|
|
|
10431
10459
|
)
|
|
10432
10460
|
)
|
|
10433
10461
|
};
|
|
10434
|
-
const op = _optionalChain([g, 'access',
|
|
10462
|
+
const op = _optionalChain([g, 'access', _282 => _282.opacityStops, 'optionalAccess', _283 => _283.length]) ? g.opacityStops : g.stops.map((s) => ({ position: s.position, opacity: 1 }));
|
|
10435
10463
|
const trns = {
|
|
10436
10464
|
type: "VlLs",
|
|
10437
10465
|
items: op.map(
|
|
@@ -10928,9 +10956,9 @@ function prepareNestedLayers(layers) {
|
|
|
10928
10956
|
if (l.type === "annotation") continue;
|
|
10929
10957
|
let next = l;
|
|
10930
10958
|
if (l.type === "group") next = { ...l, children: prepareNestedLayers(l.children) };
|
|
10931
|
-
else if (l.type === "pixel" && (_optionalChain([l, 'access',
|
|
10959
|
+
else if (l.type === "pixel" && (_optionalChain([l, 'access', _284 => _284.filters, 'optionalAccess', _285 => _285.length]) || l.source === "document")) {
|
|
10932
10960
|
const p = { ...l };
|
|
10933
|
-
if (_optionalChain([l, 'access',
|
|
10961
|
+
if (_optionalChain([l, 'access', _286 => _286.filters, 'optionalAccess', _287 => _287.some, 'call', _288 => _288(isActiveFilter)])) {
|
|
10934
10962
|
const b = l.surface.bounds;
|
|
10935
10963
|
if (b) {
|
|
10936
10964
|
const r = { x: b.x + l.offset.x - 64, y: b.y + l.offset.y - 64, width: b.width + 128, height: b.height + 128 };
|
|
@@ -10947,7 +10975,7 @@ function prepareNestedLayers(layers) {
|
|
|
10947
10975
|
delete p.source;
|
|
10948
10976
|
next = p;
|
|
10949
10977
|
}
|
|
10950
|
-
if (_optionalChain([next, 'access',
|
|
10978
|
+
if (_optionalChain([next, 'access', _289 => _289.mask, 'optionalAccess', _290 => _290.source])) {
|
|
10951
10979
|
next = { ...next };
|
|
10952
10980
|
delete next.mask;
|
|
10953
10981
|
}
|
|
@@ -11022,6 +11050,7 @@ function exportPsd(input) {
|
|
|
11022
11050
|
};
|
|
11023
11051
|
const psb = width > PSD_MAX_DIMENSION || height > PSD_MAX_DIMENSION;
|
|
11024
11052
|
const records = [];
|
|
11053
|
+
const vectorParams = /* @__PURE__ */ new WeakMap();
|
|
11025
11054
|
let nextId = 0;
|
|
11026
11055
|
const notes = /* @__PURE__ */ new Map();
|
|
11027
11056
|
const note = (msg, name) => notes.set(msg, [..._nullishCoalesce(notes.get(msg), () => ( [])), name]);
|
|
@@ -11054,13 +11083,16 @@ function exportPsd(input) {
|
|
|
11054
11083
|
if (vm) {
|
|
11055
11084
|
const flags = (vm.linked === false ? VMSK_NOT_LINKED : 0) | (vm.enabled === false ? VMSK_DISABLED : 0);
|
|
11056
11085
|
blocks.push({ key: "vmsk", data: vectorBlockForComponents(vm.components, vm.inverted === true, width, height, flags) });
|
|
11057
|
-
|
|
11086
|
+
const params = {};
|
|
11087
|
+
if ((_nullishCoalesce(vm.density, () => ( 1))) < 1) params.density = Math.round(Math.max(0, _nullishCoalesce(vm.density, () => ( 1))) * 255);
|
|
11088
|
+
if ((_nullishCoalesce(vm.feather, () => ( 0))) > 0) params.feather = vm.feather;
|
|
11089
|
+
if (params.density !== void 0 || params.feather !== void 0) vectorParams.set(blocks, params);
|
|
11058
11090
|
if (vm.fillRule === "evenodd") note("Vector masks are written with the nonzero fill rule (Photoshop has no even-odd paths)", layer.name);
|
|
11059
11091
|
}
|
|
11060
11092
|
return {
|
|
11061
11093
|
opacity: Math.round(Math.min(1, Math.max(0, layer.opacity)) * 255),
|
|
11062
11094
|
clipping: layer.clipped ? 1 : 0,
|
|
11063
|
-
flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access',
|
|
11095
|
+
flags: (layer.visible ? 0 : LAYER_FLAG_HIDDEN) | (_optionalChain([layer, 'access', _291 => _291.locks, 'optionalAccess', _292 => _292.transparency]) ? LAYER_FLAG_TRANSPARENCY_PROTECTED : 0),
|
|
11064
11096
|
legacyName: name,
|
|
11065
11097
|
blocks
|
|
11066
11098
|
};
|
|
@@ -11117,7 +11149,7 @@ function exportPsd(input) {
|
|
|
11117
11149
|
}
|
|
11118
11150
|
case "pixel": {
|
|
11119
11151
|
if (layer.source === "document") throw new PsdError(`Layer "${layer.name}" reads the document image; resolve its pixels before export.`);
|
|
11120
|
-
if (_optionalChain([layer, 'access',
|
|
11152
|
+
if (_optionalChain([layer, 'access', _293 => _293.filters, 'optionalAccess', _294 => _294.some, 'call', _295 => _295(isActiveFilter)])) throw new PsdError(`Layer "${layer.name}" has live filters; bake them before export.`);
|
|
11121
11153
|
const extra = [];
|
|
11122
11154
|
if (layer.fillOpacity !== void 0 && layer.fillOpacity < 1) {
|
|
11123
11155
|
extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
|
|
@@ -11149,7 +11181,7 @@ function exportPsd(input) {
|
|
|
11149
11181
|
if (c.linked) note("Linked smart objects were embedded (their preview is written as the contents)", layer.name);
|
|
11150
11182
|
linkedFiles.set(idnt, smartContentsFile(c));
|
|
11151
11183
|
}
|
|
11152
|
-
let placedId = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
11184
|
+
let placedId = _nullishCoalesce(_optionalChain([layer, 'access', _296 => _296.psd, 'optionalAccess', _297 => _297.placed]), () => ( psdUuid(`${layer.id}:placed`)));
|
|
11153
11185
|
if (placedIds.has(placedId)) placedId = psdUuid(`${layer.id}:placed:${placedIds.size}`);
|
|
11154
11186
|
placedIds.add(placedId);
|
|
11155
11187
|
if (placedUnchanged(layer, idnt, placedId)) {
|
|
@@ -11159,12 +11191,12 @@ function exportPsd(input) {
|
|
|
11159
11191
|
const filterFX = layer.smartFilters ? filterFXDescriptor(layer.smartFilters, dropped) : void 0;
|
|
11160
11192
|
if (dropped.length) note("Develop smart filters have no Photoshop filter and were left out of the filter list (the layer\u2019s pixels still show them)", layer.name);
|
|
11161
11193
|
const raw = layer.psd && layer.psd.key !== "PlLd" ? parsePlaced(layer.psd.key, layer.psd.data) : null;
|
|
11162
|
-
const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess',
|
|
11194
|
+
const spec = { idnt, placed: placedId, placement: layer.placement, size: { width: c.width, height: c.height }, filterFX, template: _optionalChain([raw, 'optionalAccess', _298 => _298.descriptor]) };
|
|
11163
11195
|
const wnotes = [];
|
|
11164
11196
|
extra.push({ key: "PlLd", data: plldBytes(spec) }, { key: "SoLd", data: soldBytes(spec, wnotes) });
|
|
11165
11197
|
for (const n2 of wnotes) note(`A smart object: ${n2}`, layer.name);
|
|
11166
11198
|
}
|
|
11167
|
-
const fm = _optionalChain([layer, 'access',
|
|
11199
|
+
const fm = _optionalChain([layer, 'access', _299 => _299.smartFilters, 'optionalAccess', _300 => _300.mask]);
|
|
11168
11200
|
if (fm && !fm.source) filterItems.push(filterMaskItem(placedId, fm, { x: 0, y: 0, width, height }));
|
|
11169
11201
|
const rec = { ...common2(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
|
|
11170
11202
|
const bounds = _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface);
|
|
@@ -11192,8 +11224,8 @@ function exportPsd(input) {
|
|
|
11192
11224
|
const losses = /* @__PURE__ */ new Set();
|
|
11193
11225
|
for (const b of shapeBlocks(layer, width, height, _nullishCoalesce(input.resolution, () => ( 72)), losses)) extra.push({ key: b.key, data: padEven(b.data) });
|
|
11194
11226
|
for (const n2 of losses) note(n2, layer.name);
|
|
11195
|
-
if (_optionalChain([layer, 'access',
|
|
11196
|
-
if (_optionalChain([layer, 'access',
|
|
11227
|
+
if (_optionalChain([layer, 'access', _301 => _301.fill, 'optionalAccess', _302 => _302.type]) === "pattern") patternIds2.add(layer.fill.patternId);
|
|
11228
|
+
if (_optionalChain([layer, 'access', _303 => _303.stroke, 'optionalAccess', _304 => _304.paint, 'access', _305 => _305.type]) === "pattern") patternIds2.add(layer.stroke.paint.patternId);
|
|
11197
11229
|
} else {
|
|
11198
11230
|
extra.push({ key: "TySh", data: padEven(tyShForLayer(layer)) });
|
|
11199
11231
|
}
|
|
@@ -11261,8 +11293,17 @@ function exportPsd(input) {
|
|
|
11261
11293
|
{ id: 1005, name: "", data: rw.result() },
|
|
11262
11294
|
{ id: 1057, name: "", data: version.result() }
|
|
11263
11295
|
];
|
|
11264
|
-
if (_optionalChain([input, 'access',
|
|
11296
|
+
if (_optionalChain([input, 'access', _306 => _306.iccProfile, 'optionalAccess', _307 => _307.length])) resources.push({ id: 1039, name: "", data: input.iccProfile });
|
|
11265
11297
|
resources.push(...alphaChannelResources(_nullishCoalesce(input.alphaChannels, () => ( []))));
|
|
11298
|
+
let savedPathId = RESOURCE_PATH_FIRST;
|
|
11299
|
+
for (const p of _nullishCoalesce(input.paths, () => ( []))) {
|
|
11300
|
+
if (!p.work && savedPathId > RESOURCE_PATH_LAST) {
|
|
11301
|
+
note("Only 998 saved paths fit in a PSD file; the rest are not written", p.name);
|
|
11302
|
+
continue;
|
|
11303
|
+
}
|
|
11304
|
+
if (p.fillRule === "evenodd") note("Paths are written with the nonzero fill rule (Photoshop has no even-odd paths)", p.name);
|
|
11305
|
+
resources.push({ id: p.work ? RESOURCE_WORK_PATH : savedPathId++, name: p.work ? "" : p.name, data: pathResourceForComponents(p.components, width, height) });
|
|
11306
|
+
}
|
|
11266
11307
|
if (input.globalLight) {
|
|
11267
11308
|
const i32 = (v) => {
|
|
11268
11309
|
const w = new PsdWriter();
|
|
@@ -11293,6 +11334,13 @@ function exportPsd(input) {
|
|
|
11293
11334
|
globalBlocks.push({ key: "lnk2", data });
|
|
11294
11335
|
}
|
|
11295
11336
|
if (filterItems.length) globalBlocks.push({ key: "FEid", data: writeFilterEffects(filterItems) });
|
|
11337
|
+
for (const rec of records) {
|
|
11338
|
+
const params = vectorParams.get(rec.blocks);
|
|
11339
|
+
if (!params) continue;
|
|
11340
|
+
rec.mask ??= { rect: EMPTY_RECT, defaultColor: 255, flags: 0 };
|
|
11341
|
+
if (params.density !== void 0) rec.mask.vectorDensity = params.density;
|
|
11342
|
+
if (params.feather !== void 0) rec.mask.vectorFeather = params.feather;
|
|
11343
|
+
}
|
|
11296
11344
|
const bytes = writePsd(
|
|
11297
11345
|
{
|
|
11298
11346
|
header: { psb, channels: planes.length, width, height, depth, colorMode: mode === "cmyk" ? 4 : mode === "lab" ? 9 : 3 },
|
|
@@ -11658,4 +11706,5 @@ function exportPsd(input) {
|
|
|
11658
11706
|
|
|
11659
11707
|
|
|
11660
11708
|
|
|
11661
|
-
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.layerMaskSelection = layerMaskSelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.TEXT_ORIENTATIONS = TEXT_ORIENTATIONS; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.MAX_EFFECT_ANIMATION_MS = MAX_EFFECT_ANIMATION_MS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.componentsCoverage = componentsCoverage; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.isActiveVectorMask = isActiveVectorMask; exports.vectorMaskCoverage = vectorMaskCoverage; exports.effectiveLayerMask = effectiveLayerMask; exports.resolveVectorMasks = resolveVectorMasks; exports.offsetVectorMask = offsetVectorMask; exports.transformVectorMask = transformVectorMask; exports.followLayerMove = followLayerMove; exports.vectorMaskBounds = vectorMaskBounds; exports.vectorMaskThumbnail = vectorMaskThumbnail; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.textOrientation = textOrientation; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.ANCHOR_FRACTION = ANCHOR_FRACTION; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.translateLayer = translateLayer; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
|
|
11709
|
+
|
|
11710
|
+
exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.normalizeProcessVersion = normalizeProcessVersion; exports.srgbToLinear = srgbToLinear; exports.linearToSrgb = linearToSrgb; exports.LUMA_709 = LUMA_709; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.mulMatrix3 = mulMatrix3; exports.applyMatrix3 = applyMatrix3; exports.invertMatrix3 = invertMatrix3; exports.D65 = D65; exports.bradfordAdaptation = bradfordAdaptation; exports.wbMatrix = wbMatrix; exports.linearSrgbToXy = linearSrgbToXy; exports.TINT_SCALE = TINT_SCALE; exports.MIN_KELVIN = MIN_KELVIN; exports.MAX_KELVIN = MAX_KELVIN; exports.xyToUv = xyToUv; exports.uvToXy = uvToXy; exports.tempTintToXy = tempTintToXy; exports.xyToTempTint = xyToTempTint; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.temperatureToKelvin = temperatureToKelvin; exports.kelvinToTemperature = kelvinToTemperature; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.toneCurve = toneCurve; exports.buildToneLut = buildToneLut; exports.sampleToneLut = sampleToneLut; exports.normalizeAngle = normalizeAngle; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.getRotatedSize = getRotatedSize; exports.projectImagePoint = projectImagePoint; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.projectImageRect = projectImageRect; exports.clampCropToImage = clampCropToImage; exports.getViewportProjection = getViewportProjection; exports.getViewportMetrics = getViewportMetrics; exports.canvasToImagePoint = canvasToImagePoint; exports.imageToCanvasPoint = imageToCanvasPoint; exports.mapCropHandle = mapCropHandle; exports.hitTestCrop = hitTestCrop; exports.getCropCursor = getCropCursor; exports.calculateCropDrag = calculateCropDrag; exports.getAnnotationBounds = getAnnotationBounds; exports.hitTestAnnotation = hitTestAnnotation; exports.layerMaskSelection = layerMaskSelection; exports.normalizeLayerMask = normalizeLayerMask; exports.layerMaskFromSelection = layerMaskFromSelection; exports.updateLayerMaskProps = updateLayerMaskProps; exports.decodeLayerMask = decodeLayerMask; exports.layerMaskKey = layerMaskKey; exports.layerMaskCoverage = layerMaskCoverage; exports.projectMaskCoverage = projectMaskCoverage; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.sampleLut = sampleLut; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.isAdjustmentKind = isAdjustmentKind; exports.adjustmentKindLabel = adjustmentKindLabel; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.neutralHueRange = neutralHueRange; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.createAdjustmentLayer = createAdjustmentLayer; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.curveLutFromLevels = curveLutFromLevels; exports.levelsValue = levelsValue; exports.rgbToHsl = rgbToHsl; exports.hslToRgb = hslToRgb; exports.hueRangeWeight = hueRangeWeight; exports.hueRangeTables = hueRangeTables; exports.hueSaturation = hueSaturation; exports.rangeLightness = rangeLightness; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.colorBalanceChannel = colorBalanceChannel; exports.blackWhiteGray = blackWhiteGray; exports.D50 = D50; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.photoFilterMatrix = photoFilterMatrix; exports.posterizeValue = posterizeValue; exports.rgbToGray = rgbToGray; exports.hexToRgb = hexToRgb; exports.toneLuts = toneLuts; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustmentLayersFloat = applyAdjustmentLayersFloat; exports.adjustmentLayersKey = adjustmentLayersKey; exports.applyAdjustments = applyAdjustments; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyLegacyFloat = applyLegacyFloat; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyProcess2Float = applyProcess2Float; exports.applyBoxBlurFloat = applyBoxBlurFloat; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.removeAlpha = removeAlpha; exports.flattenPath = flattenPath; exports.rasterizeCoverage = rasterizeCoverage; exports.TEXT_ORIENTATIONS = TEXT_ORIENTATIONS; exports.TEXT_ALIGNS = TEXT_ALIGNS; exports.MAX_EFFECT_ANIMATION_MS = MAX_EFFECT_ANIMATION_MS; exports.SHAPE_OPERATIONS = SHAPE_OPERATIONS; exports.LIVE_SHAPE_KINDS = LIVE_SHAPE_KINDS; exports.newLayerId = newLayerId; exports.pixelLayers = pixelLayers; exports.developFilter = developFilter; exports.blurFilter = blurFilter; exports.isActiveFilter = isActiveFilter; exports.isSpatialFilter = isSpatialFilter; exports.pixelLayerBounds = pixelLayerBounds; exports.layerTypeLabel = layerTypeLabel; exports.hasSurface = hasSurface; exports.isRenderedLayer = isRenderedLayer; exports.shapeLayers = shapeLayers; exports.smartObjectLayers = smartObjectLayers; exports.LayerOperationError = LayerOperationError; exports.userErrorMessage = userErrorMessage; exports.isPaintableLayer = isPaintableLayer; exports.defaultActiveLayerId = defaultActiveLayerId; exports.activeLayerAfterRemoval = activeLayerAfterRemoval; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.placeLayer = placeLayer; exports.removeLayer = removeLayer; exports.moveLayer = moveLayer; exports.withNewIds = withNewIds; exports.duplicateLayer = duplicateLayer; exports.setLayerProperties = setLayerProperties; exports.groupLayers = groupLayers; exports.ungroupLayer = ungroupLayer; exports.offsetLayer = offsetLayer; exports.setLayerMask = setLayerMask; exports.normalizeFilter = normalizeFilter; exports.addLayerFilter = addLayerFilter; exports.updateLayerFilter = updateLayerFilter; exports.removeLayerFilter = removeLayerFilter; exports.layerEffectsOf = layerEffectsOf; exports.setLayerEffects = setLayerEffects; exports.addLayerEffect = addLayerEffect; exports.updateLayerEffect = updateLayerEffect; exports.removeLayerEffect = removeLayerEffect; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.parseBlend = parseBlend; exports.unionRect = unionRect; exports.SHAPE_RENDER_MARGIN = SHAPE_RENDER_MARGIN; exports.DEFAULT_MITER_LIMIT = DEFAULT_MITER_LIMIT; exports.mapSubpaths = mapSubpaths; exports.liveShapeSubpaths = liveShapeSubpaths; exports.liveComponent = liveComponent; exports.componentPath = componentPath; exports.shapeOutline = shapeOutline; exports.shapeGeometryBounds = shapeGeometryBounds; exports.componentsCoverage = componentsCoverage; exports.shapeRenderClip = shapeRenderClip; exports.renderShapeRect = renderShapeRect; exports.renderShape = renderShape; exports.rerenderShape = rerenderShape; exports.normalizeShapePaint = normalizeShapePaint; exports.normalizeShapeStroke = normalizeShapeStroke; exports.normalizeLiveShape = normalizeLiveShape; exports.normalizeSubpaths = normalizeSubpaths; exports.requireOperation = requireOperation; exports.requireShapeLayer = requireShapeLayer; exports.createShapeLayer = createShapeLayer; exports.defaultShapeName = defaultShapeName; exports.updateShapeLayer = updateShapeLayer; exports.transformShapeComponents = transformShapeComponents; exports.offsetShape = offsetShape; exports.mergeShapeComponents = mergeShapeComponents; exports.shapeAsPixelLayer = shapeAsPixelLayer; exports.shapeFromAnnotation = shapeFromAnnotation; exports.annotationBlend = annotationBlend; exports.annotationOfShape = annotationOfShape; exports.isActiveVectorMask = isActiveVectorMask; exports.vectorMaskCoverage = vectorMaskCoverage; exports.effectiveLayerMask = effectiveLayerMask; exports.resolveVectorMasks = resolveVectorMasks; exports.offsetVectorMask = offsetVectorMask; exports.transformVectorMask = transformVectorMask; exports.followLayerMove = followLayerMove; exports.vectorMaskBounds = vectorMaskBounds; exports.vectorMaskThumbnail = vectorMaskThumbnail; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.depthMaskAlpha = depthMaskAlpha; exports.runLayerFilters = runLayerFilters; exports.runLayerFiltersFloat = runLayerFiltersFloat; exports.LayerCompositor = LayerCompositor; exports.compositeDeep = compositeDeep; exports.DEFAULT_ADJUSTMENTS_VALUES = DEFAULT_ADJUSTMENTS_VALUES; exports.DEFAULT_TRANSFORM_VALUES = DEFAULT_TRANSFORM_VALUES; exports.DEFAULT_DEPTH_MASK_VALUES = DEFAULT_DEPTH_MASK_VALUES; exports.TEXT_RENDER_MARGIN = TEXT_RENDER_MARGIN; exports.textMatrix = textMatrix; exports.textOutlines = textOutlines; exports.renderText = renderText; exports.rerenderText = rerenderText; exports.TEXT_STYLE_FIELDS = TEXT_STYLE_FIELDS; exports.patchTextStyle = patchTextStyle; exports.PARAGRAPH_STYLE_FIELDS = PARAGRAPH_STYLE_FIELDS; exports.patchParagraphStyle = patchParagraphStyle; exports.textRange = textRange; exports.requireTypeLayer = requireTypeLayer; exports.normalizeText = normalizeText; exports.typeLayerName = typeLayerName; exports.textOrientation = textOrientation; exports.createTypeLayer = createTypeLayer; exports.updateTypeLayer = updateTypeLayer; exports.replaceTextRange = replaceTextRange; exports.transformTypeLayer = transformTypeLayer; exports.typeFrame = typeFrame; exports.typeAsPixelLayer = typeAsPixelLayer; exports.toTextSpace = toTextSpace; exports.typeFromAnnotation = typeFromAnnotation; exports.annotationOfType = annotationOfType; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.legacyMaskOf = legacyMaskOf; exports.isDefaultDepthMask = isDefaultDepthMask; exports.developFromAdjustments = developFromAdjustments; exports.annotationLayerName = annotationLayerName; exports.annotationLayerFor = annotationLayerFor; exports.annotationOfLayer = annotationOfLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.backgroundLayer = backgroundLayer; exports.depthRasterMask = depthRasterMask; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.developTarget = developTarget; exports.legacyView = legacyView; exports.isLegacyShape = isLegacyShape; exports.FREE_TRANSFORM_MODES = FREE_TRANSFORM_MODES; exports.TRANSFORM_ANCHORS = TRANSFORM_ANCHORS; exports.ANCHOR_FRACTION = ANCHOR_FRACTION; exports.isTransformAnchor = isTransformAnchor; exports.identityTransform = identityTransform; exports.cornersFromMatrix = cornersFromMatrix; exports.matrixFromCorners = matrixFromCorners; exports.transformHomography = transformHomography; exports.hasWarp = hasWarp; exports.isIdentityTransform = isIdentityTransform; exports.transformMap = transformMap; exports.transformedPoint = transformedPoint; exports.anchorPoint = anchorPoint; exports.transformedBox = transformedBox; exports.referencePoint = referencePoint; exports.matrixFromParams = matrixFromParams; exports.describeTransform = describeTransform; exports.applyParams = applyParams; exports.flipCorners = flipCorners; exports.boxPointOf = boxPointOf; exports.presetWarp = presetWarp; exports.isValidWarp = isValidWarp; exports.geometryHomography = geometryHomography; exports.SMART_RENDER_MARGIN = SMART_RENDER_MARGIN; exports.isSmartSurfaceIncomplete = isSmartSurfaceIncomplete; exports.newContentsId = newContentsId; exports.contentsBox = contentsBox; exports.placementGeometry = placementGeometry; exports.placementAt = placementAt; exports.isContentsDecoded = isContentsDecoded; exports.requireSmartObject = requireSmartObject; exports.contentsSurface = contentsSurface; exports.rasterContents = rasterContents; exports.documentContents = documentContents; exports.placeContents = placeContents; exports.activeSmartFilters = activeSmartFilters; exports.activeEffectSmartFilters = activeEffectSmartFilters; exports.filterMaskCoverage = filterMaskCoverage; exports.applySmartFilters = applySmartFilters; exports.renderSmartObject = renderSmartObject; exports.rerender = rerender; exports.normalizePlacement = normalizePlacement; exports.setSmartPlacement = setSmartPlacement; exports.offsetSmartObject = offsetSmartObject; exports.translateLayer = translateLayer; exports.convertToSmartObject = convertToSmartObject; exports.rasterizeSmartObject = rasterizeSmartObject; exports.copySmartObject = copySmartObject; exports.instancesOf = instancesOf; exports.replaceContents = replaceContents; exports.normalizeSmartFilter = normalizeSmartFilter; exports.addSmartFilter = addSmartFilter; exports.updateSmartFilter = updateSmartFilter; exports.removeSmartFilter = removeSmartFilter; exports.moveSmartFilter = moveSmartFilter; exports.setSmartFiltersEnabled = setSmartFiltersEnabled; exports.setSmartFilterMask = setSmartFilterMask; exports.withFilterMaskSurface = withFilterMaskSurface; exports.placementBounds = placementBounds; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.serializePatterns = serializePatterns; exports.deserializePatterns = deserializePatterns; exports.encodeSurface = encodeSurface; exports.encodeDeepSurface = encodeDeepSurface; exports.decodeDeepSurface = decodeDeepSurface; exports.serializeEffects = serializeEffects; exports.deserializeEffects = deserializeEffects; exports.readShapeComponents = readShapeComponents; exports.serializeLayer = serializeLayer; exports.serializeContents = serializeContents; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.resolveExternalAssets = resolveExternalAssets; exports.decodePngDataUrl = decodePngDataUrl; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.PsdError = PsdError; exports.decodePlanes = decodePlanes; exports.encodeRle = encodeRle; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.parseLfx2 = parseLfx2; exports.writeLfx2 = writeLfx2; exports.parseLrfx = parseLrfx; exports.BROWSER_IMAGE_TYPES = BROWSER_IMAGE_TYPES; exports.readPsd = readPsd; exports.layerName = layerName; exports.layerTree = layerTree; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeMergedImage = decodeMergedImage; exports.writePsd = writePsd; exports.PATTERN_BLOCK_KEYS = PATTERN_BLOCK_KEYS; exports.parsePatternBlock = parsePatternBlock; exports.psdPatternToEffectPattern = psdPatternToEffectPattern; exports.writePatternBlock = writePatternBlock; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.psdToLayers = psdToLayers; exports.importPsd = importPsd; exports.smartContentsFile = smartContentsFile; exports.exportPsd = exportPsd;
|
|
@@ -5168,9 +5168,9 @@ function serializeVectorMask(vm) {
|
|
|
5168
5168
|
if (vm.feather) out.feather = vm.feather;
|
|
5169
5169
|
return out;
|
|
5170
5170
|
}
|
|
5171
|
-
function
|
|
5172
|
-
if (!Array.isArray(
|
|
5173
|
-
|
|
5171
|
+
function readShapeComponents(stored) {
|
|
5172
|
+
if (!Array.isArray(stored)) throw new Error("its components are missing");
|
|
5173
|
+
return stored.map((raw, i) => {
|
|
5174
5174
|
const c = raw;
|
|
5175
5175
|
const op = requireOperation(c?.op, `components[${i}].op`);
|
|
5176
5176
|
if (c?.live) {
|
|
@@ -5179,7 +5179,9 @@ function readVectorMask(r) {
|
|
|
5179
5179
|
}
|
|
5180
5180
|
return { op, subpaths: Array.isArray(c?.subpaths) && !c.subpaths.length ? [] : normalizeSubpaths(c?.subpaths, `components[${i}].subpaths`) };
|
|
5181
5181
|
});
|
|
5182
|
-
|
|
5182
|
+
}
|
|
5183
|
+
function readVectorMask(r) {
|
|
5184
|
+
const vm = { components: readShapeComponents(r.components) };
|
|
5183
5185
|
if (r.fillRule === "evenodd") vm.fillRule = "evenodd";
|
|
5184
5186
|
if (r.inverted === true) vm.inverted = true;
|
|
5185
5187
|
if (r.enabled === false) vm.enabled = false;
|
|
@@ -6957,6 +6959,19 @@ function vectorBlockForComponents(components, inverted, width, height, flags = 0
|
|
|
6957
6959
|
});
|
|
6958
6960
|
return writeVectorBlock({ subpaths, initialFill: subpaths.length === 0 && inverted }, flags & ~VMSK_INVERT | (inverted && subpaths.length ? VMSK_INVERT : 0));
|
|
6959
6961
|
}
|
|
6962
|
+
var RESOURCE_WORK_PATH = 1025;
|
|
6963
|
+
var RESOURCE_PATH_FIRST = 2e3;
|
|
6964
|
+
var RESOURCE_PATH_LAST = 2997;
|
|
6965
|
+
function componentsFromPathResource(data, width, height) {
|
|
6966
|
+
const block = new Uint8Array(8 + data.length);
|
|
6967
|
+
new DataView(block.buffer).setUint32(0, 3);
|
|
6968
|
+
block.set(data, 8);
|
|
6969
|
+
const read2 = componentsFromVectorBlock(block, width, height);
|
|
6970
|
+
return read2 ? { components: read2.components, inverted: read2.inverted } : null;
|
|
6971
|
+
}
|
|
6972
|
+
function pathResourceForComponents(components, width, height) {
|
|
6973
|
+
return vectorBlockForComponents(components, false, width, height).slice(8);
|
|
6974
|
+
}
|
|
6960
6975
|
|
|
6961
6976
|
// src/image-editor/psd/channels.ts
|
|
6962
6977
|
var hexToRgb2 = (hex) => {
|
|
@@ -8986,12 +9001,14 @@ function writeBlocks(w, blocks, psb, alignment) {
|
|
|
8986
9001
|
function writeMask(w, m) {
|
|
8987
9002
|
writeRect(w, m.rect);
|
|
8988
9003
|
w.u8(m.defaultColor);
|
|
8989
|
-
const pf = (m.userDensity !== void 0 ? 1 : 0) | (m.userFeather !== void 0 ? 2 : 0);
|
|
9004
|
+
const pf = (m.userDensity !== void 0 ? 1 : 0) | (m.userFeather !== void 0 ? 2 : 0) | (m.vectorDensity !== void 0 ? 4 : 0) | (m.vectorFeather !== void 0 ? 8 : 0);
|
|
8990
9005
|
w.u8(pf ? m.flags | MASK_FLAG_PARAMETERS : m.flags & ~MASK_FLAG_PARAMETERS);
|
|
8991
9006
|
if (pf) {
|
|
8992
9007
|
w.u8(pf);
|
|
8993
9008
|
if (m.userDensity !== void 0) w.u8(m.userDensity);
|
|
8994
9009
|
if (m.userFeather !== void 0) w.f64(m.userFeather);
|
|
9010
|
+
if (m.vectorDensity !== void 0) w.u8(m.vectorDensity);
|
|
9011
|
+
if (m.vectorFeather !== void 0) w.f64(m.vectorFeather);
|
|
8995
9012
|
}
|
|
8996
9013
|
const len = 18 + (pf ? 1 + maskParameterBytes(pf) : 0);
|
|
8997
9014
|
w.zeros(Math.max(0, 20 - len) + (4 - Math.max(20, len) % 4) % 4);
|
|
@@ -10179,6 +10196,16 @@ function psdToLayers(file, options = {}) {
|
|
|
10179
10196
|
warn.extra.push(`The alpha channels could not be read (${e instanceof Error ? e.message : String(e)}).`);
|
|
10180
10197
|
}
|
|
10181
10198
|
}
|
|
10199
|
+
const paths = [];
|
|
10200
|
+
for (const r of file.resources) {
|
|
10201
|
+
const saved = r.id >= RESOURCE_PATH_FIRST && r.id <= RESOURCE_PATH_LAST;
|
|
10202
|
+
if (!saved && r.id !== RESOURCE_WORK_PATH) continue;
|
|
10203
|
+
const read2 = componentsFromPathResource(r.data, header.width, header.height);
|
|
10204
|
+
if (!read2?.components.length) continue;
|
|
10205
|
+
if (read2.inverted) warn.extra.push(`The path "${r.name || "Work Path"}" starts by subtracting, which Pixerate's paths do not keep; it came in without that.`);
|
|
10206
|
+
paths.push(saved ? { name: r.name || `Path ${paths.length + 1}`, components: read2.components } : { name: "Work Path", components: read2.components, work: true });
|
|
10207
|
+
}
|
|
10208
|
+
paths.sort((a, b) => Number(Boolean(a.work)) - Number(Boolean(b.work)));
|
|
10182
10209
|
const i32 = (b) => b && b.length >= 4 ? new DataView(b.buffer, b.byteOffset, 4).getInt32(0) : void 0;
|
|
10183
10210
|
const angle = i32(resource(file, 1037));
|
|
10184
10211
|
const altitude = i32(resource(file, 1049));
|
|
@@ -10193,6 +10220,7 @@ function psdToLayers(file, options = {}) {
|
|
|
10193
10220
|
...angle !== void 0 || altitude !== void 0 ? { globalLight: { angle: Math.max(-360, Math.min(360, angle ?? 120)), altitude: Math.max(0, Math.min(90, altitude ?? 30)) } } : {},
|
|
10194
10221
|
info: { psb: header.psb, depth: header.depth, colorMode: mode, channels: header.channels },
|
|
10195
10222
|
...alphaChannels.length ? { alphaChannels } : {},
|
|
10223
|
+
...paths.length ? { paths } : {},
|
|
10196
10224
|
...cmykProfile ? { sourceMode: { mode: "cmyk", profile: cmykProfile } } : header.colorMode === MODE_LAB ? { sourceMode: { mode: "lab" } } : {},
|
|
10197
10225
|
...resource(file, 1039) ? { iccProfile: resource(file, 1039).slice() } : {},
|
|
10198
10226
|
bitDepth: (header.depth === 16 || header.depth === 32) && header.colorMode !== MODE_INDEXED && header.colorMode !== MODE_BITMAP ? header.depth : 8
|
|
@@ -11022,6 +11050,7 @@ function exportPsd(input) {
|
|
|
11022
11050
|
};
|
|
11023
11051
|
const psb = width > PSD_MAX_DIMENSION || height > PSD_MAX_DIMENSION;
|
|
11024
11052
|
const records = [];
|
|
11053
|
+
const vectorParams = /* @__PURE__ */ new WeakMap();
|
|
11025
11054
|
let nextId = 0;
|
|
11026
11055
|
const notes = /* @__PURE__ */ new Map();
|
|
11027
11056
|
const note = (msg, name) => notes.set(msg, [...notes.get(msg) ?? [], name]);
|
|
@@ -11054,7 +11083,10 @@ function exportPsd(input) {
|
|
|
11054
11083
|
if (vm) {
|
|
11055
11084
|
const flags = (vm.linked === false ? VMSK_NOT_LINKED : 0) | (vm.enabled === false ? VMSK_DISABLED : 0);
|
|
11056
11085
|
blocks.push({ key: "vmsk", data: vectorBlockForComponents(vm.components, vm.inverted === true, width, height, flags) });
|
|
11057
|
-
|
|
11086
|
+
const params = {};
|
|
11087
|
+
if ((vm.density ?? 1) < 1) params.density = Math.round(Math.max(0, vm.density ?? 1) * 255);
|
|
11088
|
+
if ((vm.feather ?? 0) > 0) params.feather = vm.feather;
|
|
11089
|
+
if (params.density !== void 0 || params.feather !== void 0) vectorParams.set(blocks, params);
|
|
11058
11090
|
if (vm.fillRule === "evenodd") note("Vector masks are written with the nonzero fill rule (Photoshop has no even-odd paths)", layer.name);
|
|
11059
11091
|
}
|
|
11060
11092
|
return {
|
|
@@ -11263,6 +11295,15 @@ function exportPsd(input) {
|
|
|
11263
11295
|
];
|
|
11264
11296
|
if (input.iccProfile?.length) resources.push({ id: 1039, name: "", data: input.iccProfile });
|
|
11265
11297
|
resources.push(...alphaChannelResources(input.alphaChannels ?? []));
|
|
11298
|
+
let savedPathId = RESOURCE_PATH_FIRST;
|
|
11299
|
+
for (const p of input.paths ?? []) {
|
|
11300
|
+
if (!p.work && savedPathId > RESOURCE_PATH_LAST) {
|
|
11301
|
+
note("Only 998 saved paths fit in a PSD file; the rest are not written", p.name);
|
|
11302
|
+
continue;
|
|
11303
|
+
}
|
|
11304
|
+
if (p.fillRule === "evenodd") note("Paths are written with the nonzero fill rule (Photoshop has no even-odd paths)", p.name);
|
|
11305
|
+
resources.push({ id: p.work ? RESOURCE_WORK_PATH : savedPathId++, name: p.work ? "" : p.name, data: pathResourceForComponents(p.components, width, height) });
|
|
11306
|
+
}
|
|
11266
11307
|
if (input.globalLight) {
|
|
11267
11308
|
const i32 = (v) => {
|
|
11268
11309
|
const w = new PsdWriter();
|
|
@@ -11293,6 +11334,13 @@ function exportPsd(input) {
|
|
|
11293
11334
|
globalBlocks.push({ key: "lnk2", data });
|
|
11294
11335
|
}
|
|
11295
11336
|
if (filterItems.length) globalBlocks.push({ key: "FEid", data: writeFilterEffects(filterItems) });
|
|
11337
|
+
for (const rec of records) {
|
|
11338
|
+
const params = vectorParams.get(rec.blocks);
|
|
11339
|
+
if (!params) continue;
|
|
11340
|
+
rec.mask ??= { rect: EMPTY_RECT, defaultColor: 255, flags: 0 };
|
|
11341
|
+
if (params.density !== void 0) rec.mask.vectorDensity = params.density;
|
|
11342
|
+
if (params.feather !== void 0) rec.mask.vectorFeather = params.feather;
|
|
11343
|
+
}
|
|
11296
11344
|
const bytes = writePsd(
|
|
11297
11345
|
{
|
|
11298
11346
|
header: { psb, channels: planes.length, width, height, depth, colorMode: mode === "cmyk" ? 4 : mode === "lab" ? 9 : 3 },
|
|
@@ -11622,6 +11670,7 @@ export {
|
|
|
11622
11670
|
decodeDeepSurface,
|
|
11623
11671
|
serializeEffects,
|
|
11624
11672
|
deserializeEffects,
|
|
11673
|
+
readShapeComponents,
|
|
11625
11674
|
serializeLayer,
|
|
11626
11675
|
serializeContents,
|
|
11627
11676
|
serializeLayers,
|
|
@@ -2,6 +2,7 @@ import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, Creat
|
|
|
2
2
|
import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.cjs';
|
|
3
3
|
import { type MagneticEdgeOptions } from './selection/magnetic.cjs';
|
|
4
4
|
import type { ObjectTarget } from './selection/segment/grabcut.cjs';
|
|
5
|
+
import { type DocumentPath } from './paths.cjs';
|
|
5
6
|
import { type SelectionJob, type SelectionJobResult, type SelectionWorkerFactory } from './selection/worker.cjs';
|
|
6
7
|
import type { SelectionProgress } from './selection/segment/work.cjs';
|
|
7
8
|
import type { FocusAreaOptions } from './selection/segment/focus.cjs';
|
|
@@ -1087,6 +1088,50 @@ export declare class ImageEditorController {
|
|
|
1087
1088
|
pathToSelection(path: VectorMaskPathInput, options?: PathToSelectionOptions & {
|
|
1088
1089
|
mode?: SelectionMode;
|
|
1089
1090
|
}): boolean;
|
|
1091
|
+
/** The document's paths: saved paths and the Work Path, in panel order. */
|
|
1092
|
+
getPaths(): readonly DocumentPath[];
|
|
1093
|
+
getPath(id: string): DocumentPath | null;
|
|
1094
|
+
private requirePath;
|
|
1095
|
+
/** Selects a path in the Paths panel (or none). View state: no undo step. */
|
|
1096
|
+
setActivePath(id: string | null): void;
|
|
1097
|
+
private commitPaths;
|
|
1098
|
+
/**
|
|
1099
|
+
* Paths › Make Work Path: the selection's outline, traced, becomes the Work Path (replacing the
|
|
1100
|
+
* last one, unless it was saved). One undo step. Returns the path.
|
|
1101
|
+
*/
|
|
1102
|
+
makeWorkPath(options?: SelectionToPathOptions): DocumentPath;
|
|
1103
|
+
/** A new saved path from geometry (`shape`, `subpaths` or `components`). One undo step. */
|
|
1104
|
+
addPath(input: VectorMaskPathInput & {
|
|
1105
|
+
name?: string;
|
|
1106
|
+
}): DocumentPath;
|
|
1107
|
+
/** Replaces a path's geometry (its name is kept). One undo step. */
|
|
1108
|
+
setPathGeometry(id: string, input: VectorMaskPathInput): DocumentPath;
|
|
1109
|
+
/** Renames a path; renaming the Work Path saves it (Photoshop's Save Path). One undo step. */
|
|
1110
|
+
renamePath(id: string, name: string): DocumentPath;
|
|
1111
|
+
/** Duplicates a path as a saved path. One undo step. */
|
|
1112
|
+
duplicatePath(id: string, name?: string): DocumentPath;
|
|
1113
|
+
/** Deletes a path. One undo step. */
|
|
1114
|
+
deletePath(id: string): void;
|
|
1115
|
+
/** The area a path fills over the image, as a selection mask. */
|
|
1116
|
+
private pathArea;
|
|
1117
|
+
/** Paths › Make Selection: loads a path as the selection, combined by `mode`. One undo step. */
|
|
1118
|
+
loadPathAsSelection(id: string, options?: PathToSelectionOptions & {
|
|
1119
|
+
mode?: SelectionMode;
|
|
1120
|
+
}): boolean;
|
|
1121
|
+
/**
|
|
1122
|
+
* Paths › Fill Path: fills the path's area on a pixel layer (default the active one) with a
|
|
1123
|
+
* colour (default the foreground). The selection is not changed. One undo step.
|
|
1124
|
+
*/
|
|
1125
|
+
fillPath(id: string, options?: Omit<FillOptions, 'useSelection'>): PaintStrokeResult;
|
|
1126
|
+
/**
|
|
1127
|
+
* Paths › Stroke Path: strokes along the path's outline on a pixel layer (default the active
|
|
1128
|
+
* one), `width` px wide and centred on it. The selection is not changed. One undo step.
|
|
1129
|
+
*/
|
|
1130
|
+
strokePath(id: string, options: Omit<StrokeSelectionOptions, 'location'>): PaintStrokeResult;
|
|
1131
|
+
/** Paths › Add Vector Mask: masks a layer (default the active one) with a document path. One undo step. */
|
|
1132
|
+
addVectorMaskFromPath(pathId: string, layerId?: string): VectorMask;
|
|
1133
|
+
/** Runs `fn` with `mask` as the selection, then puts the selection back, all as one undo step. */
|
|
1134
|
+
private withSelection;
|
|
1090
1135
|
/** Replaces a vector mask's path (its properties are kept). One undo step. Returns the vector mask. */
|
|
1091
1136
|
setVectorMaskPath(id: string, path: VectorMaskPathInput): VectorMask;
|
|
1092
1137
|
/** Changes a vector mask's enabled, linked, inverted, density or feather (the path is kept). One undo step. */
|
|
@@ -1627,6 +1672,12 @@ export declare class ImageEditorController {
|
|
|
1627
1672
|
* Returns false when nothing changed.
|
|
1628
1673
|
*/
|
|
1629
1674
|
setSelection(mask: SelectionMask | null, mode?: SelectionMode): boolean;
|
|
1675
|
+
/**
|
|
1676
|
+
* Shows `mask` in place of the selection while a gesture runs (Quick Selection as the brush
|
|
1677
|
+
* moves; `null` shows nothing selected), or with `undefined` stops. View state only: no undo
|
|
1678
|
+
* step, not saved.
|
|
1679
|
+
*/
|
|
1680
|
+
setSelectionPreview(mask: SelectionMask | null | undefined): void;
|
|
1630
1681
|
/** Select › All. */
|
|
1631
1682
|
selectAll(): boolean;
|
|
1632
1683
|
/** Select › Deselect. */
|
|
@@ -2,6 +2,7 @@ import { AdjustmentKind, AdjustmentLayer, AdjustmentParamsMap, Annotation, Creat
|
|
|
2
2
|
import { type PathToSelectionOptions, type SelectionToPathOptions } from './selection/path.js';
|
|
3
3
|
import { type MagneticEdgeOptions } from './selection/magnetic.js';
|
|
4
4
|
import type { ObjectTarget } from './selection/segment/grabcut.js';
|
|
5
|
+
import { type DocumentPath } from './paths.js';
|
|
5
6
|
import { type SelectionJob, type SelectionJobResult, type SelectionWorkerFactory } from './selection/worker.js';
|
|
6
7
|
import type { SelectionProgress } from './selection/segment/work.js';
|
|
7
8
|
import type { FocusAreaOptions } from './selection/segment/focus.js';
|
|
@@ -1087,6 +1088,50 @@ export declare class ImageEditorController {
|
|
|
1087
1088
|
pathToSelection(path: VectorMaskPathInput, options?: PathToSelectionOptions & {
|
|
1088
1089
|
mode?: SelectionMode;
|
|
1089
1090
|
}): boolean;
|
|
1091
|
+
/** The document's paths: saved paths and the Work Path, in panel order. */
|
|
1092
|
+
getPaths(): readonly DocumentPath[];
|
|
1093
|
+
getPath(id: string): DocumentPath | null;
|
|
1094
|
+
private requirePath;
|
|
1095
|
+
/** Selects a path in the Paths panel (or none). View state: no undo step. */
|
|
1096
|
+
setActivePath(id: string | null): void;
|
|
1097
|
+
private commitPaths;
|
|
1098
|
+
/**
|
|
1099
|
+
* Paths › Make Work Path: the selection's outline, traced, becomes the Work Path (replacing the
|
|
1100
|
+
* last one, unless it was saved). One undo step. Returns the path.
|
|
1101
|
+
*/
|
|
1102
|
+
makeWorkPath(options?: SelectionToPathOptions): DocumentPath;
|
|
1103
|
+
/** A new saved path from geometry (`shape`, `subpaths` or `components`). One undo step. */
|
|
1104
|
+
addPath(input: VectorMaskPathInput & {
|
|
1105
|
+
name?: string;
|
|
1106
|
+
}): DocumentPath;
|
|
1107
|
+
/** Replaces a path's geometry (its name is kept). One undo step. */
|
|
1108
|
+
setPathGeometry(id: string, input: VectorMaskPathInput): DocumentPath;
|
|
1109
|
+
/** Renames a path; renaming the Work Path saves it (Photoshop's Save Path). One undo step. */
|
|
1110
|
+
renamePath(id: string, name: string): DocumentPath;
|
|
1111
|
+
/** Duplicates a path as a saved path. One undo step. */
|
|
1112
|
+
duplicatePath(id: string, name?: string): DocumentPath;
|
|
1113
|
+
/** Deletes a path. One undo step. */
|
|
1114
|
+
deletePath(id: string): void;
|
|
1115
|
+
/** The area a path fills over the image, as a selection mask. */
|
|
1116
|
+
private pathArea;
|
|
1117
|
+
/** Paths › Make Selection: loads a path as the selection, combined by `mode`. One undo step. */
|
|
1118
|
+
loadPathAsSelection(id: string, options?: PathToSelectionOptions & {
|
|
1119
|
+
mode?: SelectionMode;
|
|
1120
|
+
}): boolean;
|
|
1121
|
+
/**
|
|
1122
|
+
* Paths › Fill Path: fills the path's area on a pixel layer (default the active one) with a
|
|
1123
|
+
* colour (default the foreground). The selection is not changed. One undo step.
|
|
1124
|
+
*/
|
|
1125
|
+
fillPath(id: string, options?: Omit<FillOptions, 'useSelection'>): PaintStrokeResult;
|
|
1126
|
+
/**
|
|
1127
|
+
* Paths › Stroke Path: strokes along the path's outline on a pixel layer (default the active
|
|
1128
|
+
* one), `width` px wide and centred on it. The selection is not changed. One undo step.
|
|
1129
|
+
*/
|
|
1130
|
+
strokePath(id: string, options: Omit<StrokeSelectionOptions, 'location'>): PaintStrokeResult;
|
|
1131
|
+
/** Paths › Add Vector Mask: masks a layer (default the active one) with a document path. One undo step. */
|
|
1132
|
+
addVectorMaskFromPath(pathId: string, layerId?: string): VectorMask;
|
|
1133
|
+
/** Runs `fn` with `mask` as the selection, then puts the selection back, all as one undo step. */
|
|
1134
|
+
private withSelection;
|
|
1090
1135
|
/** Replaces a vector mask's path (its properties are kept). One undo step. Returns the vector mask. */
|
|
1091
1136
|
setVectorMaskPath(id: string, path: VectorMaskPathInput): VectorMask;
|
|
1092
1137
|
/** Changes a vector mask's enabled, linked, inverted, density or feather (the path is kept). One undo step. */
|
|
@@ -1627,6 +1672,12 @@ export declare class ImageEditorController {
|
|
|
1627
1672
|
* Returns false when nothing changed.
|
|
1628
1673
|
*/
|
|
1629
1674
|
setSelection(mask: SelectionMask | null, mode?: SelectionMode): boolean;
|
|
1675
|
+
/**
|
|
1676
|
+
* Shows `mask` in place of the selection while a gesture runs (Quick Selection as the brush
|
|
1677
|
+
* moves; `null` shows nothing selected), or with `undefined` stops. View state only: no undo
|
|
1678
|
+
* step, not saved.
|
|
1679
|
+
*/
|
|
1680
|
+
setSelectionPreview(mask: SelectionMask | null | undefined): void;
|
|
1630
1681
|
/** Select › All. */
|
|
1631
1682
|
selectAll(): boolean;
|
|
1632
1683
|
/** Select › Deselect. */
|