@pixerate/editor 0.94.0 → 0.95.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/THIRD_PARTY_NOTICES.md +1 -0
- package/dist/{chunk-ZOOEX3WT.cjs → chunk-CRMAXIUV.cjs} +369 -7
- package/dist/chunk-CRMAXIUV.cjs.map +1 -0
- package/dist/{chunk-747CGOT2.js → chunk-E2ILRYTJ.js} +12 -2
- package/dist/chunk-E2ILRYTJ.js.map +1 -0
- package/dist/{chunk-D4ZCU72J.js → chunk-HEW6KDNI.js} +366 -4
- package/dist/chunk-HEW6KDNI.js.map +1 -0
- package/dist/{chunk-ISDCJHTO.js → chunk-IB53LVGV.js} +238 -285
- package/dist/chunk-IB53LVGV.js.map +1 -0
- package/dist/{chunk-73L6TROJ.cjs → chunk-T6H3JDGA.cjs} +54 -44
- package/dist/chunk-T6H3JDGA.cjs.map +1 -0
- package/dist/{chunk-4F3YDIWW.cjs → chunk-ZZOTHJ4K.cjs} +264 -311
- package/dist/chunk-ZZOTHJ4K.cjs.map +1 -0
- package/dist/image-editor/index.cjs +705 -501
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +86 -22
- package/dist/image-editor/index.d.ts +86 -22
- package/dist/image-editor/index.js +383 -179
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +22 -3
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +117 -2
- package/dist/paint/index.d.ts +117 -2
- package/dist/paint/index.js +32 -13
- package/dist/raster/index.cjs +7 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +4 -4
- package/dist/raster/index.d.ts +4 -4
- package/dist/raster/index.js +6 -2
- package/dist/{surface-CuBg2c6k.d.cts → surface-CgAiXVI3.d.cts} +23 -11
- package/dist/{surface-CuBg2c6k.d.ts → surface-CgAiXVI3.d.ts} +23 -11
- package/dist/{zlib-BJ6U7LuB.d.cts → zlib-B3LIoxF-.d.cts} +3 -2
- package/dist/{zlib-BjQkpMFi.d.ts → zlib-eiTEEj1z.d.ts} +3 -2
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +26 -2
- package/dist/chunk-4F3YDIWW.cjs.map +0 -1
- package/dist/chunk-73L6TROJ.cjs.map +0 -1
- package/dist/chunk-747CGOT2.js.map +0 -1
- package/dist/chunk-D4ZCU72J.js.map +0 -1
- package/dist/chunk-ISDCJHTO.js.map +0 -1
- package/dist/chunk-ZOOEX3WT.cjs.map +0 -1
|
@@ -42,7 +42,7 @@ var _chunkVJUVNERTcjs = require('../chunk-VJUVNERT.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
var
|
|
45
|
+
var _chunkT6H3JDGAcjs = require('../chunk-T6H3JDGA.cjs');
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
@@ -70,9 +70,9 @@ var _chunk73L6TROJcjs = require('../chunk-73L6TROJ.cjs');
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
|
+
var _chunkZZOTHJ4Kcjs = require('../chunk-ZZOTHJ4K.cjs');
|
|
73
74
|
|
|
74
75
|
|
|
75
|
-
var _chunk4F3YDIWWcjs = require('../chunk-4F3YDIWW.cjs');
|
|
76
76
|
|
|
77
77
|
|
|
78
78
|
|
|
@@ -108,7 +108,18 @@ var _chunk4F3YDIWWcjs = require('../chunk-4F3YDIWW.cjs');
|
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
var _chunkCRMAXIUVcjs = require('../chunk-CRMAXIUV.cjs');
|
|
112
123
|
|
|
113
124
|
// src/image-editor/color.ts
|
|
114
125
|
var LEGACY_PROCESS_VERSION = 1;
|
|
@@ -1120,7 +1131,7 @@ function smoothCoverage(m, w, h, r) {
|
|
|
1120
1131
|
return src;
|
|
1121
1132
|
}
|
|
1122
1133
|
function featherCoverage(m, w, h, radius) {
|
|
1123
|
-
const out =
|
|
1134
|
+
const out = _chunkT6H3JDGAcjs.gaussianBlur.call(void 0, m, w, h, Number.isFinite(radius) ? Math.max(0, radius) : 0, "zero");
|
|
1124
1135
|
for (let i = 0; i < out.length; i++) if (Math.abs(out[i]) < 1e-7) out[i] = 0;
|
|
1125
1136
|
return out;
|
|
1126
1137
|
}
|
|
@@ -1268,7 +1279,7 @@ function layerMaskCoverage(mask) {
|
|
|
1268
1279
|
let v = new Float32Array(sel.data.length);
|
|
1269
1280
|
for (let i = 0; i < v.length; i++) v[i] = sel.data[i] / 255;
|
|
1270
1281
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
1271
|
-
if (feather > 0) v =
|
|
1282
|
+
if (feather > 0) v = _chunkT6H3JDGAcjs.gaussianBlur.call(void 0, v, mask.width, mask.height, feather, "clamp");
|
|
1272
1283
|
const density = _nullishCoalesce(mask.density, () => ( 1));
|
|
1273
1284
|
if (density !== 1) for (let i = 0; i < v.length; i++) v[i] = 1 - density * (1 - v[i]);
|
|
1274
1285
|
return v;
|
|
@@ -1489,7 +1500,7 @@ function normalizeAdjustmentLayer(raw) {
|
|
|
1489
1500
|
kind: r.kind,
|
|
1490
1501
|
enabled: r.enabled !== false,
|
|
1491
1502
|
opacity: clampTo(r.opacity, 0, 1, 1),
|
|
1492
|
-
blend:
|
|
1503
|
+
blend: _chunkCRMAXIUVcjs.normalizeBlendMode.call(void 0, r.blend),
|
|
1493
1504
|
params: normParams(r.kind, r.params)
|
|
1494
1505
|
};
|
|
1495
1506
|
if (typeof r.name === "string" && r.name) layer.name = r.name;
|
|
@@ -1511,7 +1522,7 @@ function normalizeAdjustmentLayers(raw) {
|
|
|
1511
1522
|
return out;
|
|
1512
1523
|
}
|
|
1513
1524
|
function curveLutFromLevels(points) {
|
|
1514
|
-
return
|
|
1525
|
+
return _chunkT6H3JDGAcjs.curveLut.call(void 0, points.map((p) => ({ input: p.input / 255, output: p.output / 255 })));
|
|
1515
1526
|
}
|
|
1516
1527
|
var toUnitLevels = (c) => ({
|
|
1517
1528
|
inBlack: c.inBlack / 255,
|
|
@@ -1834,7 +1845,7 @@ function compileAdjustmentLayer(layer) {
|
|
|
1834
1845
|
return (c) => {
|
|
1835
1846
|
const g = blackWhiteGray(c, weights);
|
|
1836
1847
|
if (tint) {
|
|
1837
|
-
const t =
|
|
1848
|
+
const t = _chunkCRMAXIUVcjs.setLum.call(void 0, tint, g);
|
|
1838
1849
|
c[0] = clamp01(t[0]);
|
|
1839
1850
|
c[1] = clamp01(t[1]);
|
|
1840
1851
|
c[2] = clamp01(t[2]);
|
|
@@ -1853,7 +1864,7 @@ function compileAdjustmentLayer(layer) {
|
|
|
1853
1864
|
let f = [0, 1, 2].map((r) => linearToSrgb(Math.max(0, m[r][0] * l[0] + m[r][1] * l[1] + m[r][2] * l[2])));
|
|
1854
1865
|
if (preserve) {
|
|
1855
1866
|
const target = 0.3 * c[0] + 0.59 * c[1] + 0.11 * c[2];
|
|
1856
|
-
f =
|
|
1867
|
+
f = _chunkCRMAXIUVcjs.setLum.call(void 0, f, target);
|
|
1857
1868
|
}
|
|
1858
1869
|
c[0] = clamp01(f[0]);
|
|
1859
1870
|
c[1] = clamp01(f[1]);
|
|
@@ -1919,7 +1930,11 @@ function applyLayer(c, layer, op, coverage = 1) {
|
|
|
1919
1930
|
}
|
|
1920
1931
|
const cb0 = c[0], cb1 = c[1], cb2 = c[2];
|
|
1921
1932
|
op(c);
|
|
1922
|
-
|
|
1933
|
+
if (blend === "pigment") {
|
|
1934
|
+
_chunkCRMAXIUVcjs.mixPigmentRgb.call(void 0, [clamp01(cb0), clamp01(cb1), clamp01(cb2)], [clamp01(c[0]), clamp01(c[1]), clamp01(c[2])], alpha, c);
|
|
1935
|
+
return;
|
|
1936
|
+
}
|
|
1937
|
+
const b = blend === "normal" ? c : _chunkCRMAXIUVcjs.blendRgb.call(void 0, blend, [cb0, cb1, cb2], c);
|
|
1923
1938
|
c[0] = (1 - alpha) * cb0 + alpha * b[0];
|
|
1924
1939
|
c[1] = (1 - alpha) * cb1 + alpha * b[1];
|
|
1925
1940
|
c[2] = (1 - alpha) * cb2 + alpha * b[2];
|
|
@@ -2333,7 +2348,7 @@ function newLayerId(prefix = "layer") {
|
|
|
2333
2348
|
return `${prefix}_${Date.now().toString(36)}_${(++idCounter).toString(36)}`;
|
|
2334
2349
|
}
|
|
2335
2350
|
function pixelLayers(layers) {
|
|
2336
|
-
return
|
|
2351
|
+
return _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "pixel");
|
|
2337
2352
|
}
|
|
2338
2353
|
function developFilter(layer) {
|
|
2339
2354
|
return _optionalChain([layer, 'access', _8 => _8.filters, 'optionalAccess', _9 => _9.find, 'call', _10 => _10((f) => f.kind === "develop")]);
|
|
@@ -2454,7 +2469,7 @@ var PHOTO_PROFILE = {
|
|
|
2454
2469
|
return v;
|
|
2455
2470
|
}
|
|
2456
2471
|
};
|
|
2457
|
-
var LayerCompositor = class extends
|
|
2472
|
+
var LayerCompositor = class extends _chunkT6H3JDGAcjs.RasterCompositor {
|
|
2458
2473
|
constructor(options = {}) {
|
|
2459
2474
|
super(PHOTO_PROFILE, options);
|
|
2460
2475
|
}
|
|
@@ -2496,7 +2511,7 @@ function rasterMaskFromLegacy(mask, width, height) {
|
|
|
2496
2511
|
const sel = decodeLayerMask(mask);
|
|
2497
2512
|
if (!sel) return null;
|
|
2498
2513
|
const sized = sel.width === width && sel.height === height ? sel : resizeSelection(sel, width, height);
|
|
2499
|
-
const surface =
|
|
2514
|
+
const surface = _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data: sized.data }, 1, 0, 0, 0);
|
|
2500
2515
|
legacyMaskMemo.set(surface, { width: mask.width, height: mask.height, rle: mask.rle });
|
|
2501
2516
|
const out = { surface, defaultValue: 0 };
|
|
2502
2517
|
if (mask.density !== void 0 && mask.density !== 1) out.density = mask.density;
|
|
@@ -2515,7 +2530,7 @@ function hasResampledLegacyMask(layers, width, height) {
|
|
|
2515
2530
|
function legacyMaskOf(mask, width, height) {
|
|
2516
2531
|
let memo = legacyMaskMemo.get(mask.surface);
|
|
2517
2532
|
if (!memo) {
|
|
2518
|
-
const data =
|
|
2533
|
+
const data = _chunkCRMAXIUVcjs.readRegion.call(void 0, mask.surface, { x: 0, y: 0, width, height });
|
|
2519
2534
|
memo = { width, height, rle: encodeSelectionRle(new Uint8Array(data.buffer, data.byteOffset, data.length)) };
|
|
2520
2535
|
legacyMaskMemo.set(mask.surface, memo);
|
|
2521
2536
|
}
|
|
@@ -2596,7 +2611,7 @@ function backgroundLayer(filters = [], mask) {
|
|
|
2596
2611
|
visible: true,
|
|
2597
2612
|
opacity: 1,
|
|
2598
2613
|
blend: "normal",
|
|
2599
|
-
surface:
|
|
2614
|
+
surface: _chunkCRMAXIUVcjs.emptySurface.call(void 0, 4),
|
|
2600
2615
|
offset: { x: 0, y: 0 },
|
|
2601
2616
|
source: "document",
|
|
2602
2617
|
filters
|
|
@@ -2606,7 +2621,7 @@ function backgroundLayer(filters = [], mask) {
|
|
|
2606
2621
|
}
|
|
2607
2622
|
function depthRasterMask(source) {
|
|
2608
2623
|
const out = {
|
|
2609
|
-
surface:
|
|
2624
|
+
surface: _chunkCRMAXIUVcjs.emptySurface.call(void 0, 1, 255),
|
|
2610
2625
|
defaultValue: 255,
|
|
2611
2626
|
source: { ...source, depthRange: [...source.depthRange] }
|
|
2612
2627
|
};
|
|
@@ -3231,7 +3246,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3231
3246
|
/** Loads what the compositor reads synchronously: depth maps (at canvas size) and annotation images. */
|
|
3232
3247
|
/** Loads depth maps and annotation images the compositor reads synchronously. */
|
|
3233
3248
|
async prepareLayerAssets(layers, width, height) {
|
|
3234
|
-
for (const l of
|
|
3249
|
+
for (const l of _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers)) {
|
|
3235
3250
|
const source = _optionalChain([l, 'access', _57 => _57.mask, 'optionalAccess', _58 => _58.source]);
|
|
3236
3251
|
if (_optionalChain([source, 'optionalAccess', _59 => _59.enabled]) && source.maskSource) {
|
|
3237
3252
|
const key = `${source.maskSource}|${width}x${height}`;
|
|
@@ -3285,14 +3300,14 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3285
3300
|
}
|
|
3286
3301
|
}
|
|
3287
3302
|
putTile(ctx, data, tx, ty, rect) {
|
|
3288
|
-
const ox = tx *
|
|
3289
|
-
const oy = ty *
|
|
3303
|
+
const ox = tx * _chunkCRMAXIUVcjs.TILE - rect.x;
|
|
3304
|
+
const oy = ty * _chunkCRMAXIUVcjs.TILE - rect.y;
|
|
3290
3305
|
const x0 = Math.max(0, -ox);
|
|
3291
3306
|
const y0 = Math.max(0, -oy);
|
|
3292
|
-
const x1 = Math.min(
|
|
3293
|
-
const y1 = Math.min(
|
|
3307
|
+
const x1 = Math.min(_chunkCRMAXIUVcjs.TILE, rect.width - ox);
|
|
3308
|
+
const y1 = Math.min(_chunkCRMAXIUVcjs.TILE, rect.height - oy);
|
|
3294
3309
|
if (x1 <= x0 || y1 <= y0) return;
|
|
3295
|
-
const img = ctx.createImageData(
|
|
3310
|
+
const img = ctx.createImageData(_chunkCRMAXIUVcjs.TILE, _chunkCRMAXIUVcjs.TILE);
|
|
3296
3311
|
img.data.set(data);
|
|
3297
3312
|
ctx.putImageData(img, ox, oy, x0, y0, x1 - x0, y1 - y0);
|
|
3298
3313
|
}
|
|
@@ -3313,7 +3328,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3313
3328
|
if (!ctx || typeof ctx.createImageData !== "function") return null;
|
|
3314
3329
|
let changed = false;
|
|
3315
3330
|
this.compositor.compositeTiles(layers, rect, this.compositorSources(width, height), (tx, ty, data) => {
|
|
3316
|
-
const key =
|
|
3331
|
+
const key = _chunkCRMAXIUVcjs.tileKey.call(void 0, tx, ty);
|
|
3317
3332
|
if (comp.tiles.get(key) === data) return;
|
|
3318
3333
|
comp.tiles.set(key, data);
|
|
3319
3334
|
comp.histograms.delete(key);
|
|
@@ -3438,12 +3453,12 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3438
3453
|
* Draws an individual annotation onto the canvas.
|
|
3439
3454
|
*/
|
|
3440
3455
|
async drawAnnotation(ctx, ann) {
|
|
3441
|
-
const blend =
|
|
3456
|
+
const blend = _chunkCRMAXIUVcjs.normalizeBlendMode.call(void 0, ann.blend);
|
|
3442
3457
|
if (blend === "normal") {
|
|
3443
3458
|
await this.drawAnnotationContent(ctx, ann);
|
|
3444
3459
|
return;
|
|
3445
3460
|
}
|
|
3446
|
-
const op =
|
|
3461
|
+
const op = _chunkCRMAXIUVcjs.canvasCompositeOperation.call(void 0, blend);
|
|
3447
3462
|
if (op) {
|
|
3448
3463
|
ctx.save();
|
|
3449
3464
|
ctx.globalCompositeOperation = op;
|
|
@@ -3476,7 +3491,7 @@ var ImageEditorRenderer = (_class2 = class {constructor() { _class2.prototype.__
|
|
|
3476
3491
|
const backdrop = ctx.getImageData(0, 0, w, h);
|
|
3477
3492
|
const source = lctx.getImageData(0, 0, w, h);
|
|
3478
3493
|
if (!backdrop || !source) return false;
|
|
3479
|
-
|
|
3494
|
+
_chunkCRMAXIUVcjs.blendImageData.call(void 0, backdrop, source, _chunkCRMAXIUVcjs.normalizeBlendMode.call(void 0, ann.blend));
|
|
3480
3495
|
lctx.setTransform(1, 0, 0, 1, 0, 0);
|
|
3481
3496
|
lctx.putImageData(backdrop, 0, 0);
|
|
3482
3497
|
} catch (e10) {
|
|
@@ -3901,12 +3916,12 @@ var CompositeCanvas = (_class3 = class {
|
|
|
3901
3916
|
if (!h) {
|
|
3902
3917
|
const tx = key % 65536 - 32768;
|
|
3903
3918
|
const ty = Math.floor(key / 65536) - 32768;
|
|
3904
|
-
const x0 = Math.max(r.x, tx *
|
|
3905
|
-
const y0 = Math.max(r.y, ty *
|
|
3906
|
-
const x1 = Math.min(r.x + r.width, tx *
|
|
3907
|
-
const y1 = Math.min(r.y + r.height, ty *
|
|
3919
|
+
const x0 = Math.max(r.x, tx * _chunkCRMAXIUVcjs.TILE);
|
|
3920
|
+
const y0 = Math.max(r.y, ty * _chunkCRMAXIUVcjs.TILE);
|
|
3921
|
+
const x1 = Math.min(r.x + r.width, tx * _chunkCRMAXIUVcjs.TILE + _chunkCRMAXIUVcjs.TILE);
|
|
3922
|
+
const y1 = Math.min(r.y + r.height, ty * _chunkCRMAXIUVcjs.TILE + _chunkCRMAXIUVcjs.TILE);
|
|
3908
3923
|
h = emptyHistogram();
|
|
3909
|
-
if (x1 > x0 && y1 > y0) addToHistogram(h, data,
|
|
3924
|
+
if (x1 > x0 && y1 > y0) addToHistogram(h, data, _chunkCRMAXIUVcjs.TILE, { x: x0 - tx * _chunkCRMAXIUVcjs.TILE, y: y0 - ty * _chunkCRMAXIUVcjs.TILE, width: x1 - x0, height: y1 - y0 });
|
|
3910
3925
|
this.histograms.set(key, h);
|
|
3911
3926
|
}
|
|
3912
3927
|
parts.push(h);
|
|
@@ -4414,11 +4429,11 @@ function refineCoverage(guide, m, w, h, params = {}) {
|
|
|
4414
4429
|
}
|
|
4415
4430
|
const ss = smoothSigma(p);
|
|
4416
4431
|
if (ss >= 0.3) {
|
|
4417
|
-
a =
|
|
4432
|
+
a = _chunkT6H3JDGAcjs.gaussianBlur.call(void 0, a, w, h, ss, "clamp");
|
|
4418
4433
|
const gain = 1 + ss;
|
|
4419
4434
|
for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
|
|
4420
4435
|
}
|
|
4421
|
-
a =
|
|
4436
|
+
a = _chunkT6H3JDGAcjs.gaussianBlur.call(void 0, a, w, h, featherSigma(p), "clamp");
|
|
4422
4437
|
if (p.contrast > 0) {
|
|
4423
4438
|
const gain = 1 / (1 - 0.99 * p.contrast / 100);
|
|
4424
4439
|
for (let i = 0; i < a.length; i++) a[i] = Math.min(1, Math.max(0, (a[i] - 0.5) * gain + 0.5));
|
|
@@ -4478,11 +4493,11 @@ var LAYERED_SCHEMA_VERSION = 3;
|
|
|
4478
4493
|
var encodedCache = /* @__PURE__ */ new WeakMap();
|
|
4479
4494
|
function encodeSurface(surface) {
|
|
4480
4495
|
if (encodedCache.has(surface)) return encodedCache.get(surface);
|
|
4481
|
-
const b =
|
|
4496
|
+
const b = _chunkCRMAXIUVcjs.contentBounds.call(void 0, surface);
|
|
4482
4497
|
let out = null;
|
|
4483
4498
|
if (b) {
|
|
4484
|
-
const data =
|
|
4485
|
-
out = { url:
|
|
4499
|
+
const data = _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, b);
|
|
4500
|
+
out = { url: _chunkT6H3JDGAcjs.pngDataUrl.call(void 0, b.width, b.height, data, surface.channels), x: b.x, y: b.y };
|
|
4486
4501
|
}
|
|
4487
4502
|
encodedCache.set(surface, out);
|
|
4488
4503
|
return out;
|
|
@@ -4504,7 +4519,7 @@ function baseFields(layer, ctx) {
|
|
|
4504
4519
|
function serializeEffects(effects) {
|
|
4505
4520
|
const out = { enabled: effects.enabled, items: JSON.parse(JSON.stringify(effects.items)) };
|
|
4506
4521
|
if (effects.scale !== void 0 && effects.scale !== 1) out.scale = effects.scale;
|
|
4507
|
-
if (effects.psd) out.psd = { key: effects.psd.key, data:
|
|
4522
|
+
if (effects.psd) out.psd = { key: effects.psd.key, data: _chunkT6H3JDGAcjs.bytesToBase64.call(void 0, effects.psd.data) };
|
|
4508
4523
|
return out;
|
|
4509
4524
|
}
|
|
4510
4525
|
function deserializeEffects(raw) {
|
|
@@ -4514,12 +4529,12 @@ function deserializeEffects(raw) {
|
|
|
4514
4529
|
const p = r.psd;
|
|
4515
4530
|
if (p && typeof p.key === "string" && typeof p.data === "string") {
|
|
4516
4531
|
try {
|
|
4517
|
-
psd = { key: p.key, data:
|
|
4532
|
+
psd = { key: p.key, data: _chunkT6H3JDGAcjs.base64ToBytes.call(void 0, p.data) };
|
|
4518
4533
|
} catch (e12) {
|
|
4519
4534
|
psd = void 0;
|
|
4520
4535
|
}
|
|
4521
4536
|
}
|
|
4522
|
-
return
|
|
4537
|
+
return _chunkT6H3JDGAcjs.normalizeLayerEffects.call(void 0, { ...r, psd });
|
|
4523
4538
|
}
|
|
4524
4539
|
function serializeMask(mask, hint, ctx) {
|
|
4525
4540
|
const out = { defaultValue: mask.defaultValue };
|
|
@@ -4591,7 +4606,7 @@ async function serializeLayersExternal(layers, store) {
|
|
|
4591
4606
|
for (const [id, url] of Object.entries(inline.assets)) {
|
|
4592
4607
|
let ref = refs.get(url);
|
|
4593
4608
|
if (!ref) {
|
|
4594
|
-
const parsed =
|
|
4609
|
+
const parsed = _chunkT6H3JDGAcjs.parseDataUrl.call(void 0, url);
|
|
4595
4610
|
const png = decodePngHeader(parsed.bytes);
|
|
4596
4611
|
ref = await store.put(new Blob([parsed.bytes], { type: "image/png" }), { id, width: png.width, height: png.height });
|
|
4597
4612
|
if (typeof ref !== "string" || !ref) throw new Error(`The asset store returned no reference for "${id}".`);
|
|
@@ -4619,7 +4634,7 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
4619
4634
|
try {
|
|
4620
4635
|
const blob = await store.get(ref);
|
|
4621
4636
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
4622
|
-
out[id] = `data:image/png;base64,${
|
|
4637
|
+
out[id] = `data:image/png;base64,${_chunkT6H3JDGAcjs.bytesToBase64.call(void 0, bytes)}`;
|
|
4623
4638
|
} catch (err) {
|
|
4624
4639
|
problems.push(`Asset "${id}" (${ref}) could not be fetched: ${err.message}`);
|
|
4625
4640
|
}
|
|
@@ -4627,9 +4642,9 @@ async function resolveExternalAssets(assets, store, problems) {
|
|
|
4627
4642
|
return out;
|
|
4628
4643
|
}
|
|
4629
4644
|
function decodePngDataUrl(url, channels) {
|
|
4630
|
-
const parsed =
|
|
4645
|
+
const parsed = _chunkT6H3JDGAcjs.parseDataUrl.call(void 0, url);
|
|
4631
4646
|
if (!parsed) throw new Error("Asset is not a data URL.");
|
|
4632
|
-
const png =
|
|
4647
|
+
const png = _chunkT6H3JDGAcjs.decodePng.call(void 0, parsed.bytes, { keepGray: channels === 1 });
|
|
4633
4648
|
if (png.channels === channels) return png;
|
|
4634
4649
|
if (channels === 1) {
|
|
4635
4650
|
const out2 = new Uint8ClampedArray(png.width * png.height);
|
|
@@ -4647,18 +4662,18 @@ function decodePngDataUrl(url, channels) {
|
|
|
4647
4662
|
}
|
|
4648
4663
|
var num = (v, lo, hi, fallback) => typeof v === "number" && Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : fallback;
|
|
4649
4664
|
function readSurface(ref, x, y, channels, defaultValue, ctx, what) {
|
|
4650
|
-
if (typeof ref !== "string" || !ref) return
|
|
4665
|
+
if (typeof ref !== "string" || !ref) return _chunkCRMAXIUVcjs.emptySurface.call(void 0, channels, defaultValue);
|
|
4651
4666
|
const url = ctx.assets[ref];
|
|
4652
4667
|
if (typeof url !== "string") {
|
|
4653
4668
|
ctx.problems.push(`${what}: asset "${ref}" is missing`);
|
|
4654
|
-
return
|
|
4669
|
+
return _chunkCRMAXIUVcjs.emptySurface.call(void 0, channels, defaultValue);
|
|
4655
4670
|
}
|
|
4656
4671
|
try {
|
|
4657
4672
|
const px = (_nullishCoalesce(ctx.decodeAsset, () => ( decodePngDataUrl)))(url, channels);
|
|
4658
|
-
return
|
|
4673
|
+
return _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, px, channels, Math.round(num(x, -1e7, 1e7, 0)), Math.round(num(y, -1e7, 1e7, 0)), defaultValue);
|
|
4659
4674
|
} catch (err) {
|
|
4660
4675
|
ctx.problems.push(`${what}: asset "${ref}" could not be decoded (${err.message})`);
|
|
4661
|
-
return
|
|
4676
|
+
return _chunkCRMAXIUVcjs.emptySurface.call(void 0, channels, defaultValue);
|
|
4662
4677
|
}
|
|
4663
4678
|
}
|
|
4664
4679
|
function readMask(raw, ctx, what) {
|
|
@@ -4666,7 +4681,7 @@ function readMask(raw, ctx, what) {
|
|
|
4666
4681
|
const r = raw;
|
|
4667
4682
|
const defaultValue = r.defaultValue === 255 ? 255 : 0;
|
|
4668
4683
|
const mask = {
|
|
4669
|
-
surface: r.source ?
|
|
4684
|
+
surface: r.source ? _chunkCRMAXIUVcjs.emptySurface.call(void 0, 1, 255) : readSurface(r.asset, r.x, r.y, 1, defaultValue, ctx, `${what} mask`),
|
|
4670
4685
|
defaultValue: r.source ? 255 : defaultValue
|
|
4671
4686
|
};
|
|
4672
4687
|
if (typeof r.density === "number" && r.density !== 1) mask.density = num(r.density, 0, 1, 1);
|
|
@@ -4713,7 +4728,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
4713
4728
|
name: typeof r.name === "string" ? r.name : "",
|
|
4714
4729
|
visible: r.visible !== false,
|
|
4715
4730
|
opacity: num(r.opacity, 0, 1, 1),
|
|
4716
|
-
blend:
|
|
4731
|
+
blend: _chunkCRMAXIUVcjs.normalizeBlendMode.call(void 0, r.blend)
|
|
4717
4732
|
};
|
|
4718
4733
|
if (r.clipped === true) base.clipped = true;
|
|
4719
4734
|
const mask = readMask(r.mask, ctx, `Layer "${base.name || id}"`);
|
|
@@ -4730,7 +4745,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
4730
4745
|
const layer = {
|
|
4731
4746
|
...base,
|
|
4732
4747
|
type: "pixel",
|
|
4733
|
-
surface: r.source === "document" ?
|
|
4748
|
+
surface: r.source === "document" ? _chunkCRMAXIUVcjs.emptySurface.call(void 0, 4) : readSurface(r.asset, r.x, r.y, 4, 0, ctx, `Layer "${base.name || id}"`),
|
|
4734
4749
|
offset: { x: Math.round(num(_optionalChain([r, 'access', _75 => _75.offset, 'optionalAccess', _76 => _76.x]), -1e7, 1e7, 0)), y: Math.round(num(_optionalChain([r, 'access', _77 => _77.offset, 'optionalAccess', _78 => _78.y]), -1e7, 1e7, 0)) }
|
|
4735
4750
|
};
|
|
4736
4751
|
if (r.source === "document") layer.source = "document";
|
|
@@ -4749,7 +4764,7 @@ function deserializeLayer(raw, ctx) {
|
|
|
4749
4764
|
}
|
|
4750
4765
|
case "group": {
|
|
4751
4766
|
const children = Array.isArray(r.children) ? r.children.map((c) => deserializeLayer(c, ctx)).filter(Boolean) : [];
|
|
4752
|
-
const blend = r.blend === "pass-through" ? "pass-through" :
|
|
4767
|
+
const blend = r.blend === "pass-through" ? "pass-through" : _chunkCRMAXIUVcjs.isBlendMode.call(void 0, r.blend) ? r.blend : "pass-through";
|
|
4753
4768
|
const group = { ...base, type: "group", blend, children };
|
|
4754
4769
|
if (r.collapsed === true) group.collapsed = true;
|
|
4755
4770
|
return group;
|
|
@@ -4791,47 +4806,47 @@ var fail = (message) => {
|
|
|
4791
4806
|
throw new LayerOperationError(message);
|
|
4792
4807
|
};
|
|
4793
4808
|
function requireLayer(layers, id) {
|
|
4794
|
-
const loc =
|
|
4809
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, layers, id);
|
|
4795
4810
|
if (!loc) {
|
|
4796
|
-
const ids =
|
|
4811
|
+
const ids = _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers).map((l) => l.id);
|
|
4797
4812
|
fail(`Unknown layer "${id}". ${ids.length ? `Layers: ${ids.join(", ")}.` : "The document has no layers."} Call list_layers for ids.`);
|
|
4798
4813
|
}
|
|
4799
4814
|
return loc;
|
|
4800
4815
|
}
|
|
4801
4816
|
function requireUnlocked(layer, what, action) {
|
|
4802
|
-
if (
|
|
4803
|
-
if (what !== "all" &&
|
|
4817
|
+
if (_chunkT6H3JDGAcjs.isLayerLocked.call(void 0, layer, "all")) fail(`Layer "${layer.name || layer.id}" is locked (all); unlock it before you ${action}.`);
|
|
4818
|
+
if (what !== "all" && _chunkT6H3JDGAcjs.isLayerLocked.call(void 0, layer, what)) fail(`Layer "${layer.name || layer.id}" has its ${what} locked; unlock it before you ${action}.`);
|
|
4804
4819
|
}
|
|
4805
4820
|
function placeLayer(layers, layer, placement = {}, defaultIndex) {
|
|
4806
4821
|
const given = [placement.aboveId, placement.belowId, placement.parentId].filter((v) => v !== void 0).length;
|
|
4807
4822
|
if (given > 1) fail("Give only one of aboveId, belowId and parentId.");
|
|
4808
4823
|
if (placement.aboveId || placement.belowId) {
|
|
4809
4824
|
const ref = requireLayer(layers, _nullishCoalesce(placement.aboveId, () => ( placement.belowId)));
|
|
4810
|
-
return
|
|
4825
|
+
return _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, layer, _nullishCoalesce(_optionalChain([ref, 'access', _79 => _79.parent, 'optionalAccess', _80 => _80.id]), () => ( null)), ref.index + (placement.aboveId ? 1 : 0));
|
|
4811
4826
|
}
|
|
4812
4827
|
if (placement.parentId) {
|
|
4813
4828
|
const ref = requireLayer(layers, placement.parentId);
|
|
4814
4829
|
if (ref.layer.type !== "group") fail(`Layer "${placement.parentId}" is not a group; parentId must be a group id.`);
|
|
4815
|
-
return
|
|
4830
|
+
return _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, layer, ref.layer.id, placement.index);
|
|
4816
4831
|
}
|
|
4817
|
-
return
|
|
4832
|
+
return _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, layer, null, _nullishCoalesce(placement.index, () => ( defaultIndex)));
|
|
4818
4833
|
}
|
|
4819
4834
|
function removeLayer(layers, id) {
|
|
4820
4835
|
const loc = requireLayer(layers, id);
|
|
4821
4836
|
requireUnlocked(loc.layer, "all", "delete it");
|
|
4822
|
-
return
|
|
4837
|
+
return _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4823
4838
|
}
|
|
4824
4839
|
function moveLayer(layers, id, placement) {
|
|
4825
4840
|
const loc = requireLayer(layers, id);
|
|
4826
4841
|
requireUnlocked(loc.layer, "all", "move it");
|
|
4827
4842
|
const target = _nullishCoalesce(_nullishCoalesce(placement.aboveId, () => ( placement.belowId)), () => ( placement.parentId));
|
|
4828
4843
|
if (target === id) fail("A layer cannot be placed relative to itself.");
|
|
4829
|
-
if (target && loc.layer.type === "group" &&
|
|
4844
|
+
if (target && loc.layer.type === "group" && _chunkT6H3JDGAcjs.flattenLayers.call(void 0, loc.layer.children).some((l) => l.id === target)) {
|
|
4830
4845
|
fail(`Group "${id}" cannot be moved into its own child "${target}".`);
|
|
4831
4846
|
}
|
|
4832
4847
|
if (target) requireLayer(layers, target);
|
|
4833
4848
|
if (!target && placement.index === void 0) fail("Give aboveId, belowId, parentId or index.");
|
|
4834
|
-
const without =
|
|
4849
|
+
const without = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4835
4850
|
return placeLayer(without, loc.layer, placement);
|
|
4836
4851
|
}
|
|
4837
4852
|
function withNewIds(layer) {
|
|
@@ -4845,7 +4860,7 @@ function duplicateLayer(layers, id, name) {
|
|
|
4845
4860
|
const copy = withNewIds(loc.layer);
|
|
4846
4861
|
copy.name = _nullishCoalesce(name, () => ( `${loc.layer.name || "Layer"} copy`));
|
|
4847
4862
|
delete copy.locks;
|
|
4848
|
-
return { layers:
|
|
4863
|
+
return { layers: _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _81 => _81.parent, 'optionalAccess', _82 => _82.id]), () => ( null)), loc.index + 1), id: copy.id };
|
|
4849
4864
|
}
|
|
4850
4865
|
function setLayerProperties(layers, id, props) {
|
|
4851
4866
|
const loc = requireLayer(layers, id);
|
|
@@ -4872,7 +4887,7 @@ function setLayerProperties(layers, id, props) {
|
|
|
4872
4887
|
if (props.blend !== void 0) {
|
|
4873
4888
|
if (props.blend === "pass-through") {
|
|
4874
4889
|
if (layer.type !== "group") fail("pass-through is only for groups.");
|
|
4875
|
-
} else if (!
|
|
4890
|
+
} else if (!_chunkCRMAXIUVcjs.isBlendMode.call(void 0, props.blend)) fail(`Unknown blend mode "${props.blend}".`);
|
|
4876
4891
|
next.blend = props.blend;
|
|
4877
4892
|
}
|
|
4878
4893
|
if (props.clipped !== void 0) {
|
|
@@ -4892,7 +4907,7 @@ function setLayerProperties(layers, id, props) {
|
|
|
4892
4907
|
if (props.collapsed) g.collapsed = true;
|
|
4893
4908
|
else delete g.collapsed;
|
|
4894
4909
|
}
|
|
4895
|
-
return
|
|
4910
|
+
return _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
4896
4911
|
}
|
|
4897
4912
|
function groupLayers(layers, ids, name = "Group") {
|
|
4898
4913
|
if (!ids.length) fail("Give at least one layer id to group.");
|
|
@@ -4921,17 +4936,17 @@ function groupLayers(layers, ids, name = "Group") {
|
|
|
4921
4936
|
group.children[0] = c;
|
|
4922
4937
|
}
|
|
4923
4938
|
let out = layers;
|
|
4924
|
-
for (const l of ordered) out =
|
|
4925
|
-
return { layers:
|
|
4939
|
+
for (const l of ordered) out = _chunkT6H3JDGAcjs.mapLayer.call(void 0, out, l.layer.id, () => null);
|
|
4940
|
+
return { layers: _chunkT6H3JDGAcjs.insertLayer.call(void 0, out, group, parent, top - below), id: group.id };
|
|
4926
4941
|
}
|
|
4927
4942
|
function ungroupLayer(layers, id) {
|
|
4928
4943
|
const loc = requireLayer(layers, id);
|
|
4929
4944
|
if (loc.layer.type !== "group") fail(`Layer "${id}" is not a group.`);
|
|
4930
4945
|
requireUnlocked(loc.layer, "all", "ungroup it");
|
|
4931
4946
|
const group = loc.layer;
|
|
4932
|
-
let out =
|
|
4947
|
+
let out = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
4933
4948
|
group.children.forEach((c, i) => {
|
|
4934
|
-
out =
|
|
4949
|
+
out = _chunkT6H3JDGAcjs.insertLayer.call(void 0, out, c, _nullishCoalesce(_optionalChain([loc, 'access', _91 => _91.parent, 'optionalAccess', _92 => _92.id]), () => ( null)), loc.index + i);
|
|
4935
4950
|
});
|
|
4936
4951
|
return { layers: out, ids: group.children.map((c) => c.id) };
|
|
4937
4952
|
}
|
|
@@ -4941,12 +4956,12 @@ function offsetLayer(layers, id, offset) {
|
|
|
4941
4956
|
requireUnlocked(loc.layer, "position", "move it");
|
|
4942
4957
|
if (!Number.isFinite(offset.x) || !Number.isFinite(offset.y)) fail("x and y must be numbers.");
|
|
4943
4958
|
const layer = loc.layer;
|
|
4944
|
-
return
|
|
4959
|
+
return _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, offset: { x: Math.round(offset.x), y: Math.round(offset.y) } }));
|
|
4945
4960
|
}
|
|
4946
4961
|
function setLayerMask(layers, id, mask) {
|
|
4947
4962
|
const loc = requireLayer(layers, id);
|
|
4948
4963
|
requireUnlocked(loc.layer, "all", "change its mask");
|
|
4949
|
-
return
|
|
4964
|
+
return _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, (l) => {
|
|
4950
4965
|
const next = { ...l };
|
|
4951
4966
|
if (mask) next.mask = mask;
|
|
4952
4967
|
else delete next.mask;
|
|
@@ -4985,7 +5000,7 @@ function requirePixelLayer(layers, id) {
|
|
|
4985
5000
|
function addLayerFilter(layers, id, filter) {
|
|
4986
5001
|
const layer = requirePixelLayer(layers, id);
|
|
4987
5002
|
if (_optionalChain([layer, 'access', _93 => _93.filters, 'optionalAccess', _94 => _94.some, 'call', _95 => _95((f) => f.kind === filter.kind)])) fail(`Layer "${id}" already has a ${filter.kind} filter; change it with update_layer_filter.`);
|
|
4988
|
-
return
|
|
5003
|
+
return _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters: [..._nullishCoalesce(layer.filters, () => ( [])), filter] }));
|
|
4989
5004
|
}
|
|
4990
5005
|
function updateLayerFilter(layers, id, filterId, changes) {
|
|
4991
5006
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -4996,7 +5011,7 @@ function updateLayerFilter(layers, id, filterId, changes) {
|
|
|
4996
5011
|
const merged = normalizeFilter({ ...current, ...changes, kind: current.kind }, current.id);
|
|
4997
5012
|
const filters = [...layer.filters];
|
|
4998
5013
|
filters[i] = merged;
|
|
4999
|
-
return
|
|
5014
|
+
return _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => ({ ...layer, filters }));
|
|
5000
5015
|
}
|
|
5001
5016
|
function removeLayerFilter(layers, id, filterId) {
|
|
5002
5017
|
const layer = requirePixelLayer(layers, id);
|
|
@@ -5005,7 +5020,7 @@ function removeLayerFilter(layers, id, filterId) {
|
|
|
5005
5020
|
const next = { ...layer };
|
|
5006
5021
|
if (filters.length) next.filters = filters;
|
|
5007
5022
|
else delete next.filters;
|
|
5008
|
-
return
|
|
5023
|
+
return _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
5009
5024
|
}
|
|
5010
5025
|
function requireEffectLayer(layers, id, action) {
|
|
5011
5026
|
const layer = requireLayer(layers, id).layer;
|
|
@@ -5020,7 +5035,7 @@ function guard(fn) {
|
|
|
5020
5035
|
try {
|
|
5021
5036
|
return fn();
|
|
5022
5037
|
} catch (e) {
|
|
5023
|
-
if (e instanceof
|
|
5038
|
+
if (e instanceof _chunkT6H3JDGAcjs.LayerEffectError) fail(e.message);
|
|
5024
5039
|
throw e;
|
|
5025
5040
|
}
|
|
5026
5041
|
}
|
|
@@ -5028,20 +5043,20 @@ function setLayerEffects(layers, id, effects) {
|
|
|
5028
5043
|
const layer = requireEffectLayer(layers, id, "change its effects");
|
|
5029
5044
|
const next = { ...layer };
|
|
5030
5045
|
if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) {
|
|
5031
|
-
guard(() =>
|
|
5046
|
+
guard(() => _chunkT6H3JDGAcjs.validateLayerEffects.call(void 0, effects));
|
|
5032
5047
|
next.effects = effects;
|
|
5033
5048
|
} else delete next.effects;
|
|
5034
|
-
return
|
|
5049
|
+
return _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => next);
|
|
5035
5050
|
}
|
|
5036
5051
|
function addLayerEffect(layers, id, kind, params = {}, index) {
|
|
5037
|
-
if (!
|
|
5052
|
+
if (!_chunkT6H3JDGAcjs.isLayerEffectKind.call(void 0, kind)) fail(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkT6H3JDGAcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
5038
5053
|
const layer = requireEffectLayer(layers, id, "add effects");
|
|
5039
5054
|
const current = layerEffectsOf(layer);
|
|
5040
5055
|
const ids = new Set(current.items.map((e) => e.id));
|
|
5041
|
-
let effectId =
|
|
5042
|
-
while (ids.has(effectId)) effectId =
|
|
5056
|
+
let effectId = _chunkT6H3JDGAcjs.newEffectId.call(void 0, );
|
|
5057
|
+
while (ids.has(effectId)) effectId = _chunkT6H3JDGAcjs.newEffectId.call(void 0, );
|
|
5043
5058
|
const { id: _ignored, kind: _kind, ...rest } = params;
|
|
5044
|
-
const effect = guard(() =>
|
|
5059
|
+
const effect = guard(() => _chunkT6H3JDGAcjs.mergeLayerEffect.call(void 0, _chunkT6H3JDGAcjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
|
|
5045
5060
|
const items = [...current.items];
|
|
5046
5061
|
const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
|
|
5047
5062
|
items.splice(at, 0, effect);
|
|
@@ -5058,7 +5073,7 @@ function updateLayerEffect(layers, id, effectId, changes) {
|
|
|
5058
5073
|
const i = requireEffect(layer, effectId);
|
|
5059
5074
|
const current = layer.effects;
|
|
5060
5075
|
const items = [...current.items];
|
|
5061
|
-
items[i] = guard(() =>
|
|
5076
|
+
items[i] = guard(() => _chunkT6H3JDGAcjs.mergeLayerEffect.call(void 0, items[i], changes));
|
|
5062
5077
|
return setLayerEffects(layers, id, { ...current, items });
|
|
5063
5078
|
}
|
|
5064
5079
|
function removeLayerEffect(layers, id, effectId) {
|
|
@@ -5081,7 +5096,7 @@ function setLayerEffectsEnabled(layers, id, enabled, scale) {
|
|
|
5081
5096
|
function parseBlend(value, allowPassThrough = false) {
|
|
5082
5097
|
if (value === void 0) return void 0;
|
|
5083
5098
|
if (value === "pass-through" && allowPassThrough) return value;
|
|
5084
|
-
if (!
|
|
5099
|
+
if (!_chunkCRMAXIUVcjs.isBlendMode.call(void 0, value)) fail(`Unknown blend mode "${String(value)}".`);
|
|
5085
5100
|
return value;
|
|
5086
5101
|
}
|
|
5087
5102
|
function unionRect(a, b) {
|
|
@@ -5993,9 +6008,9 @@ function packbitsDecodeInto(src, expected, out, at) {
|
|
|
5993
6008
|
function inflateChecked(data, expected) {
|
|
5994
6009
|
let out;
|
|
5995
6010
|
try {
|
|
5996
|
-
out =
|
|
6011
|
+
out = _chunkT6H3JDGAcjs.inflate.call(void 0, data, { maxOutput: expected + (1 << 20), sizeHint: expected, verify: false });
|
|
5997
6012
|
} catch (e) {
|
|
5998
|
-
throw new PsdError(`ZIP channel data: ${e instanceof
|
|
6013
|
+
throw new PsdError(`ZIP channel data: ${e instanceof _chunkT6H3JDGAcjs.ZlibError || e instanceof Error ? e.message : String(e)}`);
|
|
5999
6014
|
}
|
|
6000
6015
|
if (out.length < expected) throw new PsdError(`ZIP stream produced ${out.length} of ${expected} bytes.`);
|
|
6001
6016
|
return out.length === expected ? out : out.subarray(0, expected);
|
|
@@ -6744,11 +6759,11 @@ function safeSize(ctx, rect, name) {
|
|
|
6744
6759
|
}
|
|
6745
6760
|
function recordPixels(ctx, rec, name) {
|
|
6746
6761
|
const { width, height } = safeSize(ctx, rec.rect, name);
|
|
6747
|
-
if (!width || !height || ctx.skipPixels) return
|
|
6762
|
+
if (!width || !height || ctx.skipPixels) return _chunkCRMAXIUVcjs.emptySurface.call(void 0, 4);
|
|
6748
6763
|
const ids = [...Array.from({ length: ctx.colorCount }, (_, i) => i), CHANNEL_ALPHA];
|
|
6749
6764
|
const planes = ids.map((id) => rec.channels.some((c) => c.id === id) ? _nullishCoalesce(decodeOr(ctx, rec, id, name), () => ( null)) : void 0);
|
|
6750
|
-
if (planes.some((p) => p === null)) return
|
|
6751
|
-
if (planes.every((p) => p === void 0)) return
|
|
6765
|
+
if (planes.some((p) => p === null)) return _chunkCRMAXIUVcjs.emptySurface.call(void 0, 4);
|
|
6766
|
+
if (planes.every((p) => p === void 0)) return _chunkCRMAXIUVcjs.emptySurface.call(void 0, 4);
|
|
6752
6767
|
const data = toRgba8({
|
|
6753
6768
|
width,
|
|
6754
6769
|
height,
|
|
@@ -6758,7 +6773,7 @@ function recordPixels(ctx, rec, name) {
|
|
|
6758
6773
|
alpha: planes[ctx.colorCount],
|
|
6759
6774
|
palette: ctx.palette
|
|
6760
6775
|
});
|
|
6761
|
-
return
|
|
6776
|
+
return _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, rec.rect.left, rec.rect.top);
|
|
6762
6777
|
}
|
|
6763
6778
|
function recordMask(ctx, rec, name) {
|
|
6764
6779
|
const m = rec.mask;
|
|
@@ -6769,11 +6784,11 @@ function recordMask(ctx, rec, name) {
|
|
|
6769
6784
|
const rect = useReal ? m.real.rect : m.rect;
|
|
6770
6785
|
const def = (useReal ? m.real.background : m.defaultColor) >= 128 ? 255 : 0;
|
|
6771
6786
|
const flags = useReal ? m.real.flags : m.flags;
|
|
6772
|
-
let surface =
|
|
6787
|
+
let surface = _chunkCRMAXIUVcjs.emptySurface.call(void 0, 1, def);
|
|
6773
6788
|
const { width, height } = safeSize(ctx, rect, name);
|
|
6774
6789
|
if (width && height && !ctx.skipPixels) {
|
|
6775
6790
|
const plane = decodeOr(ctx, rec, id, name);
|
|
6776
|
-
if (plane) surface =
|
|
6791
|
+
if (plane) surface = _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data: toMask8(plane, width, height, ctx.file.header.depth) }, 1, rect.left, rect.top, def);
|
|
6777
6792
|
}
|
|
6778
6793
|
const mask = { surface, defaultValue: def };
|
|
6779
6794
|
if (m.userDensity !== void 0 && m.userDensity < 255) mask.density = percent(m.userDensity);
|
|
@@ -6910,7 +6925,7 @@ function mergedLayer(ctx) {
|
|
|
6910
6925
|
visible: true,
|
|
6911
6926
|
opacity: 1,
|
|
6912
6927
|
blend: "normal",
|
|
6913
|
-
surface:
|
|
6928
|
+
surface: _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4),
|
|
6914
6929
|
offset: { x: 0, y: 0 }
|
|
6915
6930
|
};
|
|
6916
6931
|
}
|
|
@@ -6996,13 +7011,13 @@ function rleChannel(id, plane, width, height, psb) {
|
|
|
6996
7011
|
var emptyChannel = (id) => ({ id, compression: 0, data: new Uint8Array(0) });
|
|
6997
7012
|
function maskChannel(mask, ox, oy, psb) {
|
|
6998
7013
|
if (mask.source) throw new PsdError("A parametric mask must be baked before export.");
|
|
6999
|
-
const bounds =
|
|
7014
|
+
const bounds = _chunkCRMAXIUVcjs.contentBounds.call(void 0, mask.surface);
|
|
7000
7015
|
const def = mask.defaultValue;
|
|
7001
7016
|
const m = { rect: EMPTY_RECT, defaultColor: def, flags: mask.enabled === false ? MASK_FLAG_DISABLED : 0 };
|
|
7002
7017
|
if ((_nullishCoalesce(mask.density, () => ( 1))) < 1) m.userDensity = Math.round(Math.max(0, _nullishCoalesce(mask.density, () => ( 1))) * 255);
|
|
7003
7018
|
if ((_nullishCoalesce(mask.feather, () => ( 0))) > 0) m.userFeather = mask.feather;
|
|
7004
7019
|
if (!bounds) return { channel: emptyChannel(CHANNEL_USER_MASK), mask: m };
|
|
7005
|
-
const plane =
|
|
7020
|
+
const plane = _chunkCRMAXIUVcjs.readRegion.call(void 0, mask.surface, bounds);
|
|
7006
7021
|
m.rect = toRect({ ...bounds, x: bounds.x + ox, y: bounds.y + oy });
|
|
7007
7022
|
return { channel: rleChannel(CHANNEL_USER_MASK, new Uint8Array(plane.buffer, plane.byteOffset, plane.length), bounds.width, bounds.height, psb), mask: m };
|
|
7008
7023
|
}
|
|
@@ -7088,10 +7103,10 @@ function exportPsd(input) {
|
|
|
7088
7103
|
extra.push({ key: "iOpa", data: Uint8Array.from([Math.round(Math.max(0, layer.fillOpacity) * 255), 0, 0, 0]) });
|
|
7089
7104
|
}
|
|
7090
7105
|
const rec = { ...common(layer, extra), rect: EMPTY_RECT, channels: [], blendKey: _nullishCoalesce(BLEND_TO_PSD[layer.blend], () => ( "norm")) };
|
|
7091
|
-
const bounds =
|
|
7106
|
+
const bounds = _chunkCRMAXIUVcjs.contentBounds.call(void 0, layer.surface);
|
|
7092
7107
|
if (bounds) {
|
|
7093
7108
|
const n2 = bounds.width * bounds.height;
|
|
7094
|
-
const [r2, g2, b2, a2] = rgbaToPlanes(
|
|
7109
|
+
const [r2, g2, b2, a2] = rgbaToPlanes(_chunkCRMAXIUVcjs.readRegion.call(void 0, layer.surface, bounds), n2);
|
|
7095
7110
|
rec.rect = toRect({ ...bounds, x: bounds.x + layer.offset.x, y: bounds.y + layer.offset.y });
|
|
7096
7111
|
rec.channels = [
|
|
7097
7112
|
rleChannel(CHANNEL_ALPHA, a2, bounds.width, bounds.height, psb),
|
|
@@ -7162,33 +7177,40 @@ function paintCoverageInto(base, coverage, apply, rects) {
|
|
|
7162
7177
|
const tiles = new Map(base.tiles);
|
|
7163
7178
|
const done = /* @__PURE__ */ new Set();
|
|
7164
7179
|
for (const r of rects) {
|
|
7165
|
-
for (const t of
|
|
7166
|
-
const key =
|
|
7180
|
+
for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, { x: r.x - apply.offset.x, y: r.y - apply.offset.y, width: r.width, height: r.height })) {
|
|
7181
|
+
const key = _chunkCRMAXIUVcjs.tileKey.call(void 0, t.tx, t.ty);
|
|
7167
7182
|
if (done.has(key)) continue;
|
|
7168
7183
|
done.add(key);
|
|
7169
7184
|
const src = _nullishCoalesce(_optionalChain([base, 'access', _123 => _123.tiles, 'access', _124 => _124.get, 'call', _125 => _125(key), 'optionalAccess', _126 => _126.data]), () => ( defaultTile(base)));
|
|
7170
|
-
const data =
|
|
7171
|
-
const tile =
|
|
7185
|
+
const data = _chunkZZOTHJ4Kcjs.applyStrokeToTile.call(void 0, coverage, src, base.channels, t.tx, t.ty, apply);
|
|
7186
|
+
const tile = _chunkCRMAXIUVcjs.finishTile.call(void 0, data, base.channels, base.defaultValue);
|
|
7172
7187
|
if (tile) tiles.set(key, tile);
|
|
7173
7188
|
else tiles.delete(key);
|
|
7174
7189
|
}
|
|
7175
7190
|
}
|
|
7176
|
-
return new (0,
|
|
7191
|
+
return new (0, _chunkCRMAXIUVcjs.TiledSurface)(base.channels, tiles, base.defaultValue);
|
|
7177
7192
|
}
|
|
7178
7193
|
function defaultTile(s) {
|
|
7179
|
-
const d = new Uint8ClampedArray(
|
|
7194
|
+
const d = new Uint8ClampedArray(_chunkCRMAXIUVcjs.TILE * _chunkCRMAXIUVcjs.TILE * s.channels);
|
|
7180
7195
|
if (s.defaultValue) d.fill(s.defaultValue);
|
|
7181
7196
|
return d;
|
|
7182
7197
|
}
|
|
7183
7198
|
var PaintStrokeSession = (_class6 = class {
|
|
7184
|
-
constructor(controller, target, stroke, apply) {;_class6.prototype.__init28.call(this);_class6.prototype.__init29.call(this);_class6.prototype.__init30.call(this);
|
|
7199
|
+
constructor(controller, target, stroke, apply) {;_class6.prototype.__init28.call(this);_class6.prototype.__init29.call(this);_class6.prototype.__init30.call(this);_class6.prototype.__init31.call(this);_class6.prototype.__init32.call(this);
|
|
7185
7200
|
this.controller = controller;
|
|
7186
7201
|
this.target = target;
|
|
7187
|
-
this.stroke = stroke;
|
|
7188
7202
|
this.apply = apply;
|
|
7189
7203
|
this.before = controller._captureForStroke();
|
|
7190
7204
|
this.base = target.surface;
|
|
7191
7205
|
this.live = new Map(this.base.tiles);
|
|
7206
|
+
if (stroke instanceof _chunkZZOTHJ4Kcjs.StrokeCoverage) {
|
|
7207
|
+
this.stroke = stroke;
|
|
7208
|
+
this.mixer = null;
|
|
7209
|
+
} else {
|
|
7210
|
+
this.stroke = null;
|
|
7211
|
+
this.mixer = stroke.create(this.mixerPixels());
|
|
7212
|
+
this.mixerInit = stroke;
|
|
7213
|
+
}
|
|
7192
7214
|
}
|
|
7193
7215
|
|
|
7194
7216
|
|
|
@@ -7196,10 +7218,34 @@ var PaintStrokeSession = (_class6 = class {
|
|
|
7196
7218
|
|
|
7197
7219
|
|
|
7198
7220
|
|
|
7199
|
-
|
|
7200
7221
|
__init28() {this.touched = /* @__PURE__ */ new Set()}
|
|
7201
|
-
|
|
7202
|
-
|
|
7222
|
+
|
|
7223
|
+
|
|
7224
|
+
__init29() {this.mixerInit = null}
|
|
7225
|
+
/** Mixer tiles written since the last update: they get new tile objects so the compositor sees them change. */
|
|
7226
|
+
__init30() {this.fresh = /* @__PURE__ */ new Set()}
|
|
7227
|
+
__init31() {this.last = null}
|
|
7228
|
+
__init32() {this.closed = false}
|
|
7229
|
+
/** The live pixels a mixer stroke reads and writes; base tiles are copied on first write. */
|
|
7230
|
+
mixerPixels() {
|
|
7231
|
+
const a = this.apply;
|
|
7232
|
+
return {
|
|
7233
|
+
offset: a.offset,
|
|
7234
|
+
lockTransparency: a.lockTransparency,
|
|
7235
|
+
selection: a.selection,
|
|
7236
|
+
readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _127 => _127.live, 'access', _128 => _128.get, 'call', _129 => _129(_chunkCRMAXIUVcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _130 => _130.data]), () => ( (this.base.defaultValue ? defaultTile(this.base) : null))),
|
|
7237
|
+
writeTile: (tx, ty) => {
|
|
7238
|
+
const key = _chunkCRMAXIUVcjs.tileKey.call(void 0, tx, ty);
|
|
7239
|
+
if (!this.touched.has(key)) {
|
|
7240
|
+
const src = _nullishCoalesce(_optionalChain([this, 'access', _131 => _131.base, 'access', _132 => _132.tiles, 'access', _133 => _133.get, 'call', _134 => _134(key), 'optionalAccess', _135 => _135.data]), () => ( defaultTile(this.base)));
|
|
7241
|
+
this.live.set(key, { data: new Uint8ClampedArray(src), uniform: null });
|
|
7242
|
+
this.touched.add(key);
|
|
7243
|
+
}
|
|
7244
|
+
this.fresh.add(key);
|
|
7245
|
+
return this.live.get(key).data;
|
|
7246
|
+
}
|
|
7247
|
+
};
|
|
7248
|
+
}
|
|
7203
7249
|
get layerId() {
|
|
7204
7250
|
return this.target.id;
|
|
7205
7251
|
}
|
|
@@ -7207,48 +7253,59 @@ var PaintStrokeSession = (_class6 = class {
|
|
|
7207
7253
|
push(points) {
|
|
7208
7254
|
if (this.closed || !points.length) return;
|
|
7209
7255
|
this.last = points[points.length - 1];
|
|
7210
|
-
this.update(this.stroke.push(points));
|
|
7256
|
+
this.update(this.mixer ? this.mixer.push(points) : this.stroke.push(points));
|
|
7211
7257
|
}
|
|
7212
7258
|
update(rects) {
|
|
7213
7259
|
if (!rects.length) return;
|
|
7214
7260
|
const ch = this.base.channels;
|
|
7261
|
+
if (this.mixer) {
|
|
7262
|
+
for (const key of this.fresh) this.live.set(key, { data: this.live.get(key).data, uniform: null });
|
|
7263
|
+
this.fresh.clear();
|
|
7264
|
+
this.controller._strokeUpdate(this.target.id, this.target.channel, new (0, _chunkCRMAXIUVcjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
|
|
7265
|
+
return;
|
|
7266
|
+
}
|
|
7267
|
+
const stroke = this.stroke;
|
|
7215
7268
|
const regions = /* @__PURE__ */ new Map();
|
|
7216
7269
|
for (const r of rects) {
|
|
7217
|
-
for (const t of
|
|
7218
|
-
const key =
|
|
7270
|
+
for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, { x: r.x - this.apply.offset.x, y: r.y - this.apply.offset.y, width: r.width, height: r.height })) {
|
|
7271
|
+
const key = _chunkCRMAXIUVcjs.tileKey.call(void 0, t.tx, t.ty);
|
|
7219
7272
|
const cur = regions.get(key);
|
|
7220
7273
|
regions.set(key, { tx: t.tx, ty: t.ty, r: cur ? unionRect(cur.r, r) : r });
|
|
7221
7274
|
}
|
|
7222
7275
|
}
|
|
7223
7276
|
for (const [key, { tx, ty, r }] of regions) {
|
|
7224
|
-
const src = _nullishCoalesce(_optionalChain([this, 'access',
|
|
7225
|
-
const prev = this.touched.has(key) ? _optionalChain([this, 'access',
|
|
7277
|
+
const src = _nullishCoalesce(_optionalChain([this, 'access', _136 => _136.base, 'access', _137 => _137.tiles, 'access', _138 => _138.get, 'call', _139 => _139(key), 'optionalAccess', _140 => _140.data]), () => ( defaultTile(this.base)));
|
|
7278
|
+
const prev = this.touched.has(key) ? _optionalChain([this, 'access', _141 => _141.live, 'access', _142 => _142.get, 'call', _143 => _143(key), 'optionalAccess', _144 => _144.data]) : void 0;
|
|
7226
7279
|
this.touched.add(key);
|
|
7227
|
-
const data =
|
|
7280
|
+
const data = _chunkZZOTHJ4Kcjs.applyStrokeToTile.call(void 0, stroke.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
|
|
7228
7281
|
this.live.set(key, { data, uniform: null });
|
|
7229
7282
|
}
|
|
7230
|
-
this.controller._strokeUpdate(this.target.id, this.target.channel, new (0,
|
|
7283
|
+
this.controller._strokeUpdate(this.target.id, this.target.channel, new (0, _chunkCRMAXIUVcjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
|
|
7231
7284
|
}
|
|
7232
7285
|
/** Finishes the stroke (one undo step) and returns what changed. */
|
|
7233
7286
|
end() {
|
|
7234
7287
|
if (this.closed) throw new LayerOperationError("This stroke has already ended.");
|
|
7235
|
-
|
|
7288
|
+
const last = _nullishCoalesce(this.last, () => ( void 0));
|
|
7289
|
+
this.update(this.mixer ? this.mixer.finish(last) : this.stroke.finish(last));
|
|
7236
7290
|
this.closed = true;
|
|
7237
7291
|
const ch = this.base.channels;
|
|
7238
7292
|
const tiles = new Map(this.base.tiles);
|
|
7239
7293
|
let changed = false;
|
|
7240
7294
|
for (const key of this.touched) {
|
|
7241
7295
|
const live = this.live.get(key);
|
|
7242
|
-
const tile =
|
|
7296
|
+
const tile = _chunkCRMAXIUVcjs.finishTile.call(void 0, live.data, ch, this.base.defaultValue);
|
|
7243
7297
|
const prev = this.base.tiles.get(key);
|
|
7244
7298
|
if (tile) tiles.set(key, tile);
|
|
7245
7299
|
else tiles.delete(key);
|
|
7246
7300
|
if (!sameTile(prev, tile)) changed = true;
|
|
7247
7301
|
}
|
|
7248
|
-
const surface = changed ? new (0,
|
|
7302
|
+
const surface = changed ? new (0, _chunkCRMAXIUVcjs.TiledSurface)(ch, tiles, this.base.defaultValue) : null;
|
|
7303
|
+
const mixerLoad = this.mixer ? this.mixerInit.end(this.mixer.load) : void 0;
|
|
7249
7304
|
this.controller._strokeCommit(this.before, this.target.id, this.target.channel, surface);
|
|
7250
|
-
const b = this.stroke.coverage.bounds;
|
|
7251
|
-
|
|
7305
|
+
const b = this.mixer ? this.mixer.bounds : this.stroke.coverage.bounds;
|
|
7306
|
+
const result = { layerId: this.target.id, channel: this.target.channel, bounds: changed ? b : null, dabs: (_nullishCoalesce(this.mixer, () => ( this.stroke))).dabCount };
|
|
7307
|
+
if (mixerLoad) result.mixerLoad = mixerLoad;
|
|
7308
|
+
return result;
|
|
7252
7309
|
}
|
|
7253
7310
|
/** Abandons the stroke and restores the layer. */
|
|
7254
7311
|
cancel() {
|
|
@@ -7293,14 +7350,14 @@ function migrateSerializedImageEditorState(data) {
|
|
|
7293
7350
|
const legacy = data;
|
|
7294
7351
|
const adjustments = normalizeStoredAdjustments(legacy.adjustments);
|
|
7295
7352
|
return {
|
|
7296
|
-
version: _optionalChain([adjustments, 'access',
|
|
7353
|
+
version: _optionalChain([adjustments, 'access', _145 => _145.layers, 'optionalAccess', _146 => _146.length]) ? 2 : 1,
|
|
7297
7354
|
crop: legacy.crop ? { ...legacy.crop } : null,
|
|
7298
7355
|
transform: { ...DEFAULT_TRANSFORM, ...legacy.transform },
|
|
7299
7356
|
adjustments: serializeAdjustments(adjustments),
|
|
7300
7357
|
depthMask: {
|
|
7301
7358
|
...DEFAULT_DEPTH_MASK,
|
|
7302
7359
|
...legacy.depthMask,
|
|
7303
|
-
depthRange: [..._nullishCoalesce(_optionalChain([legacy, 'access',
|
|
7360
|
+
depthRange: [..._nullishCoalesce(_optionalChain([legacy, 'access', _147 => _147.depthMask, 'optionalAccess', _148 => _148.depthRange]), () => ( DEFAULT_DEPTH_MASK.depthRange))]
|
|
7304
7361
|
},
|
|
7305
7362
|
annotations: JSON.parse(JSON.stringify(_nullishCoalesce(legacy.annotations, () => ( [])))),
|
|
7306
7363
|
...legacy.selection ? { selection: { ...legacy.selection } } : {}
|
|
@@ -7332,26 +7389,26 @@ var DEVELOP_KEYS = ["brightness", "contrast", "saturation", "exposure", "tempera
|
|
|
7332
7389
|
var ImageEditorController = (_class7 = class {
|
|
7333
7390
|
|
|
7334
7391
|
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7392
|
+
__init33() {this.imageElement = null}
|
|
7393
|
+
__init34() {this.listeners = /* @__PURE__ */ new Set()}
|
|
7394
|
+
__init35() {this.histogramListeners = /* @__PURE__ */ new Set()}
|
|
7338
7395
|
|
|
7339
7396
|
// History stacks
|
|
7340
|
-
|
|
7341
|
-
|
|
7397
|
+
__init36() {this.undoStack = []}
|
|
7398
|
+
__init37() {this.redoStack = []}
|
|
7342
7399
|
|
|
7343
7400
|
|
|
7344
|
-
|
|
7401
|
+
__init38() {this.isApplyingHistory = false}
|
|
7345
7402
|
|
|
7346
7403
|
/** Pixels the selection tools sample (host-provided or read back from the source). */
|
|
7347
|
-
|
|
7348
|
-
|
|
7404
|
+
__init39() {this.samplePixels = null}
|
|
7405
|
+
__init40() {this.samplePixelsOverride = false}
|
|
7349
7406
|
/** Decoded source pixels (the Background's surface), by the buffer or element they came from. */
|
|
7350
|
-
|
|
7351
|
-
|
|
7407
|
+
__init41() {this.sourceSurfaces = /* @__PURE__ */ new WeakMap()}
|
|
7408
|
+
__init42() {this.viewKey = []}
|
|
7352
7409
|
/** For `compositePixels` and mask evaluation (the renderer keeps its own for the viewport). */
|
|
7353
|
-
|
|
7354
|
-
constructor(options = {}) {;_class7.prototype.
|
|
7410
|
+
__init43() {this.compositor = new LayerCompositor()}
|
|
7411
|
+
constructor(options = {}) {;_class7.prototype.__init33.call(this);_class7.prototype.__init34.call(this);_class7.prototype.__init35.call(this);_class7.prototype.__init36.call(this);_class7.prototype.__init37.call(this);_class7.prototype.__init38.call(this);_class7.prototype.__init39.call(this);_class7.prototype.__init40.call(this);_class7.prototype.__init41.call(this);_class7.prototype.__init42.call(this);_class7.prototype.__init43.call(this);_class7.prototype.__init44.call(this);_class7.prototype.__init45.call(this);_class7.prototype.__init46.call(this);_class7.prototype.__init47.call(this);_class7.prototype.__init48.call(this);_class7.prototype.__init49.call(this);_class7.prototype.__init50.call(this);_class7.prototype.__init51.call(this);
|
|
7355
7412
|
this.maxHistoryDepth = _nullishCoalesce(options.maxHistoryDepth, () => ( 50));
|
|
7356
7413
|
this.maxHistoryBytes = _nullishCoalesce(options.maxHistoryBytes, () => ( 512 * 1024 * 1024));
|
|
7357
7414
|
this.onStateChange = options.onStateChange;
|
|
@@ -7384,7 +7441,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7384
7441
|
activeLayerId: null,
|
|
7385
7442
|
activeTarget: "pixels",
|
|
7386
7443
|
outputOpacity: 1,
|
|
7387
|
-
paint: { brush: { ...
|
|
7444
|
+
paint: { brush: { ..._chunkZZOTHJ4Kcjs.DEFAULT_BRUSH }, foreground: "#000000", background: "#ffffff", mixer: { ..._chunkZZOTHJ4Kcjs.DEFAULT_MIXER }, mixerLoad: _chunkZZOTHJ4Kcjs.EMPTY_MIXER_LOAD },
|
|
7388
7445
|
fit: _nullishCoalesce(options.fit, () => ( "margin"))
|
|
7389
7446
|
};
|
|
7390
7447
|
if (options.image instanceof Object && "width" in options.image) {
|
|
@@ -7396,7 +7453,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7396
7453
|
};
|
|
7397
7454
|
}
|
|
7398
7455
|
this.applyStored(_nullishCoalesce(options.initialState, () => ( {})));
|
|
7399
|
-
if (_optionalChain([options, 'access',
|
|
7456
|
+
if (_optionalChain([options, 'access', _149 => _149.initialState, 'optionalAccess', _150 => _150.selection])) {
|
|
7400
7457
|
try {
|
|
7401
7458
|
this.state.selection = normalizeSelection(deserializeSelection(options.initialState.selection));
|
|
7402
7459
|
} catch (e17) {
|
|
@@ -7473,13 +7530,13 @@ var ImageEditorController = (_class7 = class {
|
|
|
7473
7530
|
* Where layer pixels changed since the last viewport render, when only strokes changed them
|
|
7474
7531
|
* (the renderer then recomposites just those rectangles); `'all'` after any other change.
|
|
7475
7532
|
*/
|
|
7476
|
-
|
|
7533
|
+
__init44() {this.pendingDirty = "all"}
|
|
7477
7534
|
notify(strokeRects) {
|
|
7478
7535
|
if (strokeRects && this.pendingDirty !== "all") this.pendingDirty.push(...strokeRects);
|
|
7479
7536
|
else if (!strokeRects) this.pendingDirty = "all";
|
|
7480
7537
|
this.syncViews();
|
|
7481
7538
|
const currentState = { ...this.state };
|
|
7482
|
-
_optionalChain([this, 'access',
|
|
7539
|
+
_optionalChain([this, 'access', _151 => _151.onStateChange, 'optionalCall', _152 => _152(currentState)]);
|
|
7483
7540
|
this.listeners.forEach((l) => l(currentState));
|
|
7484
7541
|
}
|
|
7485
7542
|
/** Recomputes the compatibility views (`adjustments`, `depthMask`, `annotations`) when the stack changed. */
|
|
@@ -7687,7 +7744,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7687
7744
|
return this.state.layers;
|
|
7688
7745
|
}
|
|
7689
7746
|
getLayer(id) {
|
|
7690
|
-
return _optionalChain([
|
|
7747
|
+
return _optionalChain([_chunkT6H3JDGAcjs.findLayer.call(void 0, this.state.layers, id), 'optionalAccess', _153 => _153.layer]);
|
|
7691
7748
|
}
|
|
7692
7749
|
/** The active layer, or `undefined`. */
|
|
7693
7750
|
getActiveLayer() {
|
|
@@ -7700,7 +7757,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7700
7757
|
setActiveLayer(id, target = "pixels") {
|
|
7701
7758
|
if (id !== null && !this.getLayer(id)) return false;
|
|
7702
7759
|
const layer = id ? this.getLayer(id) : void 0;
|
|
7703
|
-
const t = target === "mask" && _optionalChain([layer, 'optionalAccess',
|
|
7760
|
+
const t = target === "mask" && _optionalChain([layer, 'optionalAccess', _154 => _154.mask]) ? "mask" : "pixels";
|
|
7704
7761
|
if (this.state.activeLayerId === id && this.state.activeTarget === t) return true;
|
|
7705
7762
|
this.state.activeLayerId = id;
|
|
7706
7763
|
this.state.activeTarget = t;
|
|
@@ -7715,11 +7772,11 @@ var ImageEditorController = (_class7 = class {
|
|
|
7715
7772
|
const layer = this.getLayer(id);
|
|
7716
7773
|
if (!layer || layer.type !== "pixel") return null;
|
|
7717
7774
|
const surface = this.surfaceOf(layer);
|
|
7718
|
-
const b =
|
|
7775
|
+
const b = _chunkCRMAXIUVcjs.contentBounds.call(void 0, surface);
|
|
7719
7776
|
if (!b) return null;
|
|
7720
|
-
return { x: b.x + layer.offset.x, y: b.y + layer.offset.y, width: b.width, height: b.height, data:
|
|
7777
|
+
return { x: b.x + layer.offset.x, y: b.y + layer.offset.y, width: b.width, height: b.height, data: _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, b) };
|
|
7721
7778
|
}
|
|
7722
|
-
|
|
7779
|
+
__init45() {this.boundsCache = /* @__PURE__ */ new WeakMap()}
|
|
7723
7780
|
/**
|
|
7724
7781
|
* Document bounds of a layer's non-transparent pixels (pixel layers; the Background's source
|
|
7725
7782
|
* included), or `null` for an empty or non-pixel layer.
|
|
@@ -7730,7 +7787,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7730
7787
|
const surface = this.surfaceOf(layer);
|
|
7731
7788
|
let b = this.boundsCache.get(surface);
|
|
7732
7789
|
if (b === void 0) {
|
|
7733
|
-
b =
|
|
7790
|
+
b = _chunkCRMAXIUVcjs.contentBounds.call(void 0, surface);
|
|
7734
7791
|
this.boundsCache.set(surface, b);
|
|
7735
7792
|
}
|
|
7736
7793
|
return b ? { x: b.x + layer.offset.x, y: b.y + layer.offset.y, width: b.width, height: b.height } : null;
|
|
@@ -7746,7 +7803,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7746
7803
|
let layers = this.state.layers;
|
|
7747
7804
|
if (options.layerIds) {
|
|
7748
7805
|
const keep = new Set(options.layerIds);
|
|
7749
|
-
layers =
|
|
7806
|
+
layers = _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers).filter((l) => keep.has(l.id) && l.type !== "group");
|
|
7750
7807
|
}
|
|
7751
7808
|
const data = this.compositor.composite(layers, r, this.compositorSources());
|
|
7752
7809
|
return { width: r.width, height: r.height, data };
|
|
@@ -7755,8 +7812,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
7755
7812
|
const { width, height } = this.naturalSize;
|
|
7756
7813
|
return { width, height, surfaceOf: (l) => this.surfaceOf(l), version: this.sourceVersion(), globalLight: this.state.globalLight };
|
|
7757
7814
|
}
|
|
7758
|
-
|
|
7759
|
-
|
|
7815
|
+
__init46() {this.sourceIds = /* @__PURE__ */ new WeakMap()}
|
|
7816
|
+
__init47() {this.nextSourceId = 1}
|
|
7760
7817
|
/** Changes whenever the Background's source pixels can have changed. */
|
|
7761
7818
|
sourceVersion() {
|
|
7762
7819
|
const key = this.samplePixelsOverride ? this.samplePixels : _nullishCoalesce(this.imageElement, () => ( this.samplePixels));
|
|
@@ -7782,7 +7839,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7782
7839
|
const fromPixels = (px2) => {
|
|
7783
7840
|
let s = this.sourceSurfaces.get(px2);
|
|
7784
7841
|
if (!s) {
|
|
7785
|
-
s =
|
|
7842
|
+
s = _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, px2, 4);
|
|
7786
7843
|
this.sourceSurfaces.set(px2, s);
|
|
7787
7844
|
}
|
|
7788
7845
|
return s;
|
|
@@ -7797,7 +7854,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7797
7854
|
const decoded2 = this.decodeSource();
|
|
7798
7855
|
if (decoded2) {
|
|
7799
7856
|
if (!this.samplePixelsOverride) this.samplePixels = decoded2;
|
|
7800
|
-
const s =
|
|
7857
|
+
const s = _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, decoded2, 4);
|
|
7801
7858
|
this.sourceSurfaces.set(el, s);
|
|
7802
7859
|
this.sourceSurfaces.set(decoded2, s);
|
|
7803
7860
|
return s;
|
|
@@ -7805,7 +7862,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7805
7862
|
}
|
|
7806
7863
|
return fits ? fromPixels(px) : null;
|
|
7807
7864
|
}
|
|
7808
|
-
|
|
7865
|
+
__init48() {this.opaqueCache = /* @__PURE__ */ new WeakMap()}
|
|
7809
7866
|
/** Whether every source pixel is opaque (some legacy renders depend on it). */
|
|
7810
7867
|
sourceIsOpaque() {
|
|
7811
7868
|
const s = this.sourceSurface();
|
|
@@ -7829,7 +7886,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7829
7886
|
if (!ctx || typeof ctx.getImageData !== "function") return null;
|
|
7830
7887
|
ctx.drawImage(el, 0, 0, width, height);
|
|
7831
7888
|
const data = ctx.getImageData(0, 0, width, height);
|
|
7832
|
-
if (!_optionalChain([data, 'optionalAccess',
|
|
7889
|
+
if (!_optionalChain([data, 'optionalAccess', _155 => _155.data]) || data.data.length < width * height * 4) return null;
|
|
7833
7890
|
return { width, height, data: data.data };
|
|
7834
7891
|
} catch (e19) {
|
|
7835
7892
|
return null;
|
|
@@ -7840,8 +7897,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
7840
7897
|
commitLayers(next, extra, commitToHistory = true) {
|
|
7841
7898
|
if (commitToHistory) this.recordHistory();
|
|
7842
7899
|
this.state.layers = next;
|
|
7843
|
-
_optionalChain([extra, 'optionalCall',
|
|
7844
|
-
if (this.state.activeLayerId && !
|
|
7900
|
+
_optionalChain([extra, 'optionalCall', _156 => _156()]);
|
|
7901
|
+
if (this.state.activeLayerId && !_chunkT6H3JDGAcjs.findLayer.call(void 0, next, this.state.activeLayerId)) {
|
|
7845
7902
|
this.state.activeLayerId = null;
|
|
7846
7903
|
this.state.activeTarget = "pixels";
|
|
7847
7904
|
}
|
|
@@ -7850,7 +7907,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7850
7907
|
/** The default position of a new layer: above the active layer, else the top of the stack. */
|
|
7851
7908
|
newLayerPlacement(placement) {
|
|
7852
7909
|
if (placement.aboveId || placement.belowId || placement.parentId || placement.index !== void 0) return placement;
|
|
7853
|
-
const active = this.state.activeLayerId ?
|
|
7910
|
+
const active = this.state.activeLayerId ? _chunkT6H3JDGAcjs.findLayer.call(void 0, this.state.layers, this.state.activeLayerId) : null;
|
|
7854
7911
|
return active ? { aboveId: active.layer.id } : {};
|
|
7855
7912
|
}
|
|
7856
7913
|
/**
|
|
@@ -7860,24 +7917,24 @@ var ImageEditorController = (_class7 = class {
|
|
|
7860
7917
|
*/
|
|
7861
7918
|
addPixelLayer(init = {}) {
|
|
7862
7919
|
const { width, height } = this.naturalSize;
|
|
7863
|
-
let surface =
|
|
7920
|
+
let surface = _chunkCRMAXIUVcjs.emptySurface.call(void 0, 4);
|
|
7864
7921
|
if (init.pixels) {
|
|
7865
7922
|
const px = init.pixels;
|
|
7866
7923
|
if (!(px.width > 0 && px.height > 0) || px.data.length < px.width * px.height * 4) {
|
|
7867
7924
|
throw new LayerOperationError("pixels must be RGBA with width \xD7 height \xD7 4 bytes.");
|
|
7868
7925
|
}
|
|
7869
|
-
surface =
|
|
7926
|
+
surface = _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, px, 4);
|
|
7870
7927
|
} else if (init.color !== void 0) {
|
|
7871
7928
|
const c = parseColor(init.color);
|
|
7872
|
-
surface =
|
|
7929
|
+
surface = _chunkCRMAXIUVcjs.solidSurface.call(void 0, 4, { x: 0, y: 0, width, height }, _chunkCRMAXIUVcjs.packRgba.call(void 0, c[0], c[1], c[2], c[3]));
|
|
7873
7930
|
}
|
|
7874
7931
|
const blend = parseBlend(init.blend);
|
|
7875
7932
|
if (init.opacity !== void 0 && !(init.opacity >= 0 && init.opacity <= 1)) throw new LayerOperationError("opacity must be from 0 to 1.");
|
|
7876
|
-
const ids = new Set(
|
|
7933
|
+
const ids = new Set(_chunkT6H3JDGAcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.id));
|
|
7877
7934
|
const layer = {
|
|
7878
7935
|
type: "pixel",
|
|
7879
7936
|
id: init.id && !ids.has(init.id) ? init.id : newLayerId(),
|
|
7880
|
-
name: _optionalChain([init, 'access',
|
|
7937
|
+
name: _optionalChain([init, 'access', _157 => _157.name, 'optionalAccess', _158 => _158.trim, 'call', _159 => _159()]) || this.nextLayerName(),
|
|
7881
7938
|
visible: _nullishCoalesce(init.visible, () => ( true)),
|
|
7882
7939
|
opacity: _nullishCoalesce(init.opacity, () => ( 1)),
|
|
7883
7940
|
blend: _nullishCoalesce(blend, () => ( "normal")),
|
|
@@ -7904,23 +7961,23 @@ var ImageEditorController = (_class7 = class {
|
|
|
7904
7961
|
async decodeImage(image) {
|
|
7905
7962
|
const trimmed = image.trim();
|
|
7906
7963
|
let png = null;
|
|
7907
|
-
if (/^data:image\/png/i.test(trimmed)) png = _nullishCoalesce(_optionalChain([
|
|
7964
|
+
if (/^data:image\/png/i.test(trimmed)) png = _nullishCoalesce(_optionalChain([_chunkT6H3JDGAcjs.parseDataUrl.call(void 0, trimmed), 'optionalAccess', _160 => _160.bytes]), () => ( null));
|
|
7908
7965
|
else if (/^[A-Za-z0-9+/=\s]+$/.test(trimmed) && trimmed.length > 16) {
|
|
7909
7966
|
try {
|
|
7910
|
-
const bytes =
|
|
7911
|
-
if (
|
|
7967
|
+
const bytes = _chunkT6H3JDGAcjs.base64ToBytes.call(void 0, trimmed);
|
|
7968
|
+
if (_chunkT6H3JDGAcjs.isPng.call(void 0, bytes)) png = bytes;
|
|
7912
7969
|
} catch (e20) {
|
|
7913
7970
|
png = null;
|
|
7914
7971
|
}
|
|
7915
7972
|
}
|
|
7916
7973
|
if (png) {
|
|
7917
7974
|
try {
|
|
7918
|
-
const d =
|
|
7975
|
+
const d = _chunkT6H3JDGAcjs.decodePng.call(void 0, png);
|
|
7919
7976
|
return { width: d.width, height: d.height, data: d.data };
|
|
7920
7977
|
} catch (e21) {
|
|
7921
7978
|
}
|
|
7922
7979
|
}
|
|
7923
|
-
const src = png ? `data:image/png;base64,${
|
|
7980
|
+
const src = png ? `data:image/png;base64,${_chunkT6H3JDGAcjs.bytesToBase64.call(void 0, png)}` : trimmed;
|
|
7924
7981
|
let img;
|
|
7925
7982
|
try {
|
|
7926
7983
|
img = await this.renderer.imageCache.get(src);
|
|
@@ -7936,7 +7993,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7936
7993
|
return { width: w, height: h, data: data.data };
|
|
7937
7994
|
}
|
|
7938
7995
|
nextLayerName() {
|
|
7939
|
-
const names = new Set(
|
|
7996
|
+
const names = new Set(_chunkT6H3JDGAcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.name));
|
|
7940
7997
|
let n = 1;
|
|
7941
7998
|
while (names.has(`Layer ${n}`)) n++;
|
|
7942
7999
|
return `Layer ${n}`;
|
|
@@ -7953,7 +8010,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7953
8010
|
removeLayer(id) {
|
|
7954
8011
|
const next = removeLayer(this.state.layers, id);
|
|
7955
8012
|
this.commitLayers(next, () => {
|
|
7956
|
-
if (this.state.selectedAnnotationId && !
|
|
8013
|
+
if (this.state.selectedAnnotationId && !_chunkT6H3JDGAcjs.flattenLayers.call(void 0, next).some((l) => l.type === "annotation" && l.annotation.id === this.state.selectedAnnotationId)) {
|
|
7957
8014
|
this.state.selectedAnnotationId = null;
|
|
7958
8015
|
}
|
|
7959
8016
|
});
|
|
@@ -7961,10 +8018,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
7961
8018
|
/** Moves a layer above / below another, or into a group, as one undo step. Returns its new parent and index. */
|
|
7962
8019
|
moveLayer(id, placement) {
|
|
7963
8020
|
const next = moveLayer(this.state.layers, id, placement);
|
|
7964
|
-
const loc =
|
|
7965
|
-
if (next === this.state.layers) return { parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
8021
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, next, id);
|
|
8022
|
+
if (next === this.state.layers) return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _161 => _161.parent, 'optionalAccess', _162 => _162.id]), () => ( null)), index: loc.index };
|
|
7966
8023
|
this.commitLayers(next);
|
|
7967
|
-
return { parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
8024
|
+
return { parentId: _nullishCoalesce(_optionalChain([loc, 'access', _163 => _163.parent, 'optionalAccess', _164 => _164.id]), () => ( null)), index: loc.index };
|
|
7968
8025
|
}
|
|
7969
8026
|
/**
|
|
7970
8027
|
* Changes name, visibility, opacity, fill, blend, clipping, locks or (groups) collapsed state, as
|
|
@@ -7973,7 +8030,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7973
8030
|
setLayerProperties(id, props, commitToHistory = true) {
|
|
7974
8031
|
const next = setLayerProperties(this.state.layers, id, props);
|
|
7975
8032
|
this.commitLayers(next, void 0, commitToHistory);
|
|
7976
|
-
return
|
|
8033
|
+
return _chunkT6H3JDGAcjs.findLayer.call(void 0, next, id).layer;
|
|
7977
8034
|
}
|
|
7978
8035
|
/** Adds an empty pass-through group above the active layer (or at `placement`) and makes it active. Returns its id. */
|
|
7979
8036
|
addGroup(init = {}) {
|
|
@@ -7981,7 +8038,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
7981
8038
|
const group = {
|
|
7982
8039
|
type: "group",
|
|
7983
8040
|
id: newLayerId("group"),
|
|
7984
|
-
name: _optionalChain([init, 'access',
|
|
8041
|
+
name: _optionalChain([init, 'access', _165 => _165.name, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]) || "Group",
|
|
7985
8042
|
visible: true,
|
|
7986
8043
|
opacity: 1,
|
|
7987
8044
|
blend,
|
|
@@ -8031,14 +8088,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
8031
8088
|
let mask;
|
|
8032
8089
|
if (from === "selection") {
|
|
8033
8090
|
const sel = this.state.selection;
|
|
8034
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8091
|
+
if (!_optionalChain([sel, 'optionalAccess', _168 => _168.bounds])) throw new LayerOperationError("Nothing is selected; select first, or use reveal-all / hide-all.");
|
|
8035
8092
|
mask = this.maskFromSelection(sel, props);
|
|
8036
8093
|
if (layer.type === "pixel" && (layer.offset.x || layer.offset.y)) {
|
|
8037
|
-
mask = { ...mask, surface:
|
|
8094
|
+
mask = { ...mask, surface: _chunkCRMAXIUVcjs.translateSurface.call(void 0, mask.surface, -layer.offset.x, -layer.offset.y) };
|
|
8038
8095
|
}
|
|
8039
8096
|
} else {
|
|
8040
8097
|
const v = from === "reveal-all" ? 255 : 0;
|
|
8041
|
-
mask = withMaskProps({ surface:
|
|
8098
|
+
mask = withMaskProps({ surface: _chunkCRMAXIUVcjs.emptySurface.call(void 0, 1, v), defaultValue: v }, props);
|
|
8042
8099
|
}
|
|
8043
8100
|
const next = setLayerMask(this.state.layers, id, mask);
|
|
8044
8101
|
this.commitLayers(next, () => {
|
|
@@ -8079,11 +8136,11 @@ var ImageEditorController = (_class7 = class {
|
|
|
8079
8136
|
let out = surface;
|
|
8080
8137
|
const b = surface.bounds;
|
|
8081
8138
|
if (b) {
|
|
8082
|
-
const draft = new (0,
|
|
8083
|
-
for (const t of
|
|
8139
|
+
const draft = new (0, _chunkCRMAXIUVcjs.SurfaceDraft)(surface);
|
|
8140
|
+
for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, b)) {
|
|
8084
8141
|
const data = draft.peek(t.tx, t.ty);
|
|
8085
8142
|
if (!data) continue;
|
|
8086
|
-
const r = { x: t.tx *
|
|
8143
|
+
const r = { x: t.tx * _chunkCRMAXIUVcjs.TILE + layer.offset.x, y: t.ty * _chunkCRMAXIUVcjs.TILE + layer.offset.y, width: _chunkCRMAXIUVcjs.TILE, height: _chunkCRMAXIUVcjs.TILE };
|
|
8087
8144
|
const cov = this.compositor.maskCoverage(layer, r, sources);
|
|
8088
8145
|
if (!cov) continue;
|
|
8089
8146
|
const d = draft.tile(t.tx, t.ty);
|
|
@@ -8094,7 +8151,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8094
8151
|
const next = { ...layer, surface: out };
|
|
8095
8152
|
delete next.mask;
|
|
8096
8153
|
delete next.source;
|
|
8097
|
-
this.commitLayers(
|
|
8154
|
+
this.commitLayers(_chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, id, () => next), () => {
|
|
8098
8155
|
if (this.state.activeLayerId === id) this.state.activeTarget = "pixels";
|
|
8099
8156
|
});
|
|
8100
8157
|
}
|
|
@@ -8109,12 +8166,12 @@ var ImageEditorController = (_class7 = class {
|
|
|
8109
8166
|
const layer = loc.layer;
|
|
8110
8167
|
if (layer.type !== "pixel") throw new LayerOperationError(`Layer via copy needs a pixel layer; "${id}" is a ${layer.type} layer.`);
|
|
8111
8168
|
const sel = this.state.selection;
|
|
8112
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
8169
|
+
if (!_optionalChain([sel, 'optionalAccess', _169 => _169.bounds])) throw new LayerOperationError("Nothing is selected; select the pixels to copy first.");
|
|
8113
8170
|
if (options.cut) requireUnlocked(layer, "pixels", "cut from it");
|
|
8114
8171
|
const surface = this.surfaceOf(layer);
|
|
8115
8172
|
const sb = sel.bounds;
|
|
8116
8173
|
const src = { x: sb.x - layer.offset.x, y: sb.y - layer.offset.y, width: sb.width, height: sb.height };
|
|
8117
|
-
const px =
|
|
8174
|
+
const px = _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, src);
|
|
8118
8175
|
const kept = options.cut ? new Uint8ClampedArray(px) : null;
|
|
8119
8176
|
for (let y = 0; y < sb.height; y++) {
|
|
8120
8177
|
for (let x = 0; x < sb.width; x++) {
|
|
@@ -8127,18 +8184,18 @@ var ImageEditorController = (_class7 = class {
|
|
|
8127
8184
|
const copy = {
|
|
8128
8185
|
type: "pixel",
|
|
8129
8186
|
id: newLayerId(),
|
|
8130
|
-
name: _optionalChain([options, 'access',
|
|
8187
|
+
name: _optionalChain([options, 'access', _170 => _170.name, 'optionalAccess', _171 => _171.trim, 'call', _172 => _172()]) || `${layer.name || "Layer"} ${options.cut ? "cut" : "copy"}`,
|
|
8131
8188
|
visible: true,
|
|
8132
8189
|
opacity: 1,
|
|
8133
8190
|
blend: "normal",
|
|
8134
|
-
surface:
|
|
8191
|
+
surface: _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width: src.width, height: src.height, data: px }, 4, src.x, src.y),
|
|
8135
8192
|
offset: { ...layer.offset }
|
|
8136
8193
|
};
|
|
8137
|
-
let next =
|
|
8194
|
+
let next = _chunkT6H3JDGAcjs.insertLayer.call(void 0, this.state.layers, copy, _nullishCoalesce(_optionalChain([loc, 'access', _173 => _173.parent, 'optionalAccess', _174 => _174.id]), () => ( null)), loc.index + 1);
|
|
8138
8195
|
if (kept) {
|
|
8139
|
-
const cutLayer = { ...layer, surface:
|
|
8196
|
+
const cutLayer = { ...layer, surface: _chunkCRMAXIUVcjs.writeRegion.call(void 0, surface, src, kept) };
|
|
8140
8197
|
delete cutLayer.source;
|
|
8141
|
-
next =
|
|
8198
|
+
next = _chunkT6H3JDGAcjs.mapLayer.call(void 0, next, id, () => cutLayer);
|
|
8142
8199
|
}
|
|
8143
8200
|
this.commitLayers(next, () => {
|
|
8144
8201
|
this.state.activeLayerId = copy.id;
|
|
@@ -8151,19 +8208,19 @@ var ImageEditorController = (_class7 = class {
|
|
|
8151
8208
|
const f = normalizeFilter(filter);
|
|
8152
8209
|
const next = addLayerFilter(this.state.layers, id, f);
|
|
8153
8210
|
this.commitLayers(next);
|
|
8154
|
-
return _nullishCoalesce(
|
|
8211
|
+
return _nullishCoalesce(_chunkT6H3JDGAcjs.findLayer.call(void 0, next, id).layer.filters, () => ( []));
|
|
8155
8212
|
}
|
|
8156
8213
|
/** Changes one filter (one undo step, or none with `commitToHistory = false` during a drag). Returns the filters. */
|
|
8157
8214
|
updateLayerFilter(id, filterId, changes, commitToHistory = true) {
|
|
8158
8215
|
const next = updateLayerFilter(this.state.layers, id, filterId, changes);
|
|
8159
8216
|
this.commitLayers(next, void 0, commitToHistory);
|
|
8160
|
-
return _nullishCoalesce(
|
|
8217
|
+
return _nullishCoalesce(_chunkT6H3JDGAcjs.findLayer.call(void 0, next, id).layer.filters, () => ( []));
|
|
8161
8218
|
}
|
|
8162
8219
|
/** Removes one filter (one undo step). Returns the remaining filters. */
|
|
8163
8220
|
removeLayerFilter(id, filterId) {
|
|
8164
8221
|
const next = removeLayerFilter(this.state.layers, id, filterId);
|
|
8165
8222
|
this.commitLayers(next);
|
|
8166
|
-
return _nullishCoalesce(
|
|
8223
|
+
return _nullishCoalesce(_chunkT6H3JDGAcjs.findLayer.call(void 0, next, id).layer.filters, () => ( []));
|
|
8167
8224
|
}
|
|
8168
8225
|
// --- Layer effects ---
|
|
8169
8226
|
/** A layer's effects (an empty, enabled list when it has none). */
|
|
@@ -8201,7 +8258,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8201
8258
|
}
|
|
8202
8259
|
/** The light effects with "use global light" follow. */
|
|
8203
8260
|
getGlobalLight() {
|
|
8204
|
-
return { ..._nullishCoalesce(this.state.globalLight, () => (
|
|
8261
|
+
return { ..._nullishCoalesce(this.state.globalLight, () => ( _chunkT6H3JDGAcjs.DEFAULT_GLOBAL_LIGHT)) };
|
|
8205
8262
|
}
|
|
8206
8263
|
/** Sets the global light (one undo step). `angle` -360..360°, `altitude` 0..90°. Returns it. */
|
|
8207
8264
|
setGlobalLight(light, commitToHistory = true) {
|
|
@@ -8209,7 +8266,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8209
8266
|
if (!(Number.isFinite(next.angle) && next.angle >= -360 && next.angle <= 360)) throw new LayerOperationError(`angle must be from -360 to 360 degrees, got ${next.angle}.`);
|
|
8210
8267
|
if (!(Number.isFinite(next.altitude) && next.altitude >= 0 && next.altitude <= 90)) throw new LayerOperationError(`altitude must be from 0 to 90 degrees, got ${next.altitude}.`);
|
|
8211
8268
|
if (commitToHistory) this.recordHistory();
|
|
8212
|
-
if (next.angle ===
|
|
8269
|
+
if (next.angle === _chunkT6H3JDGAcjs.DEFAULT_GLOBAL_LIGHT.angle && next.altitude === _chunkT6H3JDGAcjs.DEFAULT_GLOBAL_LIGHT.altitude) delete this.state.globalLight;
|
|
8213
8270
|
else this.state.globalLight = next;
|
|
8214
8271
|
this.notify();
|
|
8215
8272
|
return this.getGlobalLight();
|
|
@@ -8217,12 +8274,12 @@ var ImageEditorController = (_class7 = class {
|
|
|
8217
8274
|
/** Composites `layers` (in isolation) over `rect` into a surface, loading depth maps first. */
|
|
8218
8275
|
async compositeToSurface(layers, rect) {
|
|
8219
8276
|
const { width, height } = this.naturalSize;
|
|
8220
|
-
if (
|
|
8277
|
+
if (_chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers).some((l) => l.type === "annotation" && l.visible) && !this.renderer.canRasterize()) {
|
|
8221
8278
|
throw new LayerOperationError("Merging annotation layers needs a canvas (a browser); hide or delete them first, or merge in the browser.");
|
|
8222
8279
|
}
|
|
8223
8280
|
await this.renderer.prepareLayerAssets(layers, width, height);
|
|
8224
8281
|
const data = new LayerCompositor().composite(layers, rect, this.renderer.compositorSources(width, height));
|
|
8225
|
-
return
|
|
8282
|
+
return _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width: rect.width, height: rect.height, data }, 4, rect.x, rect.y);
|
|
8226
8283
|
}
|
|
8227
8284
|
/** Document bounds a layer can paint into (pixel content, annotations, or the canvas for the rest). */
|
|
8228
8285
|
paintBounds(layer) {
|
|
@@ -8257,7 +8314,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8257
8314
|
requireUnlocked(upper, "all", "merge it");
|
|
8258
8315
|
requireUnlocked(lower, "pixels", "merge into it");
|
|
8259
8316
|
let rect = _nullishCoalesce(unionRect(this.paintBounds(lower), upper.type === "adjustment" ? null : this.paintBounds(upper)), () => ( { x: 0, y: 0, width: 1, height: 1 }));
|
|
8260
|
-
const reach = Math.max(
|
|
8317
|
+
const reach = Math.max(_chunkT6H3JDGAcjs.effectsMargin.call(void 0, lower.effects), upper.type === "adjustment" ? 0 : _chunkT6H3JDGAcjs.effectsMargin.call(void 0, upper.effects));
|
|
8261
8318
|
if (reach) rect = { x: rect.x - reach, y: rect.y - reach, width: rect.width + 2 * reach, height: rect.height + 2 * reach };
|
|
8262
8319
|
const base = { ...lower, blend: "normal", opacity: 1 };
|
|
8263
8320
|
delete base.clipped;
|
|
@@ -8268,8 +8325,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8268
8325
|
delete merged.filters;
|
|
8269
8326
|
delete merged.source;
|
|
8270
8327
|
delete merged.effects;
|
|
8271
|
-
let next =
|
|
8272
|
-
next =
|
|
8328
|
+
let next = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, id, () => null);
|
|
8329
|
+
next = _chunkT6H3JDGAcjs.mapLayer.call(void 0, next, lower.id, () => merged);
|
|
8273
8330
|
this.commitLayers(next, () => {
|
|
8274
8331
|
this.state.activeLayerId = merged.id;
|
|
8275
8332
|
this.state.activeTarget = "pixels";
|
|
@@ -8326,7 +8383,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8326
8383
|
});
|
|
8327
8384
|
return bg.id;
|
|
8328
8385
|
}
|
|
8329
|
-
|
|
8386
|
+
__init49() {this.thumbCache = /* @__PURE__ */ new WeakMap()}
|
|
8330
8387
|
/**
|
|
8331
8388
|
* A small RGBA preview of a pixel layer over the canvas (or of its mask with `mask: true`),
|
|
8332
8389
|
* longest side `maxSide` px, point-sampled; `null` for layers without pixels.
|
|
@@ -8345,14 +8402,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
8345
8402
|
const oy = layer.type === "pixel" ? layer.offset.y : 0;
|
|
8346
8403
|
const key = `${tw}x${th}:${ox},${oy}`;
|
|
8347
8404
|
let byKey = this.thumbCache.get(surface);
|
|
8348
|
-
const hit = _optionalChain([byKey, 'optionalAccess',
|
|
8405
|
+
const hit = _optionalChain([byKey, 'optionalAccess', _175 => _175.get, 'call', _176 => _176(key)]);
|
|
8349
8406
|
if (hit) return hit;
|
|
8350
8407
|
const out = new Uint8ClampedArray(tw * th * 4);
|
|
8351
8408
|
for (let y = 0; y < th; y++) {
|
|
8352
8409
|
const dy = Math.min(height - 1, Math.floor((y + 0.5) * height / th)) - oy;
|
|
8353
8410
|
for (let x = 0; x < tw; x++) {
|
|
8354
8411
|
const dx = Math.min(width - 1, Math.floor((x + 0.5) * width / tw)) - ox;
|
|
8355
|
-
const v =
|
|
8412
|
+
const v = _chunkCRMAXIUVcjs.readPixel.call(void 0, surface, dx, dy);
|
|
8356
8413
|
const i = (y * tw + x) * 4;
|
|
8357
8414
|
if (surface.channels === 1) {
|
|
8358
8415
|
out[i] = out[i + 1] = out[i + 2] = v[0];
|
|
@@ -8373,14 +8430,40 @@ var ImageEditorController = (_class7 = class {
|
|
|
8373
8430
|
setPaintOptions(options) {
|
|
8374
8431
|
const cur = this.state.paint;
|
|
8375
8432
|
const next = {
|
|
8376
|
-
brush: options.brush ?
|
|
8433
|
+
brush: options.brush ? _chunkZZOTHJ4Kcjs.normalizeBrush.call(void 0, { ...cur.brush, ...options.brush }) : cur.brush,
|
|
8377
8434
|
foreground: options.foreground !== void 0 ? toHex2(parseColor(options.foreground)) : cur.foreground,
|
|
8378
|
-
background: options.background !== void 0 ? toHex2(parseColor(options.background)) : cur.background
|
|
8435
|
+
background: options.background !== void 0 ? toHex2(parseColor(options.background)) : cur.background,
|
|
8436
|
+
mixer: options.mixer ? _chunkZZOTHJ4Kcjs.normalizeMixer.call(void 0, { ...cur.mixer, ...options.mixer }) : cur.mixer,
|
|
8437
|
+
mixerLoad: cur.mixerLoad
|
|
8379
8438
|
};
|
|
8380
8439
|
this.state.paint = next;
|
|
8381
8440
|
this.notify();
|
|
8382
8441
|
return next;
|
|
8383
8442
|
}
|
|
8443
|
+
/**
|
|
8444
|
+
* Loads the Mixer Brush's reservoir full with `color` (default the foreground); the picked-up
|
|
8445
|
+
* colour is kept. View state, no undo. Returns the brush load.
|
|
8446
|
+
*/
|
|
8447
|
+
loadMixerBrush(color) {
|
|
8448
|
+
const c = parseColor(_nullishCoalesce(color, () => ( this.state.paint.foreground)));
|
|
8449
|
+
const load = _chunkZZOTHJ4Kcjs.loadMixer.call(void 0, this.state.paint.mixerLoad, [c[0] / 255, c[1] / 255, c[2] / 255]);
|
|
8450
|
+
this.state.paint = { ...this.state.paint, mixerLoad: load };
|
|
8451
|
+
this.notify();
|
|
8452
|
+
return load;
|
|
8453
|
+
}
|
|
8454
|
+
/** Cleans the Mixer Brush: empties the pickup well (the reservoir is kept). Returns the brush load. */
|
|
8455
|
+
cleanMixerBrush() {
|
|
8456
|
+
const load = _chunkZZOTHJ4Kcjs.cleanMixer.call(void 0, this.state.paint.mixerLoad);
|
|
8457
|
+
this.state.paint = { ...this.state.paint, mixerLoad: load };
|
|
8458
|
+
this.notify();
|
|
8459
|
+
return load;
|
|
8460
|
+
}
|
|
8461
|
+
/** Empties the Mixer Brush entirely (no reservoir, nothing picked up). Returns the brush load. */
|
|
8462
|
+
emptyMixerBrush() {
|
|
8463
|
+
this.state.paint = { ...this.state.paint, mixerLoad: _chunkZZOTHJ4Kcjs.EMPTY_MIXER_LOAD };
|
|
8464
|
+
this.notify();
|
|
8465
|
+
return _chunkZZOTHJ4Kcjs.EMPTY_MIXER_LOAD;
|
|
8466
|
+
}
|
|
8384
8467
|
/** D: black foreground, white background. */
|
|
8385
8468
|
resetPaintColors() {
|
|
8386
8469
|
this.setPaintOptions({ foreground: "#000000", background: "#ffffff" });
|
|
@@ -8407,7 +8490,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8407
8490
|
if (!layer.visible) throw new LayerOperationError(`Layer "${layer.name || id}" is hidden; show it before you ${action}.`);
|
|
8408
8491
|
const offset = layer.type === "pixel" ? layer.offset : { x: 0, y: 0 };
|
|
8409
8492
|
const surface = ch === "mask" ? layer.mask.surface : this.surfaceOf(layer);
|
|
8410
|
-
const lockTransparency = ch === "pixels" && Boolean(_optionalChain([layer, 'access',
|
|
8493
|
+
const lockTransparency = ch === "pixels" && Boolean(_optionalChain([layer, 'access', _177 => _177.locks, 'optionalAccess', _178 => _178.transparency]));
|
|
8411
8494
|
return { id, layer, channel: ch, offset, surface, lockTransparency };
|
|
8412
8495
|
}
|
|
8413
8496
|
/** The layer with its pixels (or mask) replaced by `surface`. */
|
|
@@ -8425,8 +8508,12 @@ var ImageEditorController = (_class7 = class {
|
|
|
8425
8508
|
*/
|
|
8426
8509
|
beginStroke(init = {}) {
|
|
8427
8510
|
const tool = _nullishCoalesce(init.tool, () => ( "brush"));
|
|
8511
|
+
if (tool !== "brush" && tool !== "eraser" && tool !== "mixer") throw new LayerOperationError(`Unknown paint tool "${String(tool)}"; use brush, eraser or mixer.`);
|
|
8428
8512
|
const target = this.paintTarget(init.layerId, init.channel, tool === "eraser" ? "erase" : "paint");
|
|
8429
|
-
|
|
8513
|
+
if (tool === "mixer" && target.channel === "mask") {
|
|
8514
|
+
throw new LayerOperationError("The Mixer Brush paints colour on pixels, not on masks; target pixels (channel pixels), or paint the mask with the brush.");
|
|
8515
|
+
}
|
|
8516
|
+
const brush = _chunkZZOTHJ4Kcjs.normalizeBrush.call(void 0, { ...this.state.paint.brush, ..._nullishCoalesce(init.brush, () => ( {})) });
|
|
8430
8517
|
const color = parseColor(_nullishCoalesce(init.color, () => ( this.state.paint.foreground)));
|
|
8431
8518
|
const background = parseColor(_nullishCoalesce(init.background, () => ( this.state.paint.background)));
|
|
8432
8519
|
const toMaskGrey = (c) => {
|
|
@@ -8440,19 +8527,37 @@ var ImageEditorController = (_class7 = class {
|
|
|
8440
8527
|
opacity: brush.opacity,
|
|
8441
8528
|
blend: target.channel === "mask" ? "normal" : brush.blend,
|
|
8442
8529
|
lockTransparency: target.lockTransparency,
|
|
8443
|
-
selection: _optionalChain([this, 'access',
|
|
8530
|
+
selection: _optionalChain([this, 'access', _179 => _179.state, 'access', _180 => _180.selection, 'optionalAccess', _181 => _181.bounds]) ? this.state.selection : null,
|
|
8444
8531
|
offset: target.offset
|
|
8445
8532
|
};
|
|
8446
|
-
return new PaintStrokeSession(this, target,
|
|
8533
|
+
if (tool === "mixer") return new PaintStrokeSession(this, target, this.mixerStroke(init, brush), apply);
|
|
8534
|
+
return new PaintStrokeSession(this, target, new (0, _chunkZZOTHJ4Kcjs.StrokeCoverage)(brush), apply);
|
|
8535
|
+
}
|
|
8536
|
+
/** A Mixer Brush stroke's start: the settings, and the load (refilled when asked or set to). */
|
|
8537
|
+
mixerStroke(init, brush) {
|
|
8538
|
+
const settings = _chunkZZOTHJ4Kcjs.normalizeMixer.call(void 0, { ...this.state.paint.mixer, ..._nullishCoalesce(init.mixer, () => ( {})) });
|
|
8539
|
+
let load = this.state.paint.mixerLoad;
|
|
8540
|
+
if (init.color !== void 0 || settings.loadEachStroke) {
|
|
8541
|
+
const c = parseColor(_nullishCoalesce(init.color, () => ( this.state.paint.foreground)));
|
|
8542
|
+
load = _chunkZZOTHJ4Kcjs.loadMixer.call(void 0, load, [c[0] / 255, c[1] / 255, c[2] / 255]);
|
|
8543
|
+
}
|
|
8544
|
+
return {
|
|
8545
|
+
create: (pixels) => new (0, _chunkZZOTHJ4Kcjs.MixerStroke)(brush, settings, load, pixels),
|
|
8546
|
+
end: (after) => {
|
|
8547
|
+
const next = settings.cleanEachStroke ? _chunkZZOTHJ4Kcjs.cleanMixer.call(void 0, after) : after;
|
|
8548
|
+
this.state.paint = { ...this.state.paint, mixerLoad: next };
|
|
8549
|
+
return next;
|
|
8550
|
+
}
|
|
8551
|
+
};
|
|
8447
8552
|
}
|
|
8448
8553
|
/** @internal Shows a stroke's live surface (no history). */
|
|
8449
8554
|
_strokeUpdate(layerId, channel, surface, rects) {
|
|
8450
|
-
this.state.layers =
|
|
8555
|
+
this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, layerId, (l) => this.withSurface(l, channel, surface));
|
|
8451
8556
|
this.notify(rects);
|
|
8452
8557
|
}
|
|
8453
8558
|
/** @internal Commits a finished stroke as one undo step (`before` is the pre-stroke state). */
|
|
8454
8559
|
_strokeCommit(before, layerId, channel, surface) {
|
|
8455
|
-
if (surface) this.state.layers =
|
|
8560
|
+
if (surface) this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, layerId, (l) => this.withSurface(l, channel, surface));
|
|
8456
8561
|
else this.state.layers = before.layers;
|
|
8457
8562
|
if (surface && !this.isApplyingHistory) {
|
|
8458
8563
|
this.undoStack.push(before);
|
|
@@ -8468,13 +8573,13 @@ var ImageEditorController = (_class7 = class {
|
|
|
8468
8573
|
}
|
|
8469
8574
|
/**
|
|
8470
8575
|
* Paints a whole stroke in one call (agents, replays): `points` in document pixels with optional
|
|
8471
|
-
* pressure, through the brush or
|
|
8576
|
+
* pressure, through the brush, eraser or Mixer Brush. One undo step. Returns the layer, channel, the changed
|
|
8472
8577
|
* document bounds and the number of dabs.
|
|
8473
8578
|
*/
|
|
8474
8579
|
paintStroke(init) {
|
|
8475
8580
|
if (!Array.isArray(init.points) || !init.points.length) throw new LayerOperationError("points must hold at least one { x, y } point.");
|
|
8476
8581
|
for (const p of init.points) {
|
|
8477
|
-
if (!Number.isFinite(_optionalChain([p, 'optionalAccess',
|
|
8582
|
+
if (!Number.isFinite(_optionalChain([p, 'optionalAccess', _182 => _182.x])) || !Number.isFinite(_optionalChain([p, 'optionalAccess', _183 => _183.y]))) throw new LayerOperationError("Every point needs finite x and y (document pixels).");
|
|
8478
8583
|
}
|
|
8479
8584
|
const session = this.beginStroke(init);
|
|
8480
8585
|
session.push(init.points);
|
|
@@ -8502,9 +8607,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8502
8607
|
const opacity = _nullishCoalesce(options.opacity, () => ( 1));
|
|
8503
8608
|
if (!(opacity >= 0 && opacity <= 1)) throw new LayerOperationError("opacity must be from 0 to 1.");
|
|
8504
8609
|
const blend = _nullishCoalesce(parseBlend(options.blend), () => ( "normal"));
|
|
8505
|
-
const sel = options.useSelection !== false && _optionalChain([this, 'access',
|
|
8506
|
-
const region = _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
8507
|
-
const coverage = new (0,
|
|
8610
|
+
const sel = options.useSelection !== false && _optionalChain([this, 'access', _184 => _184.state, 'access', _185 => _185.selection, 'optionalAccess', _186 => _186.bounds]) ? this.state.selection : null;
|
|
8611
|
+
const region = _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _187 => _187.bounds]), () => ( { x: 0, y: 0, width, height }));
|
|
8612
|
+
const coverage = new (0, _chunkZZOTHJ4Kcjs.CoverageMap)();
|
|
8508
8613
|
const ones = new Float32Array(region.width * region.height);
|
|
8509
8614
|
if (sel) {
|
|
8510
8615
|
for (let y = 0; y < region.height; y++) {
|
|
@@ -8529,7 +8634,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8529
8634
|
offset: target.offset
|
|
8530
8635
|
};
|
|
8531
8636
|
const surface = paintCoverageInto(target.surface, coverage, apply, [region]);
|
|
8532
|
-
const next =
|
|
8637
|
+
const next = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => this.withSurface(l, target.channel, surface));
|
|
8533
8638
|
this.commitLayers(next);
|
|
8534
8639
|
return { layerId: target.id, channel: target.channel, bounds: region, dabs: 0 };
|
|
8535
8640
|
}
|
|
@@ -8551,12 +8656,12 @@ var ImageEditorController = (_class7 = class {
|
|
|
8551
8656
|
const target = this.developLayer();
|
|
8552
8657
|
let layers = this.state.layers;
|
|
8553
8658
|
if (target && (DEVELOP_KEYS.some((k) => k in partial) || "process" in partial)) {
|
|
8554
|
-
layers =
|
|
8659
|
+
layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, target.id, (l) => withDevelop(l, partial));
|
|
8555
8660
|
}
|
|
8556
8661
|
if ("blur" in partial && typeof partial.blur === "number") {
|
|
8557
8662
|
const blur = Math.max(0, partial.blur);
|
|
8558
8663
|
if (this.state.legacyOutputBlur !== void 0) this.state.legacyOutputBlur = blur;
|
|
8559
|
-
else if (target) layers =
|
|
8664
|
+
else if (target) layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, target.id, (l) => withBlur(l, blur));
|
|
8560
8665
|
}
|
|
8561
8666
|
if ("opacity" in partial && typeof partial.opacity === "number") {
|
|
8562
8667
|
this.state.outputOpacity = Math.min(1, Math.max(0, partial.opacity));
|
|
@@ -8586,7 +8691,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8586
8691
|
this.recordHistory();
|
|
8587
8692
|
const target = this.developLayer();
|
|
8588
8693
|
if (target) {
|
|
8589
|
-
this.state.layers =
|
|
8694
|
+
this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0,
|
|
8590
8695
|
this.state.layers,
|
|
8591
8696
|
target.id,
|
|
8592
8697
|
(l) => withBlur(withDevelop(l, { ...DEFAULT_ADJUSTMENTS, process: LATEST_PROCESS_VERSION }), 0)
|
|
@@ -8606,7 +8711,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8606
8711
|
return this.getAdjustmentLayers().find((l) => l.id === id);
|
|
8607
8712
|
}
|
|
8608
8713
|
adjustmentNodes(layers = this.state.layers) {
|
|
8609
|
-
return
|
|
8714
|
+
return _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers).filter((l) => l.type === "adjustment");
|
|
8610
8715
|
}
|
|
8611
8716
|
/**
|
|
8612
8717
|
* Where a new layer goes when no position is given: directly above the topmost layer that is
|
|
@@ -8620,26 +8725,26 @@ var ImageEditorController = (_class7 = class {
|
|
|
8620
8725
|
/** Inserts `node` by `aboveId` / `parentId` / adjustment index / default position. */
|
|
8621
8726
|
placeLayer(layers, node, where) {
|
|
8622
8727
|
if (where.aboveId) {
|
|
8623
|
-
const loc =
|
|
8624
|
-
if (loc) return
|
|
8728
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, layers, where.aboveId);
|
|
8729
|
+
if (loc) return _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _188 => _188.parent, 'optionalAccess', _189 => _189.id]), () => ( null)), loc.index + 1);
|
|
8625
8730
|
}
|
|
8626
8731
|
if (where.parentId) {
|
|
8627
|
-
const loc =
|
|
8628
|
-
if (loc && loc.layer.type === "group") return
|
|
8732
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, layers, where.parentId);
|
|
8733
|
+
if (loc && loc.layer.type === "group") return _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, node, loc.layer.id);
|
|
8629
8734
|
}
|
|
8630
8735
|
if (where.adjustmentIndex !== void 0) {
|
|
8631
8736
|
const nodes = this.adjustmentNodes(layers);
|
|
8632
8737
|
const at = Math.max(0, Math.min(nodes.length, Math.round(where.adjustmentIndex)));
|
|
8633
8738
|
if (at < nodes.length) {
|
|
8634
|
-
const loc =
|
|
8635
|
-
return
|
|
8739
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, layers, nodes[at].id);
|
|
8740
|
+
return _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _190 => _190.parent, 'optionalAccess', _191 => _191.id]), () => ( null)), loc.index);
|
|
8636
8741
|
}
|
|
8637
8742
|
if (nodes.length) {
|
|
8638
|
-
const loc =
|
|
8639
|
-
return
|
|
8743
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, layers, nodes[nodes.length - 1].id);
|
|
8744
|
+
return _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, node, _nullishCoalesce(_optionalChain([loc, 'access', _192 => _192.parent, 'optionalAccess', _193 => _193.id]), () => ( null)), loc.index + 1);
|
|
8640
8745
|
}
|
|
8641
8746
|
}
|
|
8642
|
-
return
|
|
8747
|
+
return _chunkT6H3JDGAcjs.insertLayer.call(void 0, layers, node, null, this.defaultInsertIndex(layers));
|
|
8643
8748
|
}
|
|
8644
8749
|
/** `setAdjustments({ layers })`: updates nodes by id in place, removes missing ones, adds new ones. */
|
|
8645
8750
|
replaceAdjustmentNodes(layers, next) {
|
|
@@ -8648,7 +8753,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8648
8753
|
let out = layers;
|
|
8649
8754
|
for (const node of this.adjustmentNodes(layers)) {
|
|
8650
8755
|
const update = byId.get(node.id);
|
|
8651
|
-
out =
|
|
8756
|
+
out = _chunkT6H3JDGAcjs.mapLayer.call(void 0, out, node.id, () => update ? mergeAdjustmentNode(node, update, width, height) : null);
|
|
8652
8757
|
}
|
|
8653
8758
|
const existing = new Set(this.adjustmentNodes(out).map((n) => n.id));
|
|
8654
8759
|
for (const l of next) {
|
|
@@ -8667,7 +8772,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8667
8772
|
*/
|
|
8668
8773
|
addAdjustmentLayer(init, index) {
|
|
8669
8774
|
const spec = typeof init === "string" ? { kind: init } : init;
|
|
8670
|
-
const ids = new Set(
|
|
8775
|
+
const ids = new Set(_chunkT6H3JDGAcjs.flattenLayers.call(void 0, this.state.layers).map((l) => l.id));
|
|
8671
8776
|
const layer = createAdjustmentLayer(spec.kind, {
|
|
8672
8777
|
id: spec.id && !ids.has(spec.id) ? spec.id : void 0,
|
|
8673
8778
|
name: spec.name,
|
|
@@ -8696,7 +8801,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8696
8801
|
* Returns false for an unknown id.
|
|
8697
8802
|
*/
|
|
8698
8803
|
updateAdjustmentLayer(id, update, commitToHistory = true) {
|
|
8699
|
-
const loc =
|
|
8804
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, this.state.layers, id);
|
|
8700
8805
|
if (!loc || loc.layer.type !== "adjustment") return false;
|
|
8701
8806
|
const { width, height } = this.naturalSize;
|
|
8702
8807
|
const node = loc.layer;
|
|
@@ -8724,16 +8829,16 @@ var ImageEditorController = (_class7 = class {
|
|
|
8724
8829
|
if (mask) next.mask = mask;
|
|
8725
8830
|
else delete next.mask;
|
|
8726
8831
|
}
|
|
8727
|
-
this.state.layers =
|
|
8832
|
+
this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, id, () => next);
|
|
8728
8833
|
this.notify();
|
|
8729
8834
|
return true;
|
|
8730
8835
|
}
|
|
8731
8836
|
/** Removes a layer as one undo step. Returns false for an unknown id. */
|
|
8732
8837
|
removeAdjustmentLayer(id) {
|
|
8733
|
-
const loc =
|
|
8838
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, this.state.layers, id);
|
|
8734
8839
|
if (!loc || loc.layer.type !== "adjustment") return false;
|
|
8735
8840
|
this.recordHistory();
|
|
8736
|
-
this.state.layers =
|
|
8841
|
+
this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, id, () => null);
|
|
8737
8842
|
if (this.state.activeLayerId === id) this.state.activeLayerId = null;
|
|
8738
8843
|
this.notify();
|
|
8739
8844
|
return true;
|
|
@@ -8746,9 +8851,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
8746
8851
|
if (to === from) return layers;
|
|
8747
8852
|
const node = nodes[from];
|
|
8748
8853
|
const anchor = nodes[to];
|
|
8749
|
-
const without =
|
|
8750
|
-
const loc =
|
|
8751
|
-
return
|
|
8854
|
+
const without = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, id, () => null);
|
|
8855
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, without, anchor.id);
|
|
8856
|
+
return _chunkT6H3JDGAcjs.insertLayer.call(void 0, without, node, _nullishCoalesce(_optionalChain([loc, 'access', _194 => _194.parent, 'optionalAccess', _195 => _195.id]), () => ( null)), to > from ? loc.index + 1 : loc.index);
|
|
8752
8857
|
}
|
|
8753
8858
|
/** Moves a layer to `toIndex` among the adjustment layers (0 = bottom) as one undo step. Returns false if nothing moved. */
|
|
8754
8859
|
moveAdjustmentLayer(id, toIndex) {
|
|
@@ -8773,7 +8878,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8773
8878
|
if (!nodes.length) return;
|
|
8774
8879
|
this.recordHistory();
|
|
8775
8880
|
let layers = this.state.layers;
|
|
8776
|
-
for (const n of nodes) layers =
|
|
8881
|
+
for (const n of nodes) layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, n.id, () => null);
|
|
8777
8882
|
this.state.layers = layers;
|
|
8778
8883
|
if (nodes.some((n) => n.id === this.state.activeLayerId)) this.state.activeLayerId = null;
|
|
8779
8884
|
this.notify();
|
|
@@ -8784,7 +8889,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8784
8889
|
return _nullishCoalesce(this.state.selection, () => ( null));
|
|
8785
8890
|
}
|
|
8786
8891
|
get hasSelection() {
|
|
8787
|
-
return Boolean(_optionalChain([this, 'access',
|
|
8892
|
+
return Boolean(_optionalChain([this, 'access', _196 => _196.state, 'access', _197 => _197.selection, 'optionalAccess', _198 => _198.bounds]));
|
|
8788
8893
|
}
|
|
8789
8894
|
get naturalSize() {
|
|
8790
8895
|
return {
|
|
@@ -8874,7 +8979,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8874
8979
|
try {
|
|
8875
8980
|
const canvas = await this.renderSource();
|
|
8876
8981
|
const ctx = canvas.getContext("2d");
|
|
8877
|
-
const data2 = _optionalChain([ctx, 'optionalAccess',
|
|
8982
|
+
const data2 = _optionalChain([ctx, 'optionalAccess', _199 => _199.getImageData, 'optionalCall', _200 => _200(0, 0, width, height)]);
|
|
8878
8983
|
if (data2 && data2.data && data2.data.length >= width * height * 4) {
|
|
8879
8984
|
base = { width, height, data: data2.data };
|
|
8880
8985
|
this.samplePixels = base;
|
|
@@ -8895,8 +9000,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
8895
9000
|
if (!layer || layer.type !== "pixel") {
|
|
8896
9001
|
throw new LayerOperationError("Sampling the active layer needs an active pixel layer; select one, or sample the composite.");
|
|
8897
9002
|
}
|
|
8898
|
-
const surface = layer.source === "document" && options.pixels ?
|
|
8899
|
-
return { width, height, data:
|
|
9003
|
+
const surface = layer.source === "document" && options.pixels ? _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, options.pixels, 4) : this.surfaceOf(layer);
|
|
9004
|
+
return { width, height, data: _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, { x: -layer.offset.x, y: -layer.offset.y, width, height }) };
|
|
8900
9005
|
}
|
|
8901
9006
|
if (legacy && !options.sampleMerged) return base;
|
|
8902
9007
|
this.syncViews();
|
|
@@ -8909,7 +9014,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8909
9014
|
const sources = {
|
|
8910
9015
|
width,
|
|
8911
9016
|
height,
|
|
8912
|
-
surfaceOf: (l) => l.source === "document" && pixels ?
|
|
9017
|
+
surfaceOf: (l) => l.source === "document" && pixels ? _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, pixels, 4) : this.surfaceOf(l),
|
|
8913
9018
|
version: pixels ? "pixels" : this.sourceVersion()
|
|
8914
9019
|
};
|
|
8915
9020
|
const stack = withoutAnnotations(this.state.layers);
|
|
@@ -8940,7 +9045,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8940
9045
|
/** Select › Modify: grow, shrink, feather, border or smooth by `radius` pixels (one undo step). */
|
|
8941
9046
|
modifySelection(op, radius) {
|
|
8942
9047
|
const sel = this.state.selection;
|
|
8943
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
9048
|
+
if (!_optionalChain([sel, 'optionalAccess', _201 => _201.bounds])) return false;
|
|
8944
9049
|
return this.setSelection(modifySelection(sel, op, radius));
|
|
8945
9050
|
}
|
|
8946
9051
|
/**
|
|
@@ -8949,7 +9054,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8949
9054
|
*/
|
|
8950
9055
|
async refineSelection(params, options = {}) {
|
|
8951
9056
|
const sel = this.state.selection;
|
|
8952
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
9057
|
+
if (!_optionalChain([sel, 'optionalAccess', _202 => _202.bounds])) return false;
|
|
8953
9058
|
const pixels = (_nullishCoalesce(params.radius, () => ( 0))) > 0 ? await this.requirePixels(options) : null;
|
|
8954
9059
|
return this.setSelection(refineSelection(pixels, sel, params));
|
|
8955
9060
|
}
|
|
@@ -8966,7 +9071,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8966
9071
|
const canvas = this.renderer.createCanvas(w, h);
|
|
8967
9072
|
const ctx = canvas.getContext("2d");
|
|
8968
9073
|
if (ctx) ctx.drawImage(img, 0, 0, w, h);
|
|
8969
|
-
const data = _optionalChain([ctx, 'optionalAccess',
|
|
9074
|
+
const data = _optionalChain([ctx, 'optionalAccess', _203 => _203.getImageData, 'optionalCall', _204 => _204(0, 0, w, h)]);
|
|
8970
9075
|
if (!data) throw new Error("The mask image pixels are not available (no canvas access); pass pixels.");
|
|
8971
9076
|
pixels = { width: w, height: h, data: data.data };
|
|
8972
9077
|
} else {
|
|
@@ -8985,7 +9090,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
8985
9090
|
maskFromSelection(sel, props = {}) {
|
|
8986
9091
|
const { width, height } = this.naturalSize;
|
|
8987
9092
|
const sized = sel.width === width && sel.height === height ? sel : resizeSelection(sel, width, height);
|
|
8988
|
-
const mask = { surface:
|
|
9093
|
+
const mask = { surface: _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data: sized.data }, 1, 0, 0, 0), defaultValue: 0 };
|
|
8989
9094
|
return withMaskProps(mask, props);
|
|
8990
9095
|
}
|
|
8991
9096
|
/**
|
|
@@ -8994,14 +9099,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
8994
9099
|
*/
|
|
8995
9100
|
applySelectionAsLayerMask(layerId, props = {}) {
|
|
8996
9101
|
const sel = this.state.selection;
|
|
8997
|
-
if (!_optionalChain([sel, 'optionalAccess',
|
|
9102
|
+
if (!_optionalChain([sel, 'optionalAccess', _205 => _205.bounds]) || !this.getAdjustmentLayer(layerId)) return false;
|
|
8998
9103
|
return this.setLayerMask(layerId, this.maskFromSelection(sel, props));
|
|
8999
9104
|
}
|
|
9000
9105
|
setLayerMask(layerId, mask, commitToHistory = true) {
|
|
9001
|
-
const loc =
|
|
9106
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, this.state.layers, layerId);
|
|
9002
9107
|
if (!loc) return false;
|
|
9003
9108
|
if (commitToHistory) this.recordHistory();
|
|
9004
|
-
this.state.layers =
|
|
9109
|
+
this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, layerId, (l) => {
|
|
9005
9110
|
const next = { ...l };
|
|
9006
9111
|
if (mask) next.mask = mask;
|
|
9007
9112
|
else delete next.mask;
|
|
@@ -9025,11 +9130,11 @@ var ImageEditorController = (_class7 = class {
|
|
|
9025
9130
|
/** Load Selection from a layer mask (its pixels; density and feather are not applied). */
|
|
9026
9131
|
selectionFromLayerMask(layerId, mode = "replace") {
|
|
9027
9132
|
const layer = this.getLayer(layerId);
|
|
9028
|
-
if (!_optionalChain([layer, 'optionalAccess',
|
|
9133
|
+
if (!_optionalChain([layer, 'optionalAccess', _206 => _206.mask]) || layer.mask.source) return false;
|
|
9029
9134
|
const { width, height } = this.naturalSize;
|
|
9030
9135
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
9031
9136
|
const oy = layer.type === "pixel" ? layer.offset.y : 0;
|
|
9032
|
-
const data =
|
|
9137
|
+
const data = _chunkCRMAXIUVcjs.readRegion.call(void 0, layer.mask.surface, { x: -ox, y: -oy, width, height });
|
|
9033
9138
|
const sel = createSelectionMask(width, height, new Uint8Array(data.buffer, data.byteOffset, data.length));
|
|
9034
9139
|
return this.setSelection(sel, mode);
|
|
9035
9140
|
}
|
|
@@ -9058,10 +9163,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
9058
9163
|
if (target) {
|
|
9059
9164
|
const merged = { ...this.state.depthMask, ...partial };
|
|
9060
9165
|
merged.depthRange = [...merged.depthRange];
|
|
9061
|
-
this.state.layers =
|
|
9166
|
+
this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
|
|
9062
9167
|
const next = { ...l };
|
|
9063
9168
|
if (isDefaultDepthMask(merged)) {
|
|
9064
|
-
if (_optionalChain([next, 'access',
|
|
9169
|
+
if (_optionalChain([next, 'access', _207 => _207.mask, 'optionalAccess', _208 => _208.source])) delete next.mask;
|
|
9065
9170
|
} else next.mask = depthRasterMask(merged);
|
|
9066
9171
|
return next;
|
|
9067
9172
|
});
|
|
@@ -9071,8 +9176,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
9071
9176
|
resetDepthMask() {
|
|
9072
9177
|
this.recordHistory();
|
|
9073
9178
|
const target = this.developLayer();
|
|
9074
|
-
if (_optionalChain([target, 'optionalAccess',
|
|
9075
|
-
this.state.layers =
|
|
9179
|
+
if (_optionalChain([target, 'optionalAccess', _209 => _209.mask, 'optionalAccess', _210 => _210.source])) {
|
|
9180
|
+
this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, target.id, (l) => {
|
|
9076
9181
|
const next = { ...l };
|
|
9077
9182
|
delete next.mask;
|
|
9078
9183
|
return next;
|
|
@@ -9082,7 +9187,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9082
9187
|
}
|
|
9083
9188
|
// --- Annotations & Layers ---
|
|
9084
9189
|
annotationLayer(id) {
|
|
9085
|
-
return
|
|
9190
|
+
return _chunkT6H3JDGAcjs.flattenLayers.call(void 0, this.state.layers).find(
|
|
9086
9191
|
(l) => l.type === "annotation" && l.annotation.id === id
|
|
9087
9192
|
);
|
|
9088
9193
|
}
|
|
@@ -9092,8 +9197,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
9092
9197
|
const id = `ann_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`;
|
|
9093
9198
|
const fullAnnotation = { ...annotation, id };
|
|
9094
9199
|
const layer = annotationLayerFor(fullAnnotation);
|
|
9095
|
-
const loc = placement.aboveId ?
|
|
9096
|
-
this.state.layers = loc ?
|
|
9200
|
+
const loc = placement.aboveId ? _chunkT6H3JDGAcjs.findLayer.call(void 0, this.state.layers, placement.aboveId) : null;
|
|
9201
|
+
this.state.layers = loc ? _chunkT6H3JDGAcjs.insertLayer.call(void 0, this.state.layers, layer, _nullishCoalesce(_optionalChain([loc, 'access', _211 => _211.parent, 'optionalAccess', _212 => _212.id]), () => ( null)), loc.index + 1) : _chunkT6H3JDGAcjs.insertLayer.call(void 0, this.state.layers, layer, null);
|
|
9097
9202
|
this.state.selectedAnnotationId = id;
|
|
9098
9203
|
this.notify();
|
|
9099
9204
|
return id;
|
|
@@ -9106,14 +9211,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
9106
9211
|
if (layer) {
|
|
9107
9212
|
const annotation = { ...layer.annotation, ...partial, id };
|
|
9108
9213
|
const name = layer.name === annotationLayerName(layer.annotation) ? annotationLayerName(annotation) : layer.name;
|
|
9109
|
-
this.state.layers =
|
|
9214
|
+
this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, layer.id, () => ({ ...layer, annotation, name }));
|
|
9110
9215
|
}
|
|
9111
9216
|
this.notify();
|
|
9112
9217
|
}
|
|
9113
9218
|
removeAnnotation(id) {
|
|
9114
9219
|
this.recordHistory();
|
|
9115
9220
|
const layer = this.annotationLayer(id);
|
|
9116
|
-
if (layer) this.state.layers =
|
|
9221
|
+
if (layer) this.state.layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, layer.id, () => null);
|
|
9117
9222
|
if (this.state.selectedAnnotationId === id) {
|
|
9118
9223
|
this.state.selectedAnnotationId = null;
|
|
9119
9224
|
}
|
|
@@ -9122,7 +9227,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9122
9227
|
clearAnnotations() {
|
|
9123
9228
|
this.recordHistory();
|
|
9124
9229
|
let layers = this.state.layers;
|
|
9125
|
-
for (const l of
|
|
9230
|
+
for (const l of _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers)) if (l.type === "annotation") layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, l.id, () => null);
|
|
9126
9231
|
this.state.layers = layers;
|
|
9127
9232
|
this.state.selectedAnnotationId = null;
|
|
9128
9233
|
this.notify();
|
|
@@ -9162,7 +9267,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9162
9267
|
this.notify();
|
|
9163
9268
|
}
|
|
9164
9269
|
// --- Rendering & Export ---
|
|
9165
|
-
|
|
9270
|
+
__init50() {this.blankSource = null}
|
|
9166
9271
|
/**
|
|
9167
9272
|
* What the renderer draws from: the source image, or, for a document without one (an opened
|
|
9168
9273
|
* PSD, a v3 document loaded on its own), a transparent canvas of the document size, since every
|
|
@@ -9199,9 +9304,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
9199
9304
|
return this.renderer.createCanvas(1, 1);
|
|
9200
9305
|
}
|
|
9201
9306
|
this.syncViews();
|
|
9202
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
9307
|
+
if (_optionalChain([options, 'optionalAccess', _213 => _213.layerIds])) {
|
|
9203
9308
|
const keep = new Set(options.layerIds);
|
|
9204
|
-
const layers =
|
|
9309
|
+
const layers = _chunkT6H3JDGAcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => keep.has(l.id));
|
|
9205
9310
|
return this.renderer.renderExport(source, { ...this.state, layers }, options);
|
|
9206
9311
|
}
|
|
9207
9312
|
return this.renderer.renderExport(source, this.state, options);
|
|
@@ -9311,10 +9416,10 @@ var ImageEditorController = (_class7 = class {
|
|
|
9311
9416
|
/** No source image, and no layer reading one (an opened PSD): the layers are the whole document. */
|
|
9312
9417
|
isSourceless() {
|
|
9313
9418
|
if (this.imageElement || this.state.sourceUrl || !this.state.layers.length) return false;
|
|
9314
|
-
return !
|
|
9419
|
+
return !_chunkT6H3JDGAcjs.flattenLayers.call(void 0, this.state.layers).some((l) => l.type === "pixel" && l.source === "document");
|
|
9315
9420
|
}
|
|
9316
9421
|
get isMultiLayer() {
|
|
9317
|
-
return
|
|
9422
|
+
return _chunkT6H3JDGAcjs.flattenLayers.call(void 0, this.state.layers).filter((l) => l.type === "pixel" || l.type === "group").length > 1;
|
|
9318
9423
|
}
|
|
9319
9424
|
/**
|
|
9320
9425
|
* Applies an inpainted result (natural image space, see `toSourceDataURL`) as ONE undoable step.
|
|
@@ -9332,7 +9437,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9332
9437
|
let px = await this.decodeImage(newDataUrl);
|
|
9333
9438
|
if (px.width !== width || px.height !== height) px = resizePixels(px, width, height);
|
|
9334
9439
|
const data = new Uint8ClampedArray(px.data);
|
|
9335
|
-
const sel = _optionalChain([this, 'access',
|
|
9440
|
+
const sel = _optionalChain([this, 'access', _214 => _214.state, 'access', _215 => _215.selection, 'optionalAccess', _216 => _216.bounds]) ? this.state.selection : null;
|
|
9336
9441
|
if (sel) for (let p = 0, i = 3; p < width * height; p++, i += 4) data[i] = Math.round(data[i] * sel.data[p] / 255);
|
|
9337
9442
|
return this.addPixelLayer({ name: "Inpaint", pixels: { width, height, data } });
|
|
9338
9443
|
}
|
|
@@ -9356,8 +9461,8 @@ var ImageEditorController = (_class7 = class {
|
|
|
9356
9461
|
if (px.width !== width || px.height !== height) px = resizePixels(px, width, height);
|
|
9357
9462
|
const alpha = new Uint8ClampedArray(width * height);
|
|
9358
9463
|
for (let p = 0; p < alpha.length; p++) alpha[p] = px.data[p * 4 + 3];
|
|
9359
|
-
let surface =
|
|
9360
|
-
if (target.offset.x || target.offset.y) surface =
|
|
9464
|
+
let surface = _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data: alpha }, 1, 0, 0, 0);
|
|
9465
|
+
if (target.offset.x || target.offset.y) surface = _chunkCRMAXIUVcjs.translateSurface.call(void 0, surface, -target.offset.x, -target.offset.y);
|
|
9361
9466
|
this.commitLayers(setLayerMask(this.state.layers, target.id, { surface, defaultValue: 0 }));
|
|
9362
9467
|
return target.id;
|
|
9363
9468
|
}
|
|
@@ -9384,7 +9489,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9384
9489
|
if (layer.locks) next.locks = layer.locks;
|
|
9385
9490
|
if (this.state.selectedAnnotationId === layer.annotation.id) this.state.selectedAnnotationId = null;
|
|
9386
9491
|
} else if (layer.type === "pixel") {
|
|
9387
|
-
if (!_optionalChain([layer, 'access',
|
|
9492
|
+
if (!_optionalChain([layer, 'access', _217 => _217.filters, 'optionalAccess', _218 => _218.length])) throw new LayerOperationError(`Layer "${layer.name || id}" is already pixels with no filters to bake.`);
|
|
9388
9493
|
requireUnlocked(layer, "pixels", "rasterize it");
|
|
9389
9494
|
const spatial = layer.filters.some((f) => f.enabled && f.kind === "blur");
|
|
9390
9495
|
const content = { ...layer, visible: true, opacity: 1, blend: "normal" };
|
|
@@ -9397,12 +9502,12 @@ var ImageEditorController = (_class7 = class {
|
|
|
9397
9502
|
delete next.filters;
|
|
9398
9503
|
delete next.source;
|
|
9399
9504
|
if (layer.mask && (layer.offset.x || layer.offset.y)) {
|
|
9400
|
-
next.mask = { ...layer.mask, surface:
|
|
9505
|
+
next.mask = { ...layer.mask, surface: _chunkCRMAXIUVcjs.translateSurface.call(void 0, layer.mask.surface, layer.offset.x, layer.offset.y) };
|
|
9401
9506
|
}
|
|
9402
9507
|
} else {
|
|
9403
9508
|
throw new LayerOperationError(`Only annotation layers and pixel layers with filters rasterize; "${layer.name || id}" is a ${layer.type} layer. Merge it down or flatten instead.`);
|
|
9404
9509
|
}
|
|
9405
|
-
this.commitLayers(
|
|
9510
|
+
this.commitLayers(_chunkT6H3JDGAcjs.mapLayer.call(void 0, this.state.layers, id, () => next));
|
|
9406
9511
|
return id;
|
|
9407
9512
|
}
|
|
9408
9513
|
// --- PSD ---
|
|
@@ -9429,14 +9534,14 @@ var ImageEditorController = (_class7 = class {
|
|
|
9429
9534
|
delete s.legacyOutputBlur;
|
|
9430
9535
|
s.selection = null;
|
|
9431
9536
|
s.selectedAnnotationId = null;
|
|
9432
|
-
const pixels =
|
|
9537
|
+
const pixels = _chunkT6H3JDGAcjs.flattenLayers.call(void 0, result.layers).filter((l) => l.type === "pixel");
|
|
9433
9538
|
s.activeLayerId = pixels.length ? pixels[pixels.length - 1].id : null;
|
|
9434
9539
|
s.activeTarget = "pixels";
|
|
9435
9540
|
this.psdResolution = result.resolution;
|
|
9436
9541
|
this.lastLoadProblems = result.warnings;
|
|
9437
9542
|
this.notify();
|
|
9438
9543
|
return {
|
|
9439
|
-
layerIds:
|
|
9544
|
+
layerIds: _chunkT6H3JDGAcjs.flattenLayers.call(void 0, result.layers).map((l) => l.id),
|
|
9440
9545
|
warnings: result.warnings,
|
|
9441
9546
|
width: result.width,
|
|
9442
9547
|
height: result.height,
|
|
@@ -9461,7 +9566,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9461
9566
|
const compositor = new LayerCompositor();
|
|
9462
9567
|
const bakeMask = (layer) => {
|
|
9463
9568
|
const mask = layer.mask;
|
|
9464
|
-
if (!_optionalChain([mask, 'optionalAccess',
|
|
9569
|
+
if (!_optionalChain([mask, 'optionalAccess', _219 => _219.source])) return mask;
|
|
9465
9570
|
add("Parametric (depth) masks were baked into pixel masks", layer.name);
|
|
9466
9571
|
const plain3 = { ...layer, mask: { ...mask, density: 1, feather: 0, enabled: true } };
|
|
9467
9572
|
const ox = layer.type === "pixel" ? layer.offset.x : 0;
|
|
@@ -9470,13 +9575,18 @@ var ImageEditorController = (_class7 = class {
|
|
|
9470
9575
|
const bytes = new Uint8ClampedArray(width * height);
|
|
9471
9576
|
if (coverage) for (let i = 0; i < bytes.length; i++) bytes[i] = Math.round(coverage[i] * 255);
|
|
9472
9577
|
else bytes.fill(255);
|
|
9473
|
-
const baked = { surface:
|
|
9578
|
+
const baked = { surface: _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data: bytes }, 1, -ox, -oy), defaultValue: 0 };
|
|
9474
9579
|
if (mask.density !== void 0 && mask.density < 1) baked.density = mask.density;
|
|
9475
9580
|
if (mask.feather) baked.feather = mask.feather;
|
|
9476
9581
|
if (mask.enabled === false) baked.enabled = false;
|
|
9477
9582
|
return baked;
|
|
9478
9583
|
};
|
|
9479
9584
|
const prepare = async (layer) => {
|
|
9585
|
+
const p = await prepareLayer(layer);
|
|
9586
|
+
if (_optionalChain([p, 'optionalAccess', _220 => _220.blend]) === "pigment") add("The Pigment blend mode has no PSD equivalent and was written as Normal", layer.name);
|
|
9587
|
+
return p;
|
|
9588
|
+
};
|
|
9589
|
+
const prepareLayer = async (layer) => {
|
|
9480
9590
|
if (layer.type === "group") {
|
|
9481
9591
|
const children = [];
|
|
9482
9592
|
for (const c of layer.children) {
|
|
@@ -9504,7 +9614,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9504
9614
|
visible: layer.visible,
|
|
9505
9615
|
opacity: layer.opacity,
|
|
9506
9616
|
blend,
|
|
9507
|
-
surface:
|
|
9617
|
+
surface: _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4),
|
|
9508
9618
|
offset: { x: 0, y: 0 }
|
|
9509
9619
|
};
|
|
9510
9620
|
if (layer.clipped) out2.clipped = true;
|
|
@@ -9518,7 +9628,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9518
9628
|
out.surface = this.surfaceOf(layer);
|
|
9519
9629
|
delete out.source;
|
|
9520
9630
|
}
|
|
9521
|
-
const active = _nullishCoalesce(_optionalChain([layer, 'access',
|
|
9631
|
+
const active = _nullishCoalesce(_optionalChain([layer, 'access', _221 => _221.filters, 'optionalAccess', _222 => _222.filter, 'call', _223 => _223(isActiveFilter)]), () => ( []));
|
|
9522
9632
|
if (active.length) {
|
|
9523
9633
|
add("Layer filters (develop, blur) were baked into the pixels", layer.name);
|
|
9524
9634
|
const content = { ...out, visible: true, opacity: 1, blend: "normal" };
|
|
@@ -9526,9 +9636,9 @@ var ImageEditorController = (_class7 = class {
|
|
|
9526
9636
|
delete content.clipped;
|
|
9527
9637
|
delete content.fillOpacity;
|
|
9528
9638
|
const data = compositor.composite([content], canvas, sources);
|
|
9529
|
-
out = { ...out, surface:
|
|
9639
|
+
out = { ...out, surface: _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, -layer.offset.x, -layer.offset.y) };
|
|
9530
9640
|
}
|
|
9531
|
-
if (_optionalChain([layer, 'access',
|
|
9641
|
+
if (_optionalChain([layer, 'access', _224 => _224.filters, 'optionalAccess', _225 => _225.some, 'call', _226 => _226((f) => !f.enabled)])) add("Disabled layer filters were left out", layer.name);
|
|
9532
9642
|
delete out.filters;
|
|
9533
9643
|
const mask = bakeMask(layer);
|
|
9534
9644
|
if (mask) out.mask = mask;
|
|
@@ -9580,16 +9690,16 @@ var ImageEditorController = (_class7 = class {
|
|
|
9580
9690
|
);
|
|
9581
9691
|
}
|
|
9582
9692
|
layers = resizeLegacyMasks(layers, prev, next.dimensions);
|
|
9583
|
-
for (const l of
|
|
9693
|
+
for (const l of _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers)) {
|
|
9584
9694
|
if (l.type === "annotation") {
|
|
9585
|
-
layers =
|
|
9695
|
+
layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, l.id, () => ({ ...l, annotation: scaleAnnotation(l.annotation, sx, sy) }));
|
|
9586
9696
|
}
|
|
9587
9697
|
}
|
|
9588
9698
|
}
|
|
9589
9699
|
const bg = developTarget(layers, null);
|
|
9590
|
-
if (bg && bg.source !== "document") layers =
|
|
9700
|
+
if (bg && bg.source !== "document") layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, bg.id, () => ({ ...bg, source: "document" }));
|
|
9591
9701
|
if (clearAnnotations) {
|
|
9592
|
-
for (const l of
|
|
9702
|
+
for (const l of _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers)) if (l.type === "annotation") layers = _chunkT6H3JDGAcjs.mapLayer.call(void 0, layers, l.id, () => null);
|
|
9593
9703
|
this.state.selectedAnnotationId = null;
|
|
9594
9704
|
}
|
|
9595
9705
|
this.state.layers = layers;
|
|
@@ -9597,7 +9707,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9597
9707
|
}
|
|
9598
9708
|
toJSON(options) {
|
|
9599
9709
|
const out = this.serializeState();
|
|
9600
|
-
if (_optionalChain([this, 'access',
|
|
9710
|
+
if (_optionalChain([this, 'access', _227 => _227.state, 'access', _228 => _228.selection, 'optionalAccess', _229 => _229.bounds])) out.selection = serializeSelection(this.state.selection);
|
|
9601
9711
|
if (!options || out.version !== LAYERED_SCHEMA_VERSION) return options ? Promise.resolve(out) : out;
|
|
9602
9712
|
return serializeLayersExternal(this.state.layers, options.store).then(({ layers, assets }) => ({ ...out, layers, assets }));
|
|
9603
9713
|
}
|
|
@@ -9633,7 +9743,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9633
9743
|
this.notify();
|
|
9634
9744
|
}
|
|
9635
9745
|
/** Problems found by the last `loadJSON` / `initialState` of a v3 document (unreadable layers or assets). */
|
|
9636
|
-
|
|
9746
|
+
__init51() {this.lastLoadProblems = []}
|
|
9637
9747
|
applyStored(raw) {
|
|
9638
9748
|
const s = this.state;
|
|
9639
9749
|
const data = migrateSerializedImageEditorState(raw);
|
|
@@ -9647,7 +9757,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9647
9757
|
s.outputOpacity = data.opacity;
|
|
9648
9758
|
if (typeof data.legacyOutputBlur === "number" && data.legacyOutputBlur >= 0) s.legacyOutputBlur = data.legacyOutputBlur;
|
|
9649
9759
|
else delete s.legacyOutputBlur;
|
|
9650
|
-
s.activeLayerId = data.activeLayerId &&
|
|
9760
|
+
s.activeLayerId = data.activeLayerId && _chunkT6H3JDGAcjs.findLayer.call(void 0, s.layers, data.activeLayerId) ? data.activeLayerId : null;
|
|
9651
9761
|
const light = data.globalLight;
|
|
9652
9762
|
if (light && Number.isFinite(light.angle) && Number.isFinite(light.altitude)) s.globalLight = { angle: light.angle, altitude: Math.min(90, Math.max(0, light.altitude)) };
|
|
9653
9763
|
else delete s.globalLight;
|
|
@@ -9677,7 +9787,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9677
9787
|
if (view.exact && !this.state.globalLight) {
|
|
9678
9788
|
return {
|
|
9679
9789
|
// States without adjustment layers keep schema 1, so they round-trip unchanged.
|
|
9680
|
-
version: _optionalChain([view, 'access',
|
|
9790
|
+
version: _optionalChain([view, 'access', _230 => _230.adjustments, 'access', _231 => _231.layers, 'optionalAccess', _232 => _232.length]) ? 2 : 1,
|
|
9681
9791
|
crop: this.state.crop ? { ...this.state.crop } : null,
|
|
9682
9792
|
transform: { ...this.state.transform },
|
|
9683
9793
|
adjustments: serializeAdjustments(view.adjustments),
|
|
@@ -9707,7 +9817,7 @@ var ImageEditorController = (_class7 = class {
|
|
|
9707
9817
|
}, _class7);
|
|
9708
9818
|
function serializeAdjustments(adjustments) {
|
|
9709
9819
|
const out = { ...adjustments };
|
|
9710
|
-
if (_optionalChain([out, 'access',
|
|
9820
|
+
if (_optionalChain([out, 'access', _233 => _233.layers, 'optionalAccess', _234 => _234.length])) out.layers = JSON.parse(JSON.stringify(out.layers));
|
|
9711
9821
|
else delete out.layers;
|
|
9712
9822
|
if (normalizeProcessVersion(out.process) === LEGACY_PROCESS_VERSION) {
|
|
9713
9823
|
delete out.process;
|
|
@@ -9743,11 +9853,11 @@ function withDevelop(layer, partial) {
|
|
|
9743
9853
|
return { ...layer, filters };
|
|
9744
9854
|
}
|
|
9745
9855
|
function withBlur(layer, radius) {
|
|
9746
|
-
const existing = _optionalChain([layer, 'access',
|
|
9856
|
+
const existing = _optionalChain([layer, 'access', _235 => _235.filters, 'optionalAccess', _236 => _236.find, 'call', _237 => _237((f) => f.kind === "blur")]);
|
|
9747
9857
|
const filters = (_nullishCoalesce(layer.filters, () => ( []))).filter((f) => f.kind !== "blur");
|
|
9748
9858
|
if (radius > 0) {
|
|
9749
9859
|
filters.push({
|
|
9750
|
-
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
9860
|
+
id: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _238 => _238.id]), () => ( (layer.source === "document" ? BLUR_FILTER_ID : newLayerId("flt")))),
|
|
9751
9861
|
kind: "blur",
|
|
9752
9862
|
enabled: true,
|
|
9753
9863
|
radius
|
|
@@ -9811,27 +9921,27 @@ function resizeLegacyMasks(layers, from, to) {
|
|
|
9811
9921
|
const th = Math.max(1, Math.round(to.height));
|
|
9812
9922
|
if (fw === tw && fh === th) return layers;
|
|
9813
9923
|
let out = layers;
|
|
9814
|
-
for (const l of
|
|
9924
|
+
for (const l of _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers)) {
|
|
9815
9925
|
if (l.type !== "adjustment" || !l.mask || l.mask.source) continue;
|
|
9816
9926
|
const old = l.mask;
|
|
9817
9927
|
const mask = rasterMaskFromLegacy(legacyMaskOf(old, fw, fh), tw, th);
|
|
9818
9928
|
if (!mask) continue;
|
|
9819
|
-
out =
|
|
9929
|
+
out = _chunkT6H3JDGAcjs.mapLayer.call(void 0, out, l.id, (n) => ({ ...n, mask: { ...mask, density: old.density, feather: old.feather, enabled: old.enabled } }));
|
|
9820
9930
|
}
|
|
9821
9931
|
return out;
|
|
9822
9932
|
}
|
|
9823
9933
|
function isOpaqueInside(surface, width, height) {
|
|
9824
9934
|
const row = new Uint8ClampedArray(width * 4);
|
|
9825
9935
|
for (let y = 0; y < height; y++) {
|
|
9826
|
-
|
|
9936
|
+
_chunkCRMAXIUVcjs.readRegion.call(void 0, surface, { x: 0, y, width, height: 1 }, row);
|
|
9827
9937
|
for (let i = 3; i < row.length; i += 4) if (row[i] !== 255) return false;
|
|
9828
9938
|
}
|
|
9829
9939
|
return true;
|
|
9830
9940
|
}
|
|
9831
9941
|
function collectStateTiles(layers, into) {
|
|
9832
|
-
for (const l of
|
|
9833
|
-
if (l.type === "pixel" && l.source !== "document")
|
|
9834
|
-
if (l.mask && !l.mask.source)
|
|
9942
|
+
for (const l of _chunkT6H3JDGAcjs.flattenLayers.call(void 0, layers)) {
|
|
9943
|
+
if (l.type === "pixel" && l.source !== "document") _chunkCRMAXIUVcjs.collectTiles.call(void 0, l.surface, into);
|
|
9944
|
+
if (l.mask && !l.mask.source) _chunkCRMAXIUVcjs.collectTiles.call(void 0, l.mask.surface, into);
|
|
9835
9945
|
}
|
|
9836
9946
|
}
|
|
9837
9947
|
function pixelsOnly(layers) {
|
|
@@ -9839,7 +9949,7 @@ function pixelsOnly(layers) {
|
|
|
9839
9949
|
for (const l of layers) {
|
|
9840
9950
|
if (l.type === "adjustment") continue;
|
|
9841
9951
|
if (l.type === "group") out.push({ ...l, children: pixelsOnly(l.children) });
|
|
9842
|
-
else if (l.type === "pixel" && _optionalChain([l, 'access',
|
|
9952
|
+
else if (l.type === "pixel" && _optionalChain([l, 'access', _239 => _239.filters, 'optionalAccess', _240 => _240.length])) {
|
|
9843
9953
|
const p = { ...l };
|
|
9844
9954
|
delete p.filters;
|
|
9845
9955
|
out.push(p);
|
|
@@ -9897,7 +10007,7 @@ function toHex2(c) {
|
|
|
9897
10007
|
return "#" + [c[0], c[1], c[2]].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("");
|
|
9898
10008
|
}
|
|
9899
10009
|
function normalizeSelection(mask) {
|
|
9900
|
-
return _optionalChain([mask, 'optionalAccess',
|
|
10010
|
+
return _optionalChain([mask, 'optionalAccess', _241 => _241.bounds]) ? mask : null;
|
|
9901
10011
|
}
|
|
9902
10012
|
function sameSelection(a, b) {
|
|
9903
10013
|
if (a.width !== b.width || a.height !== b.height) return false;
|
|
@@ -10058,7 +10168,7 @@ function loadImageEditorDocument(input) {
|
|
|
10058
10168
|
}
|
|
10059
10169
|
const state = { version: 1, ...result.value };
|
|
10060
10170
|
if (isV2) {
|
|
10061
|
-
if (_optionalChain([state, 'access',
|
|
10171
|
+
if (_optionalChain([state, 'access', _242 => _242.adjustments, 'access', _243 => _243.layers, 'optionalAccess', _244 => _244.length])) state.version = 2;
|
|
10062
10172
|
result.report.version = 2;
|
|
10063
10173
|
}
|
|
10064
10174
|
if (state.selection === void 0) delete state.selection;
|
|
@@ -10258,7 +10368,7 @@ function findAdjustmentControl(id) {
|
|
|
10258
10368
|
}
|
|
10259
10369
|
function findLayerControl(kind, id) {
|
|
10260
10370
|
if (id === "opacity") return ADJUSTMENT_LAYER_OPACITY_CONTROL;
|
|
10261
|
-
return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access',
|
|
10371
|
+
return _optionalChain([ADJUSTMENT_LAYER_CONTROLS, 'access', _245 => _245[kind], 'optionalAccess', _246 => _246.find, 'call', _247 => _247((c) => c.id === id)]);
|
|
10262
10372
|
}
|
|
10263
10373
|
function clampControlValue(spec, v) {
|
|
10264
10374
|
if (typeof v !== "number" || !Number.isFinite(v)) return spec.default;
|
|
@@ -10377,7 +10487,7 @@ function summary(controller) {
|
|
|
10377
10487
|
const area = selectionArea(sel);
|
|
10378
10488
|
return {
|
|
10379
10489
|
empty: !sel,
|
|
10380
|
-
bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess',
|
|
10490
|
+
bounds: _nullishCoalesce(_optionalChain([sel, 'optionalAccess', _248 => _248.bounds]), () => ( null)),
|
|
10381
10491
|
/** Σ coverage in pixels. */
|
|
10382
10492
|
area: Math.round(area),
|
|
10383
10493
|
percent: Math.round(area / Math.max(1, width * height) * 1e4) / 100,
|
|
@@ -10621,7 +10731,7 @@ async function renderImageRegion(controller, request) {
|
|
|
10621
10731
|
if (request.includeOverlays) {
|
|
10622
10732
|
const s = request.scale;
|
|
10623
10733
|
const selection = state.selection;
|
|
10624
|
-
if (_optionalChain([selection, 'optionalAccess',
|
|
10734
|
+
if (_optionalChain([selection, 'optionalAccess', _249 => _249.bounds]) && selection.width === state.imageDimensions.width && selection.height === state.imageDimensions.height) {
|
|
10625
10735
|
const shade = selectionShade(selection, document);
|
|
10626
10736
|
if (shade) context.drawImage(shade, rect.x, rect.y, rect.width, rect.height, 0, 0, out.width, out.height);
|
|
10627
10737
|
}
|
|
@@ -10646,7 +10756,7 @@ function createImageCaptureSurface(controller) {
|
|
|
10646
10756
|
return {
|
|
10647
10757
|
units: "image pixels",
|
|
10648
10758
|
content: whole,
|
|
10649
|
-
selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access',
|
|
10759
|
+
selection: () => ({ rect: _nullishCoalesce(_optionalChain([controller, 'access', _250 => _250.getState, 'call', _251 => _251(), 'access', _252 => _252.selection, 'optionalAccess', _253 => _253.bounds]), () => ( null)) }),
|
|
10650
10760
|
overlays: "a shade over unselected pixels and the crop box outline",
|
|
10651
10761
|
maxScale: 8,
|
|
10652
10762
|
render: (request) => renderImageRegion(controller, request)
|
|
@@ -10758,7 +10868,7 @@ function createImageEditTools(controller) {
|
|
|
10758
10868
|
properties: {
|
|
10759
10869
|
layer: LAYER_ID,
|
|
10760
10870
|
enabled: { type: "boolean", description: "false hides the layer without deleting it." },
|
|
10761
|
-
blend: { type: "string", enum:
|
|
10871
|
+
blend: { type: "string", enum: _chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id), description: "Blend mode (see list_controls)." },
|
|
10762
10872
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0-1." },
|
|
10763
10873
|
name: { type: "string", description: "Layer name shown in the layers panel." }
|
|
10764
10874
|
},
|
|
@@ -10771,7 +10881,7 @@ function createImageEditTools(controller) {
|
|
|
10771
10881
|
if (enabled === void 0 && blend === void 0 && opacity === void 0 && name === void 0) {
|
|
10772
10882
|
throw new Error("Nothing to change. Pass enabled, blend, opacity or name.");
|
|
10773
10883
|
}
|
|
10774
|
-
if (blend !== void 0 && !
|
|
10884
|
+
if (blend !== void 0 && !_chunkCRMAXIUVcjs.isBlendMode.call(void 0, blend)) throw new Error(`Unknown blend mode "${blend}".`);
|
|
10775
10885
|
controller.updateAdjustmentLayer(layer, { enabled, blend, opacity, name });
|
|
10776
10886
|
return { layer: layerJson(layer) };
|
|
10777
10887
|
}
|
|
@@ -10924,7 +11034,7 @@ function maskSummary(mask) {
|
|
|
10924
11034
|
};
|
|
10925
11035
|
if (!mask.source) {
|
|
10926
11036
|
out.defaultValue = mask.defaultValue;
|
|
10927
|
-
out.paintedBounds =
|
|
11037
|
+
out.paintedBounds = _chunkCRMAXIUVcjs.contentBounds.call(void 0, mask.surface);
|
|
10928
11038
|
}
|
|
10929
11039
|
return out;
|
|
10930
11040
|
}
|
|
@@ -10971,7 +11081,7 @@ var PLACEMENT = {
|
|
|
10971
11081
|
parentId: { type: "string", description: "Put the layer inside this group (at index, default its top)." },
|
|
10972
11082
|
index: { type: "integer", minimum: 0, description: "Position among the siblings, 0 = bottom (with parentId, or at the top level)." }
|
|
10973
11083
|
};
|
|
10974
|
-
var BLEND = { type: "string", enum:
|
|
11084
|
+
var BLEND = { type: "string", enum: _chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id), description: "Blend mode (default normal)." };
|
|
10975
11085
|
function placementFrom(args) {
|
|
10976
11086
|
const p = {};
|
|
10977
11087
|
if (typeof args.aboveId === "string") p.aboveId = args.aboveId;
|
|
@@ -10983,11 +11093,11 @@ function placementFrom(args) {
|
|
|
10983
11093
|
function createImageLayerTools(controller) {
|
|
10984
11094
|
const describe = (id) => {
|
|
10985
11095
|
const s = controller.getState();
|
|
10986
|
-
const loc =
|
|
11096
|
+
const loc = _chunkT6H3JDGAcjs.findLayer.call(void 0, s.layers, id);
|
|
10987
11097
|
if (!loc) return null;
|
|
10988
11098
|
return {
|
|
10989
11099
|
...describeLayer(loc.layer, s.activeLayerId, (x) => controller.getLayerBounds(x.id)),
|
|
10990
|
-
parentId: _nullishCoalesce(_optionalChain([loc, 'access',
|
|
11100
|
+
parentId: _nullishCoalesce(_optionalChain([loc, 'access', _254 => _254.parent, 'optionalAccess', _255 => _255.id]), () => ( null)),
|
|
10991
11101
|
index: loc.index
|
|
10992
11102
|
};
|
|
10993
11103
|
};
|
|
@@ -11121,7 +11231,7 @@ function createImageLayerTools(controller) {
|
|
|
11121
11231
|
visible: { type: "boolean", description: "Show (true) or hide (false)." },
|
|
11122
11232
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0..1." },
|
|
11123
11233
|
fillOpacity: { type: "number", minimum: 0, maximum: 1, description: "Fill 0..1 (pixel layers)." },
|
|
11124
|
-
blend: { type: "string", enum: [...
|
|
11234
|
+
blend: { type: "string", enum: [..._chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id), "pass-through"], description: "Blend mode; pass-through for groups only." },
|
|
11125
11235
|
clipped: { type: "boolean", description: "Clip to the nearest unclipped layer below." },
|
|
11126
11236
|
locks: {
|
|
11127
11237
|
type: "object",
|
|
@@ -11176,7 +11286,7 @@ function createImageLayerTools(controller) {
|
|
|
11176
11286
|
type: "object",
|
|
11177
11287
|
properties: {
|
|
11178
11288
|
name: { type: "string", description: 'Group name (default "Group").' },
|
|
11179
|
-
blend: { type: "string", enum: [...
|
|
11289
|
+
blend: { type: "string", enum: [..._chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id), "pass-through"], description: "Blend mode (default pass-through)." },
|
|
11180
11290
|
...PLACEMENT
|
|
11181
11291
|
},
|
|
11182
11292
|
additionalProperties: false
|
|
@@ -11442,7 +11552,7 @@ var WRITE_IDEMPOTENT3 = { readOnlyHint: false, destructiveHint: false, idempoten
|
|
|
11442
11552
|
var DESTRUCTIVE2 = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
11443
11553
|
var LAYER_ID3 = { type: "string", description: "Layer id from list_layers (a pixel, annotation or group layer)." };
|
|
11444
11554
|
var EFFECT_ID = { type: "string", description: "Effect id from list_layer_effects or add_layer_effect." };
|
|
11445
|
-
var BLEND_IDS =
|
|
11555
|
+
var BLEND_IDS = _chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id);
|
|
11446
11556
|
var DEFS = {
|
|
11447
11557
|
color: { type: "string", pattern: "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$", description: "Colour as #rrggbb." },
|
|
11448
11558
|
contour: {
|
|
@@ -11634,8 +11744,8 @@ function settingsSchema(forUpdate) {
|
|
|
11634
11744
|
};
|
|
11635
11745
|
}
|
|
11636
11746
|
function patternList() {
|
|
11637
|
-
return
|
|
11638
|
-
const p =
|
|
11747
|
+
return _chunkT6H3JDGAcjs.builtinPatternIds.call(void 0, ).map((id) => {
|
|
11748
|
+
const p = _chunkT6H3JDGAcjs.builtinPattern.call(void 0, id);
|
|
11639
11749
|
return { id, name: p.name, width: p.width, height: p.height, builtin: true };
|
|
11640
11750
|
});
|
|
11641
11751
|
}
|
|
@@ -11643,9 +11753,9 @@ function describeLayerEffects(effects) {
|
|
|
11643
11753
|
return {
|
|
11644
11754
|
enabled: effects.enabled,
|
|
11645
11755
|
scale: _nullishCoalesce(effects.scale, () => ( 1)),
|
|
11646
|
-
margin:
|
|
11756
|
+
margin: _chunkT6H3JDGAcjs.effectsMargin.call(void 0, effects),
|
|
11647
11757
|
fromPsd: Boolean(effects.psd),
|
|
11648
|
-
effects: effects.items.map((e) => ({ ...JSON.parse(JSON.stringify(e)), label:
|
|
11758
|
+
effects: effects.items.map((e) => ({ ...JSON.parse(JSON.stringify(e)), label: _chunkT6H3JDGAcjs.layerEffectLabel.call(void 0, e.kind) }))
|
|
11649
11759
|
};
|
|
11650
11760
|
}
|
|
11651
11761
|
function createImageEffectTools(controller) {
|
|
@@ -11661,7 +11771,7 @@ function createImageEffectTools(controller) {
|
|
|
11661
11771
|
description: "Returns a layer's effects: the master switch (enabled), Scale Effects (scale, 1 = 100 %), margin (px the effects reach beyond the shape), whether they came from a PSD, and every effect with its id, kind, label and all settings. Also returns the document global light and the pattern ids pattern effects can use.",
|
|
11662
11772
|
inputSchema: { type: "object", properties: { layerId: LAYER_ID3 }, required: ["layerId"], additionalProperties: false },
|
|
11663
11773
|
annotations: { title: "List layer effects", ...READ3 },
|
|
11664
|
-
handler: ({ layerId }) => result(layerArg(layerId), { globalLight: controller.getGlobalLight(), patterns: patternList(), kinds: [...
|
|
11774
|
+
handler: ({ layerId }) => result(layerArg(layerId), { globalLight: controller.getGlobalLight(), patterns: patternList(), kinds: [..._chunkT6H3JDGAcjs.LAYER_EFFECT_KINDS] })
|
|
11665
11775
|
};
|
|
11666
11776
|
const add = {
|
|
11667
11777
|
name: "add_layer_effect",
|
|
@@ -11672,7 +11782,7 @@ function createImageEffectTools(controller) {
|
|
|
11672
11782
|
$defs: DEFS,
|
|
11673
11783
|
properties: {
|
|
11674
11784
|
layerId: LAYER_ID3,
|
|
11675
|
-
kind: { type: "string", enum: [...
|
|
11785
|
+
kind: { type: "string", enum: [..._chunkT6H3JDGAcjs.LAYER_EFFECT_KINDS], description: "Effect kind." },
|
|
11676
11786
|
settings: settingsSchema(false),
|
|
11677
11787
|
index: { type: "integer", minimum: 0, description: "Position in the layer's effect list (default the end)." }
|
|
11678
11788
|
},
|
|
@@ -11682,7 +11792,7 @@ function createImageEffectTools(controller) {
|
|
|
11682
11792
|
annotations: { title: "Add a layer effect", ...WRITE3 },
|
|
11683
11793
|
handler: ({ layerId, kind, settings, index }) => {
|
|
11684
11794
|
const id = layerArg(layerId);
|
|
11685
|
-
if (!
|
|
11795
|
+
if (!_chunkT6H3JDGAcjs.isLayerEffectKind.call(void 0, kind)) throw new LayerOperationError(`kind must be one of ${_chunkT6H3JDGAcjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
11686
11796
|
const { effect } = controller.addLayerEffect(id, kind, _nullishCoalesce(settings, () => ( {})), index);
|
|
11687
11797
|
return result(id, { effectId: effect.id });
|
|
11688
11798
|
}
|
|
@@ -11764,7 +11874,160 @@ function createImageEffectTools(controller) {
|
|
|
11764
11874
|
return [list, add, update, remove, setEnabled, light];
|
|
11765
11875
|
}
|
|
11766
11876
|
|
|
11877
|
+
// src/image-editor/layers/paint-ui.ts
|
|
11878
|
+
var plain2 = { kind: "plain" };
|
|
11879
|
+
var BRUSH_OPTION_CONTROLS = [
|
|
11880
|
+
{ id: "size", label: "Size", section: "layer", min: 1, max: 500, step: 1, default: 20, decimals: 0, track: plain2, unit: "px" },
|
|
11881
|
+
{ id: "hardness", label: "Hardness", section: "layer", min: 0, max: 1, step: 0.01, default: 1, decimals: 0, track: plain2, displayScale: 100, unit: "%" },
|
|
11882
|
+
{ id: "opacity", label: "Opacity", section: "layer", min: 0, max: 1, step: 0.01, default: 1, decimals: 0, track: plain2, displayScale: 100, unit: "%" },
|
|
11883
|
+
{ id: "flow", label: "Flow", section: "layer", min: 0, max: 1, step: 0.01, default: 1, decimals: 0, track: plain2, displayScale: 100, unit: "%" },
|
|
11884
|
+
{ id: "smoothing", label: "Smoothing", section: "layer", min: 0, max: 0.95, step: 0.01, default: 0, decimals: 0, track: plain2, displayScale: 100, unit: "%" }
|
|
11885
|
+
];
|
|
11886
|
+
var MIXER_OPTION_CONTROLS = [
|
|
11887
|
+
{ id: "wet", label: "Wet", section: "layer", min: 0, max: 1, step: 0.01, default: 0.5, decimals: 0, track: plain2, displayScale: 100, unit: "%" },
|
|
11888
|
+
{ id: "load", label: "Load", section: "layer", min: 0, max: 1, step: 0.01, default: 0.5, decimals: 0, track: plain2, displayScale: 100, unit: "%" },
|
|
11889
|
+
{ id: "mix", label: "Mix", section: "layer", min: 0, max: 1, step: 0.01, default: 0.5, decimals: 0, track: plain2, displayScale: 100, unit: "%" }
|
|
11890
|
+
];
|
|
11891
|
+
var MIXER_MIXING_OPTIONS = [
|
|
11892
|
+
{ id: "rgb", label: "RGB", title: "Mix colours as RGB averages" },
|
|
11893
|
+
{ id: "pigment", label: "Pigment", title: "Mix colours like paint: blue and yellow make green" }
|
|
11894
|
+
];
|
|
11895
|
+
var PAINT_TOOLS = [
|
|
11896
|
+
{ id: "move", label: "Move", shortcut: "V" },
|
|
11897
|
+
{ id: "brush", label: "Brush", shortcut: "B" },
|
|
11898
|
+
{ id: "mixer", label: "Mixer", shortcut: "Shift+B" },
|
|
11899
|
+
{ id: "eraser", label: "Eraser", shortcut: "E" }
|
|
11900
|
+
];
|
|
11901
|
+
var isPaintTool = (tool) => tool === "move" || tool === "brush" || tool === "mixer" || tool === "eraser";
|
|
11902
|
+
function rgbUnitToHex(c) {
|
|
11903
|
+
return `#${c.map((v) => Math.round(Math.min(1, Math.max(0, v)) * 255).toString(16).padStart(2, "0")).join("")}`;
|
|
11904
|
+
}
|
|
11905
|
+
function sizeStep(size) {
|
|
11906
|
+
return size < 10 ? 1 : size < 50 ? 5 : size < 100 ? 10 : size < 200 ? 25 : size < 500 ? 50 : 100;
|
|
11907
|
+
}
|
|
11908
|
+
var isTyping = (t) => {
|
|
11909
|
+
const el = t;
|
|
11910
|
+
return Boolean(el && (el.isContentEditable || el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT"));
|
|
11911
|
+
};
|
|
11912
|
+
function handlePaintShortcut(controller, e) {
|
|
11913
|
+
if (e.ctrlKey || e.metaKey || e.altKey || isTyping(e.target)) return false;
|
|
11914
|
+
const brush = controller.getState().paint.brush;
|
|
11915
|
+
const set = (b) => controller.setPaintOptions({ brush: b });
|
|
11916
|
+
const key = e.key;
|
|
11917
|
+
switch (key.toLowerCase()) {
|
|
11918
|
+
case "b":
|
|
11919
|
+
controller.setTool(e.shiftKey || key === "B" ? "mixer" : "brush");
|
|
11920
|
+
return true;
|
|
11921
|
+
case "e":
|
|
11922
|
+
controller.setTool("eraser");
|
|
11923
|
+
return true;
|
|
11924
|
+
case "v":
|
|
11925
|
+
controller.setTool("move");
|
|
11926
|
+
return true;
|
|
11927
|
+
case "d":
|
|
11928
|
+
controller.resetPaintColors();
|
|
11929
|
+
return true;
|
|
11930
|
+
case "x":
|
|
11931
|
+
controller.swapPaintColors();
|
|
11932
|
+
return true;
|
|
11933
|
+
}
|
|
11934
|
+
if (key === "[" || key === "{") {
|
|
11935
|
+
if (e.shiftKey || key === "{") set({ hardness: Math.max(0, Math.round((brush.hardness - 0.25) * 4) / 4) });
|
|
11936
|
+
else set({ size: Math.max(1, brush.size - sizeStep(brush.size - 1)) });
|
|
11937
|
+
return true;
|
|
11938
|
+
}
|
|
11939
|
+
if (key === "]" || key === "}") {
|
|
11940
|
+
if (e.shiftKey || key === "}") set({ hardness: Math.min(1, Math.round((brush.hardness + 0.25) * 4) / 4) });
|
|
11941
|
+
else set({ size: Math.min(_chunkZZOTHJ4Kcjs.MAX_BRUSH_SIZE, brush.size + sizeStep(brush.size)) });
|
|
11942
|
+
return true;
|
|
11943
|
+
}
|
|
11944
|
+
if (/^[0-9]$/.test(key) && isPaintTool(controller.getState().activeTool)) {
|
|
11945
|
+
set({ opacity: key === "0" ? 1 : Number(key) / 10 });
|
|
11946
|
+
return true;
|
|
11947
|
+
}
|
|
11948
|
+
return false;
|
|
11949
|
+
}
|
|
11950
|
+
function pointerPressure(e) {
|
|
11951
|
+
if (e.pointerType === "pen" && typeof e.pressure === "number" && e.pressure > 0) return Math.min(1, e.pressure);
|
|
11952
|
+
return 1;
|
|
11953
|
+
}
|
|
11954
|
+
var PaintGesture = (_class8 = class {
|
|
11955
|
+
constructor(controller) {;_class8.prototype.__init52.call(this);_class8.prototype.__init53.call(this);_class8.prototype.__init54.call(this);
|
|
11956
|
+
this.controller = controller;
|
|
11957
|
+
}
|
|
11958
|
+
|
|
11959
|
+
__init52() {this.stroke = null}
|
|
11960
|
+
__init53() {this.move = null}
|
|
11961
|
+
/** The last refusal (e.g. "layer is locked"), for the editor to show. */
|
|
11962
|
+
__init54() {this.error = null}
|
|
11963
|
+
get active() {
|
|
11964
|
+
return Boolean(this.stroke || this.move);
|
|
11965
|
+
}
|
|
11966
|
+
down(sample) {
|
|
11967
|
+
this.error = null;
|
|
11968
|
+
const tool = this.controller.getState().activeTool;
|
|
11969
|
+
try {
|
|
11970
|
+
if (tool === "move") {
|
|
11971
|
+
const layer = this.controller.getActiveLayer();
|
|
11972
|
+
if (!layer) throw new Error("Select a layer to move in the Layers panel.");
|
|
11973
|
+
if (layer.type !== "pixel") throw new Error(`Only pixel layers move; "${layer.name}" is a ${layer.type} layer.`);
|
|
11974
|
+
if (_optionalChain([layer, 'access', _256 => _256.locks, 'optionalAccess', _257 => _257.all]) || _optionalChain([layer, 'access', _258 => _258.locks, 'optionalAccess', _259 => _259.position])) throw new Error(`Layer "${layer.name}" has its position locked.`);
|
|
11975
|
+
this.move = { id: layer.id, start: { x: sample.x, y: sample.y }, origin: { ...layer.offset }, moved: false };
|
|
11976
|
+
return null;
|
|
11977
|
+
}
|
|
11978
|
+
if (tool === "brush" || tool === "eraser" || tool === "mixer") {
|
|
11979
|
+
this.stroke = this.controller.beginStroke({ tool });
|
|
11980
|
+
this.stroke.push([sample]);
|
|
11981
|
+
return null;
|
|
11982
|
+
}
|
|
11983
|
+
} catch (err) {
|
|
11984
|
+
this.error = err instanceof Error ? err.message : String(err);
|
|
11985
|
+
this.stroke = null;
|
|
11986
|
+
this.move = null;
|
|
11987
|
+
}
|
|
11988
|
+
return this.error;
|
|
11989
|
+
}
|
|
11990
|
+
/** Feeds pointer samples (all coalesced events of one move, in order). */
|
|
11991
|
+
moveTo(samples) {
|
|
11992
|
+
if (!samples.length) return;
|
|
11993
|
+
if (this.stroke) {
|
|
11994
|
+
this.stroke.push(samples);
|
|
11995
|
+
return;
|
|
11996
|
+
}
|
|
11997
|
+
const m = this.move;
|
|
11998
|
+
if (m) {
|
|
11999
|
+
const last = samples[samples.length - 1];
|
|
12000
|
+
const x = m.origin.x + Math.round(last.x - m.start.x);
|
|
12001
|
+
const y = m.origin.y + Math.round(last.y - m.start.y);
|
|
12002
|
+
try {
|
|
12003
|
+
this.controller.offsetLayer(m.id, { x, y }, !m.moved);
|
|
12004
|
+
m.moved = true;
|
|
12005
|
+
} catch (err) {
|
|
12006
|
+
this.error = err instanceof Error ? err.message : String(err);
|
|
12007
|
+
this.move = null;
|
|
12008
|
+
}
|
|
12009
|
+
}
|
|
12010
|
+
}
|
|
12011
|
+
up() {
|
|
12012
|
+
if (this.stroke) {
|
|
12013
|
+
try {
|
|
12014
|
+
this.stroke.end();
|
|
12015
|
+
} catch (err) {
|
|
12016
|
+
this.error = err instanceof Error ? err.message : String(err);
|
|
12017
|
+
}
|
|
12018
|
+
}
|
|
12019
|
+
this.stroke = null;
|
|
12020
|
+
this.move = null;
|
|
12021
|
+
}
|
|
12022
|
+
cancel() {
|
|
12023
|
+
_optionalChain([this, 'access', _260 => _260.stroke, 'optionalAccess', _261 => _261.cancel, 'call', _262 => _262()]);
|
|
12024
|
+
this.stroke = null;
|
|
12025
|
+
this.move = null;
|
|
12026
|
+
}
|
|
12027
|
+
}, _class8);
|
|
12028
|
+
|
|
11767
12029
|
// src/image-editor/paint-tools.ts
|
|
12030
|
+
var READ4 = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11768
12031
|
var WRITE4 = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
|
|
11769
12032
|
var DESTRUCTIVE3 = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
11770
12033
|
var TARGET = {
|
|
@@ -11775,7 +12038,7 @@ var BRUSH = {
|
|
|
11775
12038
|
type: "object",
|
|
11776
12039
|
description: "Brush settings; missing fields use the current paint options (default round, hard, 20 px).",
|
|
11777
12040
|
properties: {
|
|
11778
|
-
size: { type: "number", minimum: 1, maximum:
|
|
12041
|
+
size: { type: "number", minimum: 1, maximum: _chunkZZOTHJ4Kcjs.MAX_BRUSH_SIZE, description: "Diameter in px (default 20)." },
|
|
11779
12042
|
hardness: { type: "number", minimum: 0, maximum: 1, description: "Edge hardness 0 (soft) .. 1 (hard, default)." },
|
|
11780
12043
|
spacing: { type: "number", minimum: 0.01, maximum: 10, description: "Dab spacing as a fraction of the diameter (default 0.1)." },
|
|
11781
12044
|
angle: { type: "number", minimum: -360, maximum: 360, description: "Tip angle in degrees (default 0)." },
|
|
@@ -11785,10 +12048,30 @@ var BRUSH = {
|
|
|
11785
12048
|
smoothing: { type: "number", minimum: 0, maximum: 0.95, description: "Point smoothing 0..0.95 (default 0)." },
|
|
11786
12049
|
pressureSize: { type: "boolean", description: "Point pressure scales the size (default true)." },
|
|
11787
12050
|
pressureOpacity: { type: "boolean", description: "Point pressure scales the opacity (default false)." },
|
|
11788
|
-
blend: { type: "string", enum:
|
|
12051
|
+
blend: { type: "string", enum: _chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id), description: "How paint combines with the layer (default normal). pigment mixes it in like real paint (blue into yellow gives green) instead of laying it over." }
|
|
12052
|
+
},
|
|
12053
|
+
additionalProperties: false
|
|
12054
|
+
};
|
|
12055
|
+
var MIXER = {
|
|
12056
|
+
type: "object",
|
|
12057
|
+
description: "Mixer Brush settings (tool mixer only); missing fields use the current mixer options (wet 0.5, load 0.5, mix 0.5, loadEachStroke true, cleanEachStroke true, mixing rgb).",
|
|
12058
|
+
properties: {
|
|
12059
|
+
wet: { type: "number", minimum: 0, maximum: 1, description: "How much canvas colour each dab picks up, 0 (dry: paints only the reservoir) .. 1 (default 0.5)." },
|
|
12060
|
+
load: { type: "number", minimum: 0, maximum: 1, description: "How much paint the reservoir holds, 0 .. 1 (default 0.5); below 1 it drains per dab, so long strokes run dry." },
|
|
12061
|
+
mix: { type: "number", minimum: 0, maximum: 1, description: "How far each dab's paint moves from the reservoir towards the picked-up colour, 0 .. 1 (default 0.5)." },
|
|
12062
|
+
loadEachStroke: { type: "boolean", description: "Refill the reservoir with `color` (or the foreground) before the stroke (default true). Off, the brush keeps what is left of its last load." },
|
|
12063
|
+
cleanEachStroke: { type: "boolean", description: "Empty the pickup well after the stroke (default true). Off, the next stroke starts with the colour this one picked up." },
|
|
12064
|
+
mixing: { type: "string", enum: [..._chunkZZOTHJ4Kcjs.MIXING_MODELS], description: "rgb (default): RGB averages. pigment: mixes like paint (Kubelka-Munk), so blue dragged through yellow makes green." }
|
|
11789
12065
|
},
|
|
11790
12066
|
additionalProperties: false
|
|
11791
12067
|
};
|
|
12068
|
+
function mixerLoadResult(load) {
|
|
12069
|
+
return {
|
|
12070
|
+
reservoir: load.reservoir ? rgbUnitToHex(load.reservoir) : null,
|
|
12071
|
+
amount: Math.round(load.amount * 1e3) / 1e3,
|
|
12072
|
+
pickup: load.pickup ? rgbUnitToHex(load.pickup) : null
|
|
12073
|
+
};
|
|
12074
|
+
}
|
|
11792
12075
|
function readTarget(args) {
|
|
11793
12076
|
return { layerId: args.layerId, channel: args.channel };
|
|
11794
12077
|
}
|
|
@@ -11796,11 +12079,11 @@ function createImagePaintTools(controller) {
|
|
|
11796
12079
|
const paintStroke = {
|
|
11797
12080
|
name: "paint_stroke",
|
|
11798
12081
|
title: "Paint a brush stroke",
|
|
11799
|
-
description: "Paints one stroke with the brush (or removes pixels with the eraser
|
|
12082
|
+
description: "Paints one stroke with the brush, smears and blends paint with the Mixer Brush (tool mixer: its reservoir mixes with colour picked up from the layer under each dab, in RGB or pigment mixing), or removes pixels with the eraser, through points in document pixels (optional pressure 0..1 each) on a pixel layer or a layer mask (the mixer paints pixels only). The selection limits the paint; a transparency-locked layer keeps its alpha (the eraser then paints the background colour). One undo step. Returns the layerId, channel, changed bounds and dab count, and for the mixer its mixerLoad after the stroke ({reservoir, amount, pickup}).",
|
|
11800
12083
|
inputSchema: {
|
|
11801
12084
|
type: "object",
|
|
11802
12085
|
properties: {
|
|
11803
|
-
tool: { type: "string", enum: ["brush", "eraser"], description: "brush (default) or
|
|
12086
|
+
tool: { type: "string", enum: ["brush", "eraser", "mixer"], description: "brush (default), eraser, or mixer (the Mixer Brush: picks up and blends the layer colour under each dab)." },
|
|
11804
12087
|
points: {
|
|
11805
12088
|
type: "array",
|
|
11806
12089
|
minItems: 1,
|
|
@@ -11817,21 +12100,66 @@ function createImagePaintTools(controller) {
|
|
|
11817
12100
|
additionalProperties: false
|
|
11818
12101
|
}
|
|
11819
12102
|
},
|
|
11820
|
-
color: {
|
|
12103
|
+
color: {
|
|
12104
|
+
type: "string",
|
|
12105
|
+
description: "Paint colour #rrggbb (default the foreground). On a mask its grey value: #000000 hides, #ffffff reveals. For the mixer, the colour its reservoir is loaded with before the stroke (given, it loads even with loadEachStroke false)."
|
|
12106
|
+
},
|
|
11821
12107
|
brush: BRUSH,
|
|
12108
|
+
mixer: MIXER,
|
|
11822
12109
|
...TARGET
|
|
11823
12110
|
},
|
|
11824
12111
|
required: ["points"],
|
|
11825
12112
|
additionalProperties: false
|
|
11826
12113
|
},
|
|
11827
12114
|
annotations: { title: "Paint a brush stroke", ...WRITE4 },
|
|
11828
|
-
handler: (args) =>
|
|
11829
|
-
tool
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
12115
|
+
handler: (args) => {
|
|
12116
|
+
const tool = args.tool;
|
|
12117
|
+
if (args.mixer !== void 0 && tool !== "mixer") throw new LayerOperationError('mixer settings apply to the Mixer Brush only; pass tool "mixer", or drop mixer.');
|
|
12118
|
+
const result = controller.paintStroke({
|
|
12119
|
+
tool,
|
|
12120
|
+
points: args.points,
|
|
12121
|
+
color: args.color,
|
|
12122
|
+
brush: args.brush,
|
|
12123
|
+
mixer: args.mixer,
|
|
12124
|
+
...readTarget(args)
|
|
12125
|
+
});
|
|
12126
|
+
return result.mixerLoad ? { ...result, mixerLoad: mixerLoadResult(result.mixerLoad) } : result;
|
|
12127
|
+
}
|
|
12128
|
+
};
|
|
12129
|
+
const getMixer = {
|
|
12130
|
+
name: "get_mixer_brush",
|
|
12131
|
+
title: "Get the Mixer Brush",
|
|
12132
|
+
description: "Reads the Mixer Brush: its settings (wet, load, mix, loadEachStroke, cleanEachStroke, mixing) and what it carries now (reservoir #rrggbb or null, amount 0..1 left, pickup #rrggbb or null). Call it before a paint_stroke with tool mixer and loadEachStroke false, to know the brush's starting paint.",
|
|
12133
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
12134
|
+
annotations: { title: "Get the Mixer Brush", ...READ4 },
|
|
12135
|
+
handler: () => {
|
|
12136
|
+
const { mixer, mixerLoad } = controller.getState().paint;
|
|
12137
|
+
return { settings: { ...mixer }, load: mixerLoadResult(mixerLoad) };
|
|
12138
|
+
}
|
|
12139
|
+
};
|
|
12140
|
+
const loadMixerTool = {
|
|
12141
|
+
name: "load_mixer_brush",
|
|
12142
|
+
title: "Load the Mixer Brush",
|
|
12143
|
+
description: "Fills the Mixer Brush reservoir with a colour (amount 1); the picked-up colour is kept. View state, not an undo step. Use it with loadEachStroke false to carry one load across several paint_stroke calls. Returns the load {reservoir, amount, pickup}.",
|
|
12144
|
+
inputSchema: {
|
|
12145
|
+
type: "object",
|
|
12146
|
+
properties: { color: { type: "string", description: "Paint colour #rrggbb (default the foreground)." } },
|
|
12147
|
+
additionalProperties: false
|
|
12148
|
+
},
|
|
12149
|
+
annotations: { title: "Load the Mixer Brush", ...WRITE4, idempotentHint: true },
|
|
12150
|
+
handler: (args) => mixerLoadResult(controller.loadMixerBrush(args.color))
|
|
12151
|
+
};
|
|
12152
|
+
const cleanMixerTool = {
|
|
12153
|
+
name: "clean_mixer_brush",
|
|
12154
|
+
title: "Clean the Mixer Brush",
|
|
12155
|
+
description: "Cleans the Mixer Brush: empties the pickup well so the next stroke starts without canvas colour; with emptyReservoir also drops the loaded paint (the brush then only smears). View state, not an undo step. Returns the load {reservoir, amount, pickup}.",
|
|
12156
|
+
inputSchema: {
|
|
12157
|
+
type: "object",
|
|
12158
|
+
properties: { emptyReservoir: { type: "boolean", description: "Also drop the reservoir (default false)." } },
|
|
12159
|
+
additionalProperties: false
|
|
12160
|
+
},
|
|
12161
|
+
annotations: { title: "Clean the Mixer Brush", ...WRITE4, idempotentHint: true },
|
|
12162
|
+
handler: (args) => mixerLoadResult(args.emptyReservoir === true ? controller.emptyMixerBrush() : controller.cleanMixerBrush())
|
|
11835
12163
|
};
|
|
11836
12164
|
const fill = {
|
|
11837
12165
|
name: "fill_pixels",
|
|
@@ -11842,7 +12170,7 @@ function createImagePaintTools(controller) {
|
|
|
11842
12170
|
properties: {
|
|
11843
12171
|
color: { type: "string", description: "Fill colour #rrggbb or #rrggbbaa (default the foreground)." },
|
|
11844
12172
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Fill opacity 0..1 (default 1)." },
|
|
11845
|
-
blend: { type: "string", enum:
|
|
12173
|
+
blend: { type: "string", enum: _chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id), description: "Blend mode (default normal). pigment mixes the colour into the pixels like paint, opacity being the share of new paint." },
|
|
11846
12174
|
useSelection: { type: "boolean", description: "Limit to the selection when there is one (default true)." },
|
|
11847
12175
|
...TARGET
|
|
11848
12176
|
},
|
|
@@ -11873,11 +12201,11 @@ function createImagePaintTools(controller) {
|
|
|
11873
12201
|
annotations: { title: "Clear pixels", ...DESTRUCTIVE3 },
|
|
11874
12202
|
handler: (args) => controller.clearPixels({ opacity: args.opacity, useSelection: args.useSelection, ...readTarget(args) })
|
|
11875
12203
|
};
|
|
11876
|
-
return [paintStroke, fill, clear];
|
|
12204
|
+
return [paintStroke, fill, clear, getMixer, loadMixerTool, cleanMixerTool];
|
|
11877
12205
|
}
|
|
11878
12206
|
|
|
11879
12207
|
// src/image-editor/psd-tools.ts
|
|
11880
|
-
var
|
|
12208
|
+
var READ5 = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
11881
12209
|
var DESTRUCTIVE4 = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
|
|
11882
12210
|
var DATA = {
|
|
11883
12211
|
type: "string",
|
|
@@ -11888,7 +12216,7 @@ function psdBytesFromBase64(data) {
|
|
|
11888
12216
|
if (typeof data !== "string" || !data.trim()) throw new PsdError("data is required: the PSD file as base64.");
|
|
11889
12217
|
const body = data.trim().replace(/^data:[^,]*;base64,/i, "");
|
|
11890
12218
|
if (!/^[A-Za-z0-9+/=_\s-]+$/.test(body)) throw new PsdError("data is not base64; send the PSD file bytes base64-encoded.");
|
|
11891
|
-
const bytes =
|
|
12219
|
+
const bytes = _chunkT6H3JDGAcjs.base64ToBytes.call(void 0, body);
|
|
11892
12220
|
if (bytes.length < 26) throw new PsdError(`data decodes to ${bytes.length} bytes, too short for a PSD (at least 26).`);
|
|
11893
12221
|
return bytes;
|
|
11894
12222
|
}
|
|
@@ -11898,7 +12226,7 @@ function createImagePsdTools(controller) {
|
|
|
11898
12226
|
title: "Inspect a PSD",
|
|
11899
12227
|
description: "Reads a PSD / PSB without opening it: size, bit depth, colour mode, resolution, and every layer (bottom first, a group before its children) with its PSD kind, the layer type it would become and its status (mapped, approximated or dropped, with notes), plus the import warnings. Changes nothing. Call before import_psd to see what would be lost.",
|
|
11900
12228
|
inputSchema: { type: "object", properties: { data: DATA }, required: ["data"], additionalProperties: false },
|
|
11901
|
-
annotations: { title: "Inspect a PSD", ...
|
|
12229
|
+
annotations: { title: "Inspect a PSD", ...READ5 },
|
|
11902
12230
|
handler: ({ data }) => {
|
|
11903
12231
|
const res = importPsd(psdBytesFromBase64(data), { skipPixels: true });
|
|
11904
12232
|
return {
|
|
@@ -11935,11 +12263,11 @@ function createImagePsdTools(controller) {
|
|
|
11935
12263
|
title: "Export the document as a PSD",
|
|
11936
12264
|
description: "Writes the document as an 8-bit RGB PSD (a PSB above 30000 px) with real layers, groups, adjustment layers and masks, in the source frame (crop and rotation are not applied). Layer filters and depth masks are baked, annotation layers are rasterized (in a browser; elsewhere left out), and the merged image is the editor's composite. Changes nothing. Returns the file as base64, its size in bytes, whether it is a PSB, and warnings for everything that was changed or left out.",
|
|
11937
12265
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
11938
|
-
annotations: { title: "Export the document as a PSD", ...
|
|
12266
|
+
annotations: { title: "Export the document as a PSD", ...READ5 },
|
|
11939
12267
|
handler: async () => {
|
|
11940
12268
|
const res = await controller.toPsd();
|
|
11941
12269
|
return {
|
|
11942
|
-
data:
|
|
12270
|
+
data: _chunkT6H3JDGAcjs.bytesToBase64.call(void 0, res.bytes),
|
|
11943
12271
|
mimeType: "image/vnd.adobe.photoshop",
|
|
11944
12272
|
size: res.bytes.length,
|
|
11945
12273
|
psb: res.psb,
|
|
@@ -12011,7 +12339,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
12011
12339
|
default: def
|
|
12012
12340
|
}))
|
|
12013
12341
|
})),
|
|
12014
|
-
blendModes:
|
|
12342
|
+
blendModes: _chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id),
|
|
12015
12343
|
layerPathFormat: "layers.<layerId>.<controlId>"
|
|
12016
12344
|
})
|
|
12017
12345
|
};
|
|
@@ -12102,7 +12430,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
12102
12430
|
kind: { type: "string", enum: ADJUSTMENT_KINDS.map((k) => k.kind), description: "Adjustment kind." },
|
|
12103
12431
|
params: { type: "object", description: "Initial parameters (see list_controls); merged with neutral defaults." },
|
|
12104
12432
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0-1 (default 1)." },
|
|
12105
|
-
blend: { type: "string", enum:
|
|
12433
|
+
blend: { type: "string", enum: _chunkCRMAXIUVcjs.BLEND_MODES.map((m) => m.id), description: "Blend mode (default normal)." },
|
|
12106
12434
|
name: { type: "string", description: "Layer name shown in the layers panel." },
|
|
12107
12435
|
aboveId: { type: "string", description: "Put the layer directly above this layer (from list_layers). Default: above the other adjustment layers, below annotations." },
|
|
12108
12436
|
parentId: { type: "string", description: "Put the layer at the top of this group (from list_layers)." }
|
|
@@ -12119,12 +12447,12 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
12119
12447
|
},
|
|
12120
12448
|
handler: ({ kind, params, opacity, blend, name, aboveId, parentId }) => {
|
|
12121
12449
|
if (!isAdjustmentKind(kind)) throw new Error(`Unknown adjustment kind "${kind}".`);
|
|
12122
|
-
if (blend !== void 0 && !
|
|
12450
|
+
if (blend !== void 0 && !_chunkCRMAXIUVcjs.isBlendMode.call(void 0, blend)) throw new Error(`Unknown blend mode "${blend}".`);
|
|
12123
12451
|
if (aboveId !== void 0 && parentId !== void 0) throw new Error("Give aboveId or parentId, not both.");
|
|
12124
12452
|
for (const ref of [aboveId, parentId]) {
|
|
12125
12453
|
if (ref !== void 0 && !controller.getLayer(ref)) throw new Error(`Unknown layer "${ref}". Call list_layers for ids.`);
|
|
12126
12454
|
}
|
|
12127
|
-
if (parentId !== void 0 && _optionalChain([controller, 'access',
|
|
12455
|
+
if (parentId !== void 0 && _optionalChain([controller, 'access', _263 => _263.getLayer, 'call', _264 => _264(parentId), 'optionalAccess', _265 => _265.type]) !== "group") throw new Error(`Layer "${parentId}" is not a group.`);
|
|
12128
12456
|
const id = controller.addAdjustmentLayer({ kind, params, opacity, blend, name, aboveId, parentId });
|
|
12129
12457
|
const layer = controller.getAdjustmentLayer(id);
|
|
12130
12458
|
return { layer: JSON.parse(JSON.stringify(layer)), index: controller.getAdjustmentLayers().findIndex((l) => l.id === id) };
|
|
@@ -12191,7 +12519,7 @@ function createImageEditorToolProvider(controller, options = {}) {
|
|
|
12191
12519
|
...createImageLayerTools(controller),
|
|
12192
12520
|
...createImageEffectTools(controller),
|
|
12193
12521
|
...createImagePaintTools(controller),
|
|
12194
|
-
...
|
|
12522
|
+
..._chunkZZOTHJ4Kcjs.createPigmentTools.call(void 0, ),
|
|
12195
12523
|
...createImagePsdTools(controller)
|
|
12196
12524
|
]
|
|
12197
12525
|
};
|
|
@@ -12252,19 +12580,19 @@ function removeCurvePoint(points, index) {
|
|
|
12252
12580
|
var round22 = (v) => Math.round(v * 100) / 100;
|
|
12253
12581
|
|
|
12254
12582
|
// src/image-editor/selection/gesture.ts
|
|
12255
|
-
var SelectionGesture = (
|
|
12256
|
-
constructor(controller, getOptions) {;
|
|
12583
|
+
var SelectionGesture = (_class9 = class {
|
|
12584
|
+
constructor(controller, getOptions) {;_class9.prototype.__init55.call(this);_class9.prototype.__init56.call(this);_class9.prototype.__init57.call(this);_class9.prototype.__init58.call(this);_class9.prototype.__init59.call(this);
|
|
12257
12585
|
this.controller = controller;
|
|
12258
12586
|
this.getOptions = getOptions;
|
|
12259
12587
|
}
|
|
12260
12588
|
|
|
12261
12589
|
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12590
|
+
__init55() {this.start = null}
|
|
12591
|
+
__init56() {this.points = []}
|
|
12592
|
+
__init57() {this.current = null}
|
|
12593
|
+
__init58() {this.modifiers = {}}
|
|
12266
12594
|
/** The last error (e.g. pixels unavailable for the wand), for the UI to show. */
|
|
12267
|
-
|
|
12595
|
+
__init59() {this.error = null}
|
|
12268
12596
|
get active() {
|
|
12269
12597
|
return this.start !== null;
|
|
12270
12598
|
}
|
|
@@ -12352,7 +12680,7 @@ var SelectionGesture = (_class8 = class {
|
|
|
12352
12680
|
this.current = null;
|
|
12353
12681
|
this.points = [];
|
|
12354
12682
|
}
|
|
12355
|
-
},
|
|
12683
|
+
}, _class9);
|
|
12356
12684
|
|
|
12357
12685
|
// src/image-editor/mosaic-filter.ts
|
|
12358
12686
|
function resolveMosaicRegionBounds(region, imgWidth, imgHeight) {
|
|
@@ -12535,7 +12863,7 @@ function dropZone(fraction, isGroup) {
|
|
|
12535
12863
|
}
|
|
12536
12864
|
function dropPlacement(layers, dragId, targetId, zone) {
|
|
12537
12865
|
if (dragId === targetId) return null;
|
|
12538
|
-
const target =
|
|
12866
|
+
const target = _chunkT6H3JDGAcjs.findLayer.call(void 0, layers, targetId);
|
|
12539
12867
|
if (!target) return null;
|
|
12540
12868
|
if (zone === "inside" && target.layer.type === "group") return { parentId: targetId };
|
|
12541
12869
|
return zone === "above" ? { aboveId: targetId } : { belowId: targetId };
|
|
@@ -12543,35 +12871,35 @@ function dropPlacement(layers, dragId, targetId, zone) {
|
|
|
12543
12871
|
function layerMenu(controller) {
|
|
12544
12872
|
const s = controller.getState();
|
|
12545
12873
|
const active = controller.getActiveLayer();
|
|
12546
|
-
const loc = active ?
|
|
12874
|
+
const loc = active ? _chunkT6H3JDGAcjs.findLayer.call(void 0, s.layers, active.id) : null;
|
|
12547
12875
|
const siblings = loc ? loc.parent ? loc.parent.children : s.layers : [];
|
|
12548
12876
|
const below = loc ? siblings[loc.index - 1] : void 0;
|
|
12549
12877
|
const hasSel = controller.hasSelection;
|
|
12550
|
-
const isPixel = _optionalChain([active, 'optionalAccess',
|
|
12878
|
+
const isPixel = _optionalChain([active, 'optionalAccess', _266 => _266.type]) === "pixel";
|
|
12551
12879
|
return [
|
|
12552
12880
|
{ action: "new-layer", label: "New Layer", enabled: true },
|
|
12553
12881
|
{ action: "new-group", label: "New Group", enabled: true },
|
|
12554
12882
|
{ action: "duplicate", label: "Duplicate Layer", enabled: Boolean(active) },
|
|
12555
12883
|
{ action: "delete", label: "Delete Layer", enabled: Boolean(active) },
|
|
12556
12884
|
{ action: "group-selected", label: "Group Layer", enabled: Boolean(active) },
|
|
12557
|
-
{ action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess',
|
|
12558
|
-
{ action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
12885
|
+
{ action: "ungroup", label: "Ungroup", enabled: _optionalChain([active, 'optionalAccess', _267 => _267.type]) === "group" },
|
|
12886
|
+
{ action: "merge-down", label: "Merge Down", enabled: Boolean(_optionalChain([active, 'optionalAccess', _268 => _268.visible]) && _optionalChain([below, 'optionalAccess', _269 => _269.type]) === "pixel") },
|
|
12559
12887
|
{ action: "merge-visible", label: "Merge Visible", enabled: s.layers.some((l) => l.visible) },
|
|
12560
12888
|
{ action: "flatten", label: "Flatten Image", enabled: s.layers.length > 0 },
|
|
12561
12889
|
{ action: "via-copy", label: "Layer via Copy", enabled: isPixel && hasSel },
|
|
12562
12890
|
{ action: "via-cut", label: "Layer via Cut", enabled: isPixel && hasSel },
|
|
12563
12891
|
{ action: "add-mask", label: "Add Layer Mask", enabled: Boolean(active) },
|
|
12564
12892
|
{ action: "add-mask-selection", label: "Add Mask from Selection", enabled: Boolean(active) && hasSel },
|
|
12565
|
-
{ action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess',
|
|
12566
|
-
{ action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess',
|
|
12567
|
-
{ action: "toggle-mask", label: _optionalChain([active, 'optionalAccess',
|
|
12568
|
-
{ action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess',
|
|
12569
|
-
{ action: "toggle-clip", label: _optionalChain([active, 'optionalAccess',
|
|
12893
|
+
{ action: "apply-mask", label: "Apply Layer Mask", enabled: isPixel && Boolean(_optionalChain([active, 'optionalAccess', _270 => _270.mask])) },
|
|
12894
|
+
{ action: "delete-mask", label: "Delete Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _271 => _271.mask])) },
|
|
12895
|
+
{ action: "toggle-mask", label: _optionalChain([active, 'optionalAccess', _272 => _272.mask, 'optionalAccess', _273 => _273.enabled]) === false ? "Enable Layer Mask" : "Disable Layer Mask", enabled: Boolean(_optionalChain([active, 'optionalAccess', _274 => _274.mask])) },
|
|
12896
|
+
{ action: "rasterize", label: "Rasterize Layer", enabled: _optionalChain([active, 'optionalAccess', _275 => _275.type]) === "annotation" || isPixel && Boolean(_optionalChain([active, 'optionalAccess', _276 => _276.type]) === "pixel" && _optionalChain([active, 'access', _277 => _277.filters, 'optionalAccess', _278 => _278.length])) },
|
|
12897
|
+
{ action: "toggle-clip", label: _optionalChain([active, 'optionalAccess', _279 => _279.clipped]) ? "Release Clipping Mask" : "Create Clipping Mask", enabled: Boolean(loc && loc.index > 0) }
|
|
12570
12898
|
];
|
|
12571
12899
|
}
|
|
12572
12900
|
async function runLayerMenuAction(controller, action) {
|
|
12573
12901
|
const active = controller.getActiveLayer();
|
|
12574
|
-
const id = _optionalChain([active, 'optionalAccess',
|
|
12902
|
+
const id = _optionalChain([active, 'optionalAccess', _280 => _280.id]);
|
|
12575
12903
|
try {
|
|
12576
12904
|
switch (action) {
|
|
12577
12905
|
case "new-layer":
|
|
@@ -12618,13 +12946,13 @@ async function runLayerMenuAction(controller, action) {
|
|
|
12618
12946
|
if (id) controller.removeLayerMask(id);
|
|
12619
12947
|
break;
|
|
12620
12948
|
case "toggle-mask":
|
|
12621
|
-
if (id && _optionalChain([active, 'optionalAccess',
|
|
12949
|
+
if (id && _optionalChain([active, 'optionalAccess', _281 => _281.mask])) controller.setLayerMaskProps(id, { enabled: active.mask.enabled === false });
|
|
12622
12950
|
break;
|
|
12623
12951
|
case "rasterize":
|
|
12624
12952
|
if (id) await controller.rasterizeLayer(id);
|
|
12625
12953
|
break;
|
|
12626
12954
|
case "toggle-clip":
|
|
12627
|
-
if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess',
|
|
12955
|
+
if (id) controller.setLayerProperties(id, { clipped: !_optionalChain([active, 'optionalAccess', _282 => _282.clipped]) });
|
|
12628
12956
|
break;
|
|
12629
12957
|
}
|
|
12630
12958
|
return null;
|
|
@@ -12633,145 +12961,6 @@ async function runLayerMenuAction(controller, action) {
|
|
|
12633
12961
|
}
|
|
12634
12962
|
}
|
|
12635
12963
|
|
|
12636
|
-
// src/image-editor/layers/paint-ui.ts
|
|
12637
|
-
var plain2 = { kind: "plain" };
|
|
12638
|
-
var BRUSH_OPTION_CONTROLS = [
|
|
12639
|
-
{ id: "size", label: "Size", section: "layer", min: 1, max: 500, step: 1, default: 20, decimals: 0, track: plain2, unit: "px" },
|
|
12640
|
-
{ id: "hardness", label: "Hardness", section: "layer", min: 0, max: 1, step: 0.01, default: 1, decimals: 0, track: plain2, displayScale: 100, unit: "%" },
|
|
12641
|
-
{ id: "opacity", label: "Opacity", section: "layer", min: 0, max: 1, step: 0.01, default: 1, decimals: 0, track: plain2, displayScale: 100, unit: "%" },
|
|
12642
|
-
{ id: "flow", label: "Flow", section: "layer", min: 0, max: 1, step: 0.01, default: 1, decimals: 0, track: plain2, displayScale: 100, unit: "%" },
|
|
12643
|
-
{ id: "smoothing", label: "Smoothing", section: "layer", min: 0, max: 0.95, step: 0.01, default: 0, decimals: 0, track: plain2, displayScale: 100, unit: "%" }
|
|
12644
|
-
];
|
|
12645
|
-
var PAINT_TOOLS = [
|
|
12646
|
-
{ id: "move", label: "Move", shortcut: "V" },
|
|
12647
|
-
{ id: "brush", label: "Brush", shortcut: "B" },
|
|
12648
|
-
{ id: "eraser", label: "Eraser", shortcut: "E" }
|
|
12649
|
-
];
|
|
12650
|
-
var isPaintTool = (tool) => tool === "move" || tool === "brush" || tool === "eraser";
|
|
12651
|
-
function sizeStep(size) {
|
|
12652
|
-
return size < 10 ? 1 : size < 50 ? 5 : size < 100 ? 10 : size < 200 ? 25 : size < 500 ? 50 : 100;
|
|
12653
|
-
}
|
|
12654
|
-
var isTyping = (t) => {
|
|
12655
|
-
const el = t;
|
|
12656
|
-
return Boolean(el && (el.isContentEditable || el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.tagName === "SELECT"));
|
|
12657
|
-
};
|
|
12658
|
-
function handlePaintShortcut(controller, e) {
|
|
12659
|
-
if (e.ctrlKey || e.metaKey || e.altKey || isTyping(e.target)) return false;
|
|
12660
|
-
const brush = controller.getState().paint.brush;
|
|
12661
|
-
const set = (b) => controller.setPaintOptions({ brush: b });
|
|
12662
|
-
const key = e.key;
|
|
12663
|
-
switch (key.toLowerCase()) {
|
|
12664
|
-
case "b":
|
|
12665
|
-
controller.setTool("brush");
|
|
12666
|
-
return true;
|
|
12667
|
-
case "e":
|
|
12668
|
-
controller.setTool("eraser");
|
|
12669
|
-
return true;
|
|
12670
|
-
case "v":
|
|
12671
|
-
controller.setTool("move");
|
|
12672
|
-
return true;
|
|
12673
|
-
case "d":
|
|
12674
|
-
controller.resetPaintColors();
|
|
12675
|
-
return true;
|
|
12676
|
-
case "x":
|
|
12677
|
-
controller.swapPaintColors();
|
|
12678
|
-
return true;
|
|
12679
|
-
}
|
|
12680
|
-
if (key === "[" || key === "{") {
|
|
12681
|
-
if (e.shiftKey || key === "{") set({ hardness: Math.max(0, Math.round((brush.hardness - 0.25) * 4) / 4) });
|
|
12682
|
-
else set({ size: Math.max(1, brush.size - sizeStep(brush.size - 1)) });
|
|
12683
|
-
return true;
|
|
12684
|
-
}
|
|
12685
|
-
if (key === "]" || key === "}") {
|
|
12686
|
-
if (e.shiftKey || key === "}") set({ hardness: Math.min(1, Math.round((brush.hardness + 0.25) * 4) / 4) });
|
|
12687
|
-
else set({ size: Math.min(_chunk4F3YDIWWcjs.MAX_BRUSH_SIZE, brush.size + sizeStep(brush.size)) });
|
|
12688
|
-
return true;
|
|
12689
|
-
}
|
|
12690
|
-
if (/^[0-9]$/.test(key) && isPaintTool(controller.getState().activeTool)) {
|
|
12691
|
-
set({ opacity: key === "0" ? 1 : Number(key) / 10 });
|
|
12692
|
-
return true;
|
|
12693
|
-
}
|
|
12694
|
-
return false;
|
|
12695
|
-
}
|
|
12696
|
-
function pointerPressure(e) {
|
|
12697
|
-
if (e.pointerType === "pen" && typeof e.pressure === "number" && e.pressure > 0) return Math.min(1, e.pressure);
|
|
12698
|
-
return 1;
|
|
12699
|
-
}
|
|
12700
|
-
var PaintGesture = (_class9 = class {
|
|
12701
|
-
constructor(controller) {;_class9.prototype.__init55.call(this);_class9.prototype.__init56.call(this);_class9.prototype.__init57.call(this);
|
|
12702
|
-
this.controller = controller;
|
|
12703
|
-
}
|
|
12704
|
-
|
|
12705
|
-
__init55() {this.stroke = null}
|
|
12706
|
-
__init56() {this.move = null}
|
|
12707
|
-
/** The last refusal (e.g. "layer is locked"), for the editor to show. */
|
|
12708
|
-
__init57() {this.error = null}
|
|
12709
|
-
get active() {
|
|
12710
|
-
return Boolean(this.stroke || this.move);
|
|
12711
|
-
}
|
|
12712
|
-
down(sample) {
|
|
12713
|
-
this.error = null;
|
|
12714
|
-
const tool = this.controller.getState().activeTool;
|
|
12715
|
-
try {
|
|
12716
|
-
if (tool === "move") {
|
|
12717
|
-
const layer = this.controller.getActiveLayer();
|
|
12718
|
-
if (!layer) throw new Error("Select a layer to move in the Layers panel.");
|
|
12719
|
-
if (layer.type !== "pixel") throw new Error(`Only pixel layers move; "${layer.name}" is a ${layer.type} layer.`);
|
|
12720
|
-
if (_optionalChain([layer, 'access', _266 => _266.locks, 'optionalAccess', _267 => _267.all]) || _optionalChain([layer, 'access', _268 => _268.locks, 'optionalAccess', _269 => _269.position])) throw new Error(`Layer "${layer.name}" has its position locked.`);
|
|
12721
|
-
this.move = { id: layer.id, start: { x: sample.x, y: sample.y }, origin: { ...layer.offset }, moved: false };
|
|
12722
|
-
return null;
|
|
12723
|
-
}
|
|
12724
|
-
if (tool === "brush" || tool === "eraser") {
|
|
12725
|
-
this.stroke = this.controller.beginStroke({ tool });
|
|
12726
|
-
this.stroke.push([sample]);
|
|
12727
|
-
return null;
|
|
12728
|
-
}
|
|
12729
|
-
} catch (err) {
|
|
12730
|
-
this.error = err instanceof Error ? err.message : String(err);
|
|
12731
|
-
this.stroke = null;
|
|
12732
|
-
this.move = null;
|
|
12733
|
-
}
|
|
12734
|
-
return this.error;
|
|
12735
|
-
}
|
|
12736
|
-
/** Feeds pointer samples (all coalesced events of one move, in order). */
|
|
12737
|
-
moveTo(samples) {
|
|
12738
|
-
if (!samples.length) return;
|
|
12739
|
-
if (this.stroke) {
|
|
12740
|
-
this.stroke.push(samples);
|
|
12741
|
-
return;
|
|
12742
|
-
}
|
|
12743
|
-
const m = this.move;
|
|
12744
|
-
if (m) {
|
|
12745
|
-
const last = samples[samples.length - 1];
|
|
12746
|
-
const x = m.origin.x + Math.round(last.x - m.start.x);
|
|
12747
|
-
const y = m.origin.y + Math.round(last.y - m.start.y);
|
|
12748
|
-
try {
|
|
12749
|
-
this.controller.offsetLayer(m.id, { x, y }, !m.moved);
|
|
12750
|
-
m.moved = true;
|
|
12751
|
-
} catch (err) {
|
|
12752
|
-
this.error = err instanceof Error ? err.message : String(err);
|
|
12753
|
-
this.move = null;
|
|
12754
|
-
}
|
|
12755
|
-
}
|
|
12756
|
-
}
|
|
12757
|
-
up() {
|
|
12758
|
-
if (this.stroke) {
|
|
12759
|
-
try {
|
|
12760
|
-
this.stroke.end();
|
|
12761
|
-
} catch (err) {
|
|
12762
|
-
this.error = err instanceof Error ? err.message : String(err);
|
|
12763
|
-
}
|
|
12764
|
-
}
|
|
12765
|
-
this.stroke = null;
|
|
12766
|
-
this.move = null;
|
|
12767
|
-
}
|
|
12768
|
-
cancel() {
|
|
12769
|
-
_optionalChain([this, 'access', _270 => _270.stroke, 'optionalAccess', _271 => _271.cancel, 'call', _272 => _272()]);
|
|
12770
|
-
this.stroke = null;
|
|
12771
|
-
this.move = null;
|
|
12772
|
-
}
|
|
12773
|
-
}, _class9);
|
|
12774
|
-
|
|
12775
12964
|
// src/image-editor/psd/ui.ts
|
|
12776
12965
|
var PSD_FILE_ACCEPT = ".psd,.psb,image/vnd.adobe.photoshop,application/x-photoshop";
|
|
12777
12966
|
function blobBytes(file) {
|
|
@@ -13222,5 +13411,20 @@ async function downloadPsd(controller, name = "image") {
|
|
|
13222
13411
|
|
|
13223
13412
|
|
|
13224
13413
|
|
|
13225
|
-
exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.ADJUSTMENT_LAYER_CONTROLS = ADJUSTMENT_LAYER_CONTROLS; exports.ADJUSTMENT_LAYER_OPACITY_CONTROL = ADJUSTMENT_LAYER_OPACITY_CONTROL; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.BLEND_MODES = _chunkZOOEX3WTcjs.BLEND_MODES; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.BRUSH_OPTION_CONTROLS = BRUSH_OPTION_CONTROLS; exports.CoverageMap = _chunk4F3YDIWWcjs.CoverageMap; exports.D50 = D50; exports.D65 = D65; exports.DEFAULT_ADJUSTMENTS = DEFAULT_ADJUSTMENTS; exports.DEFAULT_BRUSH = _chunk4F3YDIWWcjs.DEFAULT_BRUSH; exports.DEFAULT_DEPTH_MASK = DEFAULT_DEPTH_MASK; exports.DEFAULT_REFINE_EDGE_PARAMS = DEFAULT_REFINE_EDGE_PARAMS; exports.DEFAULT_SELECTION_TOOL_OPTIONS = DEFAULT_SELECTION_TOOL_OPTIONS; exports.DEFAULT_TRANSFORM = DEFAULT_TRANSFORM; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunk73L6TROJcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DabWalker = _chunk4F3YDIWWcjs.DabWalker; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.GUIDED_FILTER_EPS = GUIDED_FILTER_EPS; exports.HISTOGRAM_BINS = HISTOGRAM_BINS; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.IMAGE_ADJUSTMENT_CONTROLS = IMAGE_ADJUSTMENT_CONTROLS; exports.IMAGE_EDITOR_SCHEMA_VERSION = IMAGE_EDITOR_SCHEMA_VERSION; exports.IMAGE_EDITOR_STATE_VERSION = IMAGE_EDITOR_STATE_VERSION; exports.ImageEditorController = ImageEditorController; exports.ImageEditorRenderer = ImageEditorRenderer; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LUMA_709 = LUMA_709; exports.LayerCompositor = LayerCompositor; exports.LayerOperationError = LayerOperationError; exports.MAX_BRUSH_SIZE = _chunk4F3YDIWWcjs.MAX_BRUSH_SIZE; exports.MAX_KELVIN = MAX_KELVIN; exports.MIN_KELVIN = MIN_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PIGMENT_BANDS = _chunk4F3YDIWWcjs.PIGMENT_BANDS; exports.PIGMENT_LAMBDA_MIN = _chunk4F3YDIWWcjs.PIGMENT_LAMBDA_MIN; exports.PIGMENT_LAMBDA_STEP = _chunk4F3YDIWWcjs.PIGMENT_LAMBDA_STEP; exports.PIGMENT_WAVELENGTHS = _chunk4F3YDIWWcjs.PIGMENT_WAVELENGTHS; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.PSD_FILE_ACCEPT = PSD_FILE_ACCEPT; exports.PaintGesture = PaintGesture; exports.PaintStrokeSession = PaintStrokeSession; exports.PsdError = PsdError; exports.REFINE_EDGE_CONTROLS = REFINE_EDGE_CONTROLS; exports.SELECTION_MODES = SELECTION_MODES; exports.SELECTION_MODE_LABELS = SELECTION_MODE_LABELS; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.SELECTION_TOOLS = SELECTION_TOOLS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.SelectionGesture = SelectionGesture; exports.StrokeCoverage = _chunk4F3YDIWWcjs.StrokeCoverage; exports.SurfaceDraft = _chunkZOOEX3WTcjs.SurfaceDraft; exports.TILE = _chunkZOOEX3WTcjs.TILE; exports.TILE_SHIFT = _chunkZOOEX3WTcjs.TILE_SHIFT; exports.TINT_SCALE = TINT_SCALE; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.TONE_RANGE_PRESETS = TONE_RANGE_PRESETS; exports.TiledSurface = _chunkZOOEX3WTcjs.TiledSurface; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.ZlibError = _chunk73L6TROJcjs.ZlibError; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.addLayerEffect = addLayerEffect; exports.addLayerFilter = addLayerFilter; exports.addToHistogram = addToHistogram; exports.adjustmentKindLabel = adjustmentKindLabel; exports.adjustmentLayersKey = adjustmentLayersKey; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.adler32 = _chunk73L6TROJcjs.adler32; exports.annotationLayerFor = annotationLayerFor; exports.annotationLayerName = annotationLayerName; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustments = applyAdjustments; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyMatrix3 = applyMatrix3; exports.applyOutputStage = applyOutputStage; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyRegionBlur = applyRegionBlur; exports.applyRegionMosaic = applyRegionMosaic; exports.applyStrokeToTile = _chunk4F3YDIWWcjs.applyStrokeToTile; exports.backgroundLayer = backgroundLayer; exports.base64ToBytes = _chunk73L6TROJcjs.base64ToBytes; exports.baseProjection = baseProjection; exports.blackWhiteGray = blackWhiteGray; exports.blendChannel = _chunkZOOEX3WTcjs.blendChannel; exports.blendImageData = _chunkZOOEX3WTcjs.blendImageData; exports.blendLum = _chunkZOOEX3WTcjs.blendLum; exports.blendPixel = _chunkZOOEX3WTcjs.blendPixel; exports.blendRgb = _chunkZOOEX3WTcjs.blendRgb; exports.blendTile = _chunk73L6TROJcjs.blendTile; exports.blurFilter = blurFilter; exports.borderCoverage = borderCoverage; exports.boxMean = boxMean; exports.boxToCurvePoint = boxToCurvePoint; exports.bradfordAdaptation = bradfordAdaptation; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.buildToneLut = buildToneLut; exports.bytesToBase64 = _chunk73L6TROJcjs.bytesToBase64; exports.calculateCropDrag = calculateCropDrag; exports.canvasCompositeOperation = _chunkZOOEX3WTcjs.canvasCompositeOperation; exports.canvasToImagePoint = canvasToImagePoint; exports.changedTiles = _chunk73L6TROJcjs.changedTiles; exports.clampControlValue = clampControlValue; exports.clampCropToImage = clampCropToImage; exports.collectTiles = _chunkZOOEX3WTcjs.collectTiles; exports.colorBalanceChannel = colorBalanceChannel; exports.colorRange = colorRange; exports.combineSelections = combineSelections; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.computeHistogram = computeHistogram; exports.computeSelectionBounds = computeSelectionBounds; exports.contentBounds = _chunkZOOEX3WTcjs.contentBounds; exports.contractCoverage = contractCoverage; exports.controlPosition = controlPosition; exports.controlTrackBackground = controlTrackBackground; exports.coverageTileCoord = _chunk4F3YDIWWcjs.coverageTileCoord; exports.coverageToByte = coverageToByte; exports.coveringRect = coveringRect; exports.createAdjustmentLayer = createAdjustmentLayer; exports.createImageCaptureSurface = createImageCaptureSurface; exports.createImageEditTools = createImageEditTools; exports.createImageEditorToolProvider = createImageEditorToolProvider; exports.createImageEffectTools = createImageEffectTools; exports.createImageLayerTools = createImageLayerTools; exports.createImagePaintTools = createImagePaintTools; exports.createImagePsdTools = createImagePsdTools; exports.createImageSelectionTools = createImageSelectionTools; exports.createPigment = _chunk4F3YDIWWcjs.createPigment; exports.createPigmentTools = _chunk4F3YDIWWcjs.createPigmentTools; exports.createSelectionMask = createSelectionMask; exports.curveLut = _chunk73L6TROJcjs.curveLut; exports.curveLutFromLevels = curveLutFromLevels; exports.curvePointToBox = curvePointToBox; exports.curveSvgPath = curveSvgPath; exports.dabCoverage = _chunk4F3YDIWWcjs.dabCoverage; exports.dabRect = _chunk4F3YDIWWcjs.dabRect; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeLayerMask = decodeLayerMask; exports.decodeMergedImage = decodeMergedImage; exports.decodePlanes = decodePlanes; exports.decodePng = _chunk73L6TROJcjs.decodePng; exports.decodePngDataUrl = decodePngDataUrl; exports.decodeSelectionRle = decodeSelectionRle; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.deflate = _chunk73L6TROJcjs.deflate; exports.deflateRaw = _chunk73L6TROJcjs.deflateRaw; exports.depthMaskAlpha = depthMaskAlpha; exports.depthRasterMask = depthRasterMask; exports.describeLayer = describeLayer; exports.describeLayerEffects = describeLayerEffects; exports.describeSelection = describeSelection; exports.deserializeEffects = deserializeEffects; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.deserializeSelection = deserializeSelection; exports.developFilter = developFilter; exports.developFromAdjustments = developFromAdjustments; exports.developTarget = developTarget; exports.distanceTransform = distanceTransform; exports.downloadPsd = downloadPsd; exports.dropPlacement = dropPlacement; exports.dropZone = dropZone; exports.duplicateLayer = duplicateLayer; exports.edgeWidth = edgeWidth; exports.ellipsePoints = ellipsePoints; exports.ellipseSelection = ellipseSelection; exports.emptyHistogram = emptyHistogram; exports.emptySurface = _chunkZOOEX3WTcjs.emptySurface; exports.encodePng = _chunk73L6TROJcjs.encodePng; exports.encodeRle = encodeRle; exports.encodeSelectionRle = encodeSelectionRle; exports.encodeSurface = encodeSurface; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.expandCoverage = expandCoverage; exports.exportPsd = exportPsd; exports.featherCoverage = featherCoverage; exports.fillRect = _chunkZOOEX3WTcjs.fillRect; exports.findAdjustmentControl = findAdjustmentControl; exports.findLayer = _chunk73L6TROJcjs.findLayer; exports.findLayerControl = findLayerControl; exports.finishTile = _chunkZOOEX3WTcjs.finishTile; exports.flattenLayers = _chunk73L6TROJcjs.flattenLayers; exports.formatControlValue = formatControlValue; exports.fullSelection = fullSelection; exports.gaussianBlur = _chunk73L6TROJcjs.gaussianBlur; exports.getAnnotationBounds = getAnnotationBounds; exports.getControlPath = getControlPath; exports.getCropCursor = getCropCursor; exports.getRotatedSize = getRotatedSize; exports.getViewportMetrics = getViewportMetrics; exports.getViewportProjection = getViewportProjection; exports.globalImageCache = globalImageCache; exports.greyMorphology = greyMorphology; exports.groupLayers = groupLayers; exports.guidePlanes = guidePlanes; exports.guidedFilterColor = guidedFilterColor; exports.handlePaintShortcut = handlePaintShortcut; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.hashMaskContent = hashMaskContent; exports.hexToRgb = hexToRgb; exports.histogramPath = histogramPath; exports.hitTestAnnotation = hitTestAnnotation; exports.hitTestCrop = hitTestCrop; exports.hitTestCurvePoint = hitTestCurvePoint; exports.hslToRgb = hslToRgb; exports.hueRange = hueRange; exports.hueRangeTables = hueRangeTables; exports.hueRangeWeight = hueRangeWeight; exports.hueSaturation = hueSaturation; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.imageEditorStateMigrations = imageEditorStateMigrations; exports.imageToCanvasPoint = imageToCanvasPoint; exports.importPsd = importPsd; exports.inflate = _chunk73L6TROJcjs.inflate; exports.inflateRaw = _chunk73L6TROJcjs.inflateRaw; exports.insertCurvePoint = insertCurvePoint; exports.insertLayer = _chunk73L6TROJcjs.insertLayer; exports.invertMatrix3 = invertMatrix3; exports.invertSelection = invertSelection; exports.isActiveFilter = isActiveFilter; exports.isAdjustmentKind = isAdjustmentKind; exports.isBlendMode = _chunkZOOEX3WTcjs.isBlendMode; exports.isDefaultDepthMask = isDefaultDepthMask; exports.isLayerLocked = _chunk73L6TROJcjs.isLayerLocked; exports.isLegacyShape = isLegacyShape; exports.isPaintTool = isPaintTool; exports.isPng = _chunk73L6TROJcjs.isPng; exports.isQuarterTurn = isQuarterTurn; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.isSelectionEmpty = isSelectionEmpty; exports.isSelectionMode = isSelectionMode; exports.isSeparableBlendMode = _chunkZOOEX3WTcjs.isSeparableBlendMode; exports.isSpatialFilter = isSpatialFilter; exports.kelvinToTemperature = kelvinToTemperature; exports.layerBadge = layerBadge; exports.layerEffectsOf = layerEffectsOf; exports.layerLabel = layerLabel; exports.layerMaskCoverage = layerMaskCoverage; exports.layerMaskFromSelection = layerMaskFromSelection; exports.layerMaskKey = layerMaskKey; exports.layerMenu = layerMenu; exports.layerName = layerName; exports.layerPanelRows = layerPanelRows; exports.layerTree = layerTree; exports.layerTypeLabel = layerTypeLabel; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.legacyMaskOf = legacyMaskOf; exports.legacyView = legacyView; exports.lerpPigment = _chunk4F3YDIWWcjs.lerpPigment; exports.lerpPigmentInto = _chunk4F3YDIWWcjs.lerpPigmentInto; exports.levelsValue = levelsValue; exports.linearSrgbToXy = linearSrgbToXy; exports.linearToSrgb = linearToSrgb; exports.loadImageEditorDocument = loadImageEditorDocument; exports.magicWand = magicWand; exports.mapCropHandle = mapCropHandle; exports.mapLayer = _chunk73L6TROJcjs.mapLayer; exports.maskSummary = maskSummary; exports.migrateSerializedImageEditorState = migrateSerializedImageEditorState; exports.migrateToLayeredState = migrateToLayeredState; exports.mixPigments = _chunk4F3YDIWWcjs.mixPigments; exports.modifySelection = modifySelection; exports.moveCurvePoint = moveCurvePoint; exports.moveLayer = moveLayer; exports.mulMatrix3 = mulMatrix3; exports.needsLegacyBase = needsLegacyBase; exports.neutralHueRange = neutralHueRange; exports.newLayerId = newLayerId; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.normalizeAngle = normalizeAngle; exports.normalizeBlendMode = _chunkZOOEX3WTcjs.normalizeBlendMode; exports.normalizeBrush = _chunk4F3YDIWWcjs.normalizeBrush; exports.normalizeFilter = normalizeFilter; exports.normalizeLayerMask = normalizeLayerMask; exports.normalizeProcessVersion = normalizeProcessVersion; exports.normalizeRect = normalizeRect; exports.normalizeRefineEdgeParams = normalizeRefineEdgeParams; exports.normalizeStoredAdjustments = normalizeStoredAdjustments; exports.offsetLayer = offsetLayer; exports.openPsdFile = openPsdFile; exports.packRgba = _chunkZOOEX3WTcjs.packRgba; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.parseBlend = parseBlend; exports.parseColor = parseColor; exports.parseDataUrl = _chunk73L6TROJcjs.parseDataUrl; exports.parseSelectionMode = parseSelectionMode; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.photoFilterMatrix = photoFilterMatrix; exports.pixelLayerBounds = pixelLayerBounds; exports.pixelLayers = pixelLayers; exports.placeLayer = placeLayer; exports.pngDataUrl = _chunk73L6TROJcjs.pngDataUrl; exports.pointerPressure = pointerPressure; exports.polygonCoverage = polygonCoverage; exports.polygonSelection = polygonSelection; exports.posterizeValue = posterizeValue; exports.projectImagePoint = projectImagePoint; exports.projectImageRect = projectImageRect; exports.projectMaskCoverage = projectMaskCoverage; exports.projectQuarterTurn = projectQuarterTurn; exports.psdBytesFromBase64 = psdBytesFromBase64; exports.psdFileName = psdFileName; exports.psdToLayers = psdToLayers; exports.quickMaskPixels = quickMaskPixels; exports.rangeLightness = rangeLightness; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.rasterizeDab = _chunk4F3YDIWWcjs.rasterizeDab; exports.readAdjustmentControls = readAdjustmentControls; exports.readPixel = _chunkZOOEX3WTcjs.readPixel; exports.readPsd = readPsd; exports.readRegion = _chunkZOOEX3WTcjs.readRegion; exports.rectSelection = rectSelection; exports.refineCoverage = refineCoverage; exports.refineEdgeHalo = refineEdgeHalo; exports.refineSelection = refineSelection; exports.reflectanceToRgb = _chunk4F3YDIWWcjs.reflectanceToRgb; exports.removeAlpha = removeAlpha; exports.removeCurvePoint = removeCurvePoint; exports.removeLayer = removeLayer; exports.removeLayerEffect = removeLayerEffect; exports.removeLayerFilter = removeLayerFilter; exports.renderLayeredBase = renderLayeredBase; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.resizePixels = resizePixels; exports.resizeSelection = resizeSelection; exports.resolveExternalAssets = resolveExternalAssets; exports.resolveMosaicRegionBounds = resolveMosaicRegionBounds; exports.rgbToGray = rgbToGray; exports.rgbToHsl = rgbToHsl; exports.rgbToReflectance = _chunk4F3YDIWWcjs.rgbToReflectance; exports.runLayerMenuAction = runLayerMenuAction; exports.sampleLut = sampleLut; exports.sampleToneLut = sampleToneLut; exports.selectionArea = selectionArea; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionFromPixels = selectionFromPixels; exports.selectionModeFromModifiers = selectionModeFromModifiers; exports.selectionOutline = selectionOutline; exports.selectionToCoverage = selectionToCoverage; exports.selectionToPixels = selectionToPixels; exports.selectionValueAt = selectionValueAt; exports.serializeEffects = serializeEffects; exports.serializeLayer = serializeLayer; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.serializeSelection = serializeSelection; exports.setControlPath = setControlPath; exports.setLayerEffects = setLayerEffects; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.setLayerMask = setLayerMask; exports.setLayerProperties = setLayerProperties; exports.setLum = _chunkZOOEX3WTcjs.setLum; exports.setPigmentColor = _chunk4F3YDIWWcjs.setPigmentColor; exports.shiftCoverage = shiftCoverage; exports.smoothCoverage = smoothCoverage; exports.smoothPoints = _chunk4F3YDIWWcjs.smoothPoints; exports.solidSurface = _chunkZOOEX3WTcjs.solidSurface; exports.splitOverlayAnnotations = splitOverlayAnnotations; exports.srgb8ToLab = srgb8ToLab; exports.srgbToLinear = srgbToLinear; exports.sumHistograms = sumHistograms; exports.surfaceBytes = _chunkZOOEX3WTcjs.surfaceBytes; exports.surfaceFromPixels = _chunkZOOEX3WTcjs.surfaceFromPixels; exports.surfacesEqual = _chunkZOOEX3WTcjs.surfacesEqual; exports.tempTintToXy = tempTintToXy; exports.temperatureToKelvin = temperatureToKelvin; exports.tileCoord = _chunkZOOEX3WTcjs.tileCoord; exports.tileKey = _chunkZOOEX3WTcjs.tileKey; exports.tileRect = _chunkZOOEX3WTcjs.tileRect; exports.tilesInRect = _chunkZOOEX3WTcjs.tilesInRect; exports.tipFalloff = _chunk4F3YDIWWcjs.tipFalloff; exports.tipReach = _chunk4F3YDIWWcjs.tipReach; exports.tipShape = _chunk4F3YDIWWcjs.tipShape; exports.toHex = toHex2; exports.toneCurve = toneCurve; exports.toneLuts = toneLuts; exports.toneRange = toneRange; exports.translateSurface = _chunkZOOEX3WTcjs.translateSurface; exports.ungroupLayer = ungroupLayer; exports.uniformTile = _chunkZOOEX3WTcjs.uniformTile; exports.unionRect = unionRect; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.updateLayerEffect = updateLayerEffect; exports.updateLayerFilter = updateLayerFilter; exports.updateLayerMaskProps = updateLayerMaskProps; exports.uvToXy = uvToXy; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.walkDabs = _chunk4F3YDIWWcjs.walkDabs; exports.wbMatrix = wbMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.withNewIds = withNewIds; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.writePsd = writePsd; exports.writeRegion = _chunkZOOEX3WTcjs.writeRegion; exports.xyToTempTint = xyToTempTint; exports.xyToUv = xyToUv;
|
|
13414
|
+
|
|
13415
|
+
|
|
13416
|
+
|
|
13417
|
+
|
|
13418
|
+
|
|
13419
|
+
|
|
13420
|
+
|
|
13421
|
+
|
|
13422
|
+
|
|
13423
|
+
|
|
13424
|
+
|
|
13425
|
+
|
|
13426
|
+
|
|
13427
|
+
|
|
13428
|
+
|
|
13429
|
+
exports.ADJUSTMENT_KEYS = ADJUSTMENT_KEYS; exports.ADJUSTMENT_KINDS = ADJUSTMENT_KINDS; exports.ADJUSTMENT_LAYER_CONTROLS = ADJUSTMENT_LAYER_CONTROLS; exports.ADJUSTMENT_LAYER_OPACITY_CONTROL = ADJUSTMENT_LAYER_OPACITY_CONTROL; exports.ADJUSTMENT_LUT_SIZE = ADJUSTMENT_LUT_SIZE; exports.AS_SHOT_KELVIN = AS_SHOT_KELVIN; exports.BACKGROUND_LAYER_ID = BACKGROUND_LAYER_ID; exports.BACKGROUND_LAYER_NAME = BACKGROUND_LAYER_NAME; exports.BLEND_MODES = _chunkCRMAXIUVcjs.BLEND_MODES; exports.BLUR_FILTER_ID = BLUR_FILTER_ID; exports.BRUSH_OPTION_CONTROLS = BRUSH_OPTION_CONTROLS; exports.CoverageMap = _chunkZZOTHJ4Kcjs.CoverageMap; exports.D50 = D50; exports.D65 = D65; exports.DEFAULT_ADJUSTMENTS = DEFAULT_ADJUSTMENTS; exports.DEFAULT_BRUSH = _chunkZZOTHJ4Kcjs.DEFAULT_BRUSH; exports.DEFAULT_DEPTH_MASK = DEFAULT_DEPTH_MASK; exports.DEFAULT_MIXER = _chunkZZOTHJ4Kcjs.DEFAULT_MIXER; exports.DEFAULT_REFINE_EDGE_PARAMS = DEFAULT_REFINE_EDGE_PARAMS; exports.DEFAULT_SELECTION_TOOL_OPTIONS = DEFAULT_SELECTION_TOOL_OPTIONS; exports.DEFAULT_TRANSFORM = DEFAULT_TRANSFORM; exports.DEVELOP_FILTER_ID = DEVELOP_FILTER_ID; exports.DIRECT_GAUSSIAN_MAX_SIGMA = _chunkT6H3JDGAcjs.DIRECT_GAUSSIAN_MAX_SIGMA; exports.DabWalker = _chunkZZOTHJ4Kcjs.DabWalker; exports.EMPTY_DISTANCE = EMPTY_DISTANCE; exports.EMPTY_MIXER_LOAD = _chunkZZOTHJ4Kcjs.EMPTY_MIXER_LOAD; exports.GUIDED_FILTER_EPS = GUIDED_FILTER_EPS; exports.HISTOGRAM_BINS = HISTOGRAM_BINS; exports.HUE_RANGE_LABELS = HUE_RANGE_LABELS; exports.IDENTITY_MATRIX3 = IDENTITY_MATRIX3; exports.IMAGE_ADJUSTMENT_CONTROLS = IMAGE_ADJUSTMENT_CONTROLS; exports.IMAGE_EDITOR_SCHEMA_VERSION = IMAGE_EDITOR_SCHEMA_VERSION; exports.IMAGE_EDITOR_STATE_VERSION = IMAGE_EDITOR_STATE_VERSION; exports.ImageEditorController = ImageEditorController; exports.ImageEditorRenderer = ImageEditorRenderer; exports.LATEST_PROCESS_VERSION = LATEST_PROCESS_VERSION; exports.LAYERED_SCHEMA_VERSION = LAYERED_SCHEMA_VERSION; exports.LEGACY_PROCESS_VERSION = LEGACY_PROCESS_VERSION; exports.LUMA_709 = LUMA_709; exports.LayerCompositor = LayerCompositor; exports.LayerOperationError = LayerOperationError; exports.MAX_BRUSH_SIZE = _chunkZZOTHJ4Kcjs.MAX_BRUSH_SIZE; exports.MAX_KELVIN = MAX_KELVIN; exports.MIN_KELVIN = MIN_KELVIN; exports.MIRED_PER_TEMPERATURE_UNIT = MIRED_PER_TEMPERATURE_UNIT; exports.MIXER_DRAIN = _chunkZZOTHJ4Kcjs.MIXER_DRAIN; exports.MIXER_MIXING_OPTIONS = MIXER_MIXING_OPTIONS; exports.MIXER_OPTION_CONTROLS = MIXER_OPTION_CONTROLS; exports.MIXER_PICKUP_RATE = _chunkZZOTHJ4Kcjs.MIXER_PICKUP_RATE; exports.MIXING_MODELS = _chunkZZOTHJ4Kcjs.MIXING_MODELS; exports.MixerStroke = _chunkZZOTHJ4Kcjs.MixerStroke; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PIGMENT_BANDS = _chunkCRMAXIUVcjs.PIGMENT_BANDS; exports.PIGMENT_LAMBDA_MIN = _chunkCRMAXIUVcjs.PIGMENT_LAMBDA_MIN; exports.PIGMENT_LAMBDA_STEP = _chunkCRMAXIUVcjs.PIGMENT_LAMBDA_STEP; exports.PIGMENT_WAVELENGTHS = _chunkCRMAXIUVcjs.PIGMENT_WAVELENGTHS; exports.PSD_BLEND_KEYS = PSD_BLEND_KEYS; exports.PSD_FILE_ACCEPT = PSD_FILE_ACCEPT; exports.PaintGesture = PaintGesture; exports.PaintStrokeSession = PaintStrokeSession; exports.PsdError = PsdError; exports.REFINE_EDGE_CONTROLS = REFINE_EDGE_CONTROLS; exports.SELECTION_MODES = SELECTION_MODES; exports.SELECTION_MODE_LABELS = SELECTION_MODE_LABELS; exports.SELECTION_MODIFY_OPS = SELECTION_MODIFY_OPS; exports.SELECTION_TOOLS = SELECTION_TOOLS; exports.SUPPORTED_ADJUSTMENT_KEYS = SUPPORTED_ADJUSTMENT_KEYS; exports.SelectionGesture = SelectionGesture; exports.StrokeCoverage = _chunkZZOTHJ4Kcjs.StrokeCoverage; exports.SurfaceDraft = _chunkCRMAXIUVcjs.SurfaceDraft; exports.TILE = _chunkCRMAXIUVcjs.TILE; exports.TILE_SHIFT = _chunkCRMAXIUVcjs.TILE_SHIFT; exports.TINT_SCALE = TINT_SCALE; exports.TONE_LUT_SIZE = TONE_LUT_SIZE; exports.TONE_RANGE_PRESETS = TONE_RANGE_PRESETS; exports.TiledSurface = _chunkCRMAXIUVcjs.TiledSurface; exports.VIBRANCE_GREY = VIBRANCE_GREY; exports.XYZ_D50_TO_SRGB = XYZ_D50_TO_SRGB; exports.ZlibError = _chunkT6H3JDGAcjs.ZlibError; exports.activeAdjustmentLayers = activeAdjustmentLayers; exports.addLayerEffect = addLayerEffect; exports.addLayerFilter = addLayerFilter; exports.addToHistogram = addToHistogram; exports.adjustmentKindLabel = adjustmentKindLabel; exports.adjustmentLayersKey = adjustmentLayersKey; exports.adjustmentNodeAsLayer = adjustmentNodeAsLayer; exports.adjustmentNodeFromLegacy = adjustmentNodeFromLegacy; exports.adler32 = _chunkT6H3JDGAcjs.adler32; exports.annotationLayerFor = annotationLayerFor; exports.annotationLayerName = annotationLayerName; exports.applyAdjustmentLayers = applyAdjustmentLayers; exports.applyAdjustments = applyAdjustments; exports.applyBoxBlur = applyBoxBlur; exports.applyDepthMask = applyDepthMask; exports.applyImageProjectionToContext = applyImageProjectionToContext; exports.applyLegacyAdjustments = applyLegacyAdjustments; exports.applyMatrix3 = applyMatrix3; exports.applyOutputStage = applyOutputStage; exports.applyProcess2Adjustments = applyProcess2Adjustments; exports.applyRegionBlur = applyRegionBlur; exports.applyRegionMosaic = applyRegionMosaic; exports.applyStrokeToTile = _chunkZZOTHJ4Kcjs.applyStrokeToTile; exports.backgroundLayer = backgroundLayer; exports.base64ToBytes = _chunkT6H3JDGAcjs.base64ToBytes; exports.baseProjection = baseProjection; exports.blackWhiteGray = blackWhiteGray; exports.blendChannel = _chunkCRMAXIUVcjs.blendChannel; exports.blendImageData = _chunkCRMAXIUVcjs.blendImageData; exports.blendLum = _chunkCRMAXIUVcjs.blendLum; exports.blendPixel = _chunkCRMAXIUVcjs.blendPixel; exports.blendRgb = _chunkCRMAXIUVcjs.blendRgb; exports.blendTile = _chunkT6H3JDGAcjs.blendTile; exports.blurFilter = blurFilter; exports.borderCoverage = borderCoverage; exports.boxMean = boxMean; exports.boxToCurvePoint = boxToCurvePoint; exports.bradfordAdaptation = bradfordAdaptation; exports.buildLayerMaskPlanes = buildLayerMaskPlanes; exports.buildToneLut = buildToneLut; exports.bytesToBase64 = _chunkT6H3JDGAcjs.bytesToBase64; exports.calculateCropDrag = calculateCropDrag; exports.canvasCompositeOperation = _chunkCRMAXIUVcjs.canvasCompositeOperation; exports.canvasToImagePoint = canvasToImagePoint; exports.changedTiles = _chunkT6H3JDGAcjs.changedTiles; exports.clampControlValue = clampControlValue; exports.clampCropToImage = clampCropToImage; exports.cleanMixer = _chunkZZOTHJ4Kcjs.cleanMixer; exports.collectTiles = _chunkCRMAXIUVcjs.collectTiles; exports.colorBalanceChannel = colorBalanceChannel; exports.colorRange = colorRange; exports.combineSelections = combineSelections; exports.compileAdjustmentLayer = compileAdjustmentLayer; exports.computeHistogram = computeHistogram; exports.computeSelectionBounds = computeSelectionBounds; exports.contentBounds = _chunkCRMAXIUVcjs.contentBounds; exports.contractCoverage = contractCoverage; exports.controlPosition = controlPosition; exports.controlTrackBackground = controlTrackBackground; exports.coverageTileCoord = _chunkZZOTHJ4Kcjs.coverageTileCoord; exports.coverageToByte = coverageToByte; exports.coveringRect = coveringRect; exports.createAdjustmentLayer = createAdjustmentLayer; exports.createImageCaptureSurface = createImageCaptureSurface; exports.createImageEditTools = createImageEditTools; exports.createImageEditorToolProvider = createImageEditorToolProvider; exports.createImageEffectTools = createImageEffectTools; exports.createImageLayerTools = createImageLayerTools; exports.createImagePaintTools = createImagePaintTools; exports.createImagePsdTools = createImagePsdTools; exports.createImageSelectionTools = createImageSelectionTools; exports.createPigment = _chunkCRMAXIUVcjs.createPigment; exports.createPigmentTools = _chunkZZOTHJ4Kcjs.createPigmentTools; exports.createSelectionMask = createSelectionMask; exports.curveLut = _chunkT6H3JDGAcjs.curveLut; exports.curveLutFromLevels = curveLutFromLevels; exports.curvePointToBox = curvePointToBox; exports.curveSvgPath = curveSvgPath; exports.dabCoverage = _chunkZZOTHJ4Kcjs.dabCoverage; exports.dabRect = _chunkZZOTHJ4Kcjs.dabRect; exports.decodeLayerChannel = decodeLayerChannel; exports.decodeLayerMask = decodeLayerMask; exports.decodeMergedImage = decodeMergedImage; exports.decodePlanes = decodePlanes; exports.decodePng = _chunkT6H3JDGAcjs.decodePng; exports.decodePngDataUrl = decodePngDataUrl; exports.decodeSelectionRle = decodeSelectionRle; exports.defaultAdjustmentParams = defaultAdjustmentParams; exports.deflate = _chunkT6H3JDGAcjs.deflate; exports.deflateRaw = _chunkT6H3JDGAcjs.deflateRaw; exports.depthMaskAlpha = depthMaskAlpha; exports.depthRasterMask = depthRasterMask; exports.describeLayer = describeLayer; exports.describeLayerEffects = describeLayerEffects; exports.describeSelection = describeSelection; exports.deserializeEffects = deserializeEffects; exports.deserializeLayer = deserializeLayer; exports.deserializeLayers = deserializeLayers; exports.deserializeSelection = deserializeSelection; exports.developFilter = developFilter; exports.developFromAdjustments = developFromAdjustments; exports.developTarget = developTarget; exports.distanceTransform = distanceTransform; exports.downloadPsd = downloadPsd; exports.dropPlacement = dropPlacement; exports.dropZone = dropZone; exports.duplicateLayer = duplicateLayer; exports.edgeWidth = edgeWidth; exports.ellipsePoints = ellipsePoints; exports.ellipseSelection = ellipseSelection; exports.emptyHistogram = emptyHistogram; exports.emptySurface = _chunkCRMAXIUVcjs.emptySurface; exports.encodePng = _chunkT6H3JDGAcjs.encodePng; exports.encodeRle = encodeRle; exports.encodeSelectionRle = encodeSelectionRle; exports.encodeSurface = encodeSurface; exports.evaluateAdjustmentLayers = evaluateAdjustmentLayers; exports.expandCoverage = expandCoverage; exports.exportPsd = exportPsd; exports.featherCoverage = featherCoverage; exports.fillRect = _chunkCRMAXIUVcjs.fillRect; exports.findAdjustmentControl = findAdjustmentControl; exports.findLayer = _chunkT6H3JDGAcjs.findLayer; exports.findLayerControl = findLayerControl; exports.finishTile = _chunkCRMAXIUVcjs.finishTile; exports.flattenLayers = _chunkT6H3JDGAcjs.flattenLayers; exports.formatControlValue = formatControlValue; exports.fullSelection = fullSelection; exports.gaussianBlur = _chunkT6H3JDGAcjs.gaussianBlur; exports.getAnnotationBounds = getAnnotationBounds; exports.getControlPath = getControlPath; exports.getCropCursor = getCropCursor; exports.getRotatedSize = getRotatedSize; exports.getViewportMetrics = getViewportMetrics; exports.getViewportProjection = getViewportProjection; exports.globalImageCache = globalImageCache; exports.greyMorphology = greyMorphology; exports.groupLayers = groupLayers; exports.guidePlanes = guidePlanes; exports.guidedFilterColor = guidedFilterColor; exports.handlePaintShortcut = handlePaintShortcut; exports.hasResampledLegacyMask = hasResampledLegacyMask; exports.hashMaskContent = hashMaskContent; exports.hexToRgb = hexToRgb; exports.histogramPath = histogramPath; exports.hitTestAnnotation = hitTestAnnotation; exports.hitTestCrop = hitTestCrop; exports.hitTestCurvePoint = hitTestCurvePoint; exports.hslToRgb = hslToRgb; exports.hueRange = hueRange; exports.hueRangeTables = hueRangeTables; exports.hueRangeWeight = hueRangeWeight; exports.hueSaturation = hueSaturation; exports.identityCurve = identityCurve; exports.identityLevels = identityLevels; exports.imageEditorStateMigrations = imageEditorStateMigrations; exports.imageToCanvasPoint = imageToCanvasPoint; exports.importPsd = importPsd; exports.inflate = _chunkT6H3JDGAcjs.inflate; exports.inflateRaw = _chunkT6H3JDGAcjs.inflateRaw; exports.insertCurvePoint = insertCurvePoint; exports.insertLayer = _chunkT6H3JDGAcjs.insertLayer; exports.invertMatrix3 = invertMatrix3; exports.invertSelection = invertSelection; exports.isActiveFilter = isActiveFilter; exports.isAdjustmentKind = isAdjustmentKind; exports.isBlendMode = _chunkCRMAXIUVcjs.isBlendMode; exports.isDefaultDepthMask = isDefaultDepthMask; exports.isLayerLocked = _chunkT6H3JDGAcjs.isLayerLocked; exports.isLegacyShape = isLegacyShape; exports.isPaintTool = isPaintTool; exports.isPng = _chunkT6H3JDGAcjs.isPng; exports.isQuarterTurn = isQuarterTurn; exports.isQuarterTurnSwapped = isQuarterTurnSwapped; exports.isSelectionEmpty = isSelectionEmpty; exports.isSelectionMode = isSelectionMode; exports.isSeparableBlendMode = _chunkCRMAXIUVcjs.isSeparableBlendMode; exports.isSpatialFilter = isSpatialFilter; exports.kelvinToTemperature = kelvinToTemperature; exports.layerBadge = layerBadge; exports.layerEffectsOf = layerEffectsOf; exports.layerLabel = layerLabel; exports.layerMaskCoverage = layerMaskCoverage; exports.layerMaskFromSelection = layerMaskFromSelection; exports.layerMaskKey = layerMaskKey; exports.layerMenu = layerMenu; exports.layerName = layerName; exports.layerPanelRows = layerPanelRows; exports.layerTree = layerTree; exports.layerTypeLabel = layerTypeLabel; exports.layersFromLegacy = layersFromLegacy; exports.legacyAdjustmentLayer = legacyAdjustmentLayer; exports.legacyMaskOf = legacyMaskOf; exports.legacyView = legacyView; exports.lerpPigment = _chunkCRMAXIUVcjs.lerpPigment; exports.lerpPigmentInto = _chunkCRMAXIUVcjs.lerpPigmentInto; exports.levelsValue = levelsValue; exports.linearSrgbToXy = linearSrgbToXy; exports.linearToSrgb = linearToSrgb; exports.loadImageEditorDocument = loadImageEditorDocument; exports.loadMixer = _chunkZZOTHJ4Kcjs.loadMixer; exports.magicWand = magicWand; exports.mapCropHandle = mapCropHandle; exports.mapLayer = _chunkT6H3JDGAcjs.mapLayer; exports.maskSummary = maskSummary; exports.migrateSerializedImageEditorState = migrateSerializedImageEditorState; exports.migrateToLayeredState = migrateToLayeredState; exports.mixPigment8 = _chunkCRMAXIUVcjs.mixPigment8; exports.mixPigmentRgb = _chunkCRMAXIUVcjs.mixPigmentRgb; exports.mixPigments = _chunkCRMAXIUVcjs.mixPigments; exports.mixerLoadResult = mixerLoadResult; exports.modifySelection = modifySelection; exports.moveCurvePoint = moveCurvePoint; exports.moveLayer = moveLayer; exports.mulMatrix3 = mulMatrix3; exports.needsLegacyBase = needsLegacyBase; exports.neutralHueRange = neutralHueRange; exports.newLayerId = newLayerId; exports.normalizeAdjustmentLayer = normalizeAdjustmentLayer; exports.normalizeAdjustmentLayers = normalizeAdjustmentLayers; exports.normalizeAngle = normalizeAngle; exports.normalizeBlendMode = _chunkCRMAXIUVcjs.normalizeBlendMode; exports.normalizeBrush = _chunkZZOTHJ4Kcjs.normalizeBrush; exports.normalizeFilter = normalizeFilter; exports.normalizeLayerMask = normalizeLayerMask; exports.normalizeMixer = _chunkZZOTHJ4Kcjs.normalizeMixer; exports.normalizeProcessVersion = normalizeProcessVersion; exports.normalizeRect = normalizeRect; exports.normalizeRefineEdgeParams = normalizeRefineEdgeParams; exports.normalizeStoredAdjustments = normalizeStoredAdjustments; exports.offsetLayer = offsetLayer; exports.openPsdFile = openPsdFile; exports.packRgba = _chunkCRMAXIUVcjs.packRgba; exports.parseAdjustmentBlock = parseAdjustmentBlock; exports.parseBlend = parseBlend; exports.parseColor = parseColor; exports.parseDataUrl = _chunkT6H3JDGAcjs.parseDataUrl; exports.parseSelectionMode = parseSelectionMode; exports.parseVersionedDescriptor = parseVersionedDescriptor; exports.photoFilterMatrix = photoFilterMatrix; exports.pixelLayerBounds = pixelLayerBounds; exports.pixelLayers = pixelLayers; exports.placeLayer = placeLayer; exports.pngDataUrl = _chunkT6H3JDGAcjs.pngDataUrl; exports.pointerPressure = pointerPressure; exports.polygonCoverage = polygonCoverage; exports.polygonSelection = polygonSelection; exports.posterizeValue = posterizeValue; exports.projectImagePoint = projectImagePoint; exports.projectImageRect = projectImageRect; exports.projectMaskCoverage = projectMaskCoverage; exports.projectQuarterTurn = projectQuarterTurn; exports.psdBytesFromBase64 = psdBytesFromBase64; exports.psdFileName = psdFileName; exports.psdToLayers = psdToLayers; exports.quickMaskPixels = quickMaskPixels; exports.rangeLightness = rangeLightness; exports.rasterMaskFromLegacy = rasterMaskFromLegacy; exports.rasterizeDab = _chunkZZOTHJ4Kcjs.rasterizeDab; exports.readAdjustmentControls = readAdjustmentControls; exports.readPixel = _chunkCRMAXIUVcjs.readPixel; exports.readPsd = readPsd; exports.readRegion = _chunkCRMAXIUVcjs.readRegion; exports.rectSelection = rectSelection; exports.refineCoverage = refineCoverage; exports.refineEdgeHalo = refineEdgeHalo; exports.refineSelection = refineSelection; exports.reflectanceToRgb = _chunkCRMAXIUVcjs.reflectanceToRgb; exports.removeAlpha = removeAlpha; exports.removeCurvePoint = removeCurvePoint; exports.removeLayer = removeLayer; exports.removeLayerEffect = removeLayerEffect; exports.removeLayerFilter = removeLayerFilter; exports.renderLayeredBase = renderLayeredBase; exports.requireLayer = requireLayer; exports.requireUnlocked = requireUnlocked; exports.resizePixels = resizePixels; exports.resizeSelection = resizeSelection; exports.resolveExternalAssets = resolveExternalAssets; exports.resolveMosaicRegionBounds = resolveMosaicRegionBounds; exports.rgbToGray = rgbToGray; exports.rgbToHsl = rgbToHsl; exports.rgbToReflectance = _chunkCRMAXIUVcjs.rgbToReflectance; exports.rgbUnitToHex = rgbUnitToHex; exports.runLayerMenuAction = runLayerMenuAction; exports.sampleLut = sampleLut; exports.sampleToneLut = sampleToneLut; exports.selectionArea = selectionArea; exports.selectionFromCoverage = selectionFromCoverage; exports.selectionFromPixels = selectionFromPixels; exports.selectionModeFromModifiers = selectionModeFromModifiers; exports.selectionOutline = selectionOutline; exports.selectionToCoverage = selectionToCoverage; exports.selectionToPixels = selectionToPixels; exports.selectionValueAt = selectionValueAt; exports.serializeEffects = serializeEffects; exports.serializeLayer = serializeLayer; exports.serializeLayers = serializeLayers; exports.serializeLayersExternal = serializeLayersExternal; exports.serializeSelection = serializeSelection; exports.setControlPath = setControlPath; exports.setLayerEffects = setLayerEffects; exports.setLayerEffectsEnabled = setLayerEffectsEnabled; exports.setLayerMask = setLayerMask; exports.setLayerProperties = setLayerProperties; exports.setLum = _chunkCRMAXIUVcjs.setLum; exports.setPigmentColor = _chunkCRMAXIUVcjs.setPigmentColor; exports.shiftCoverage = shiftCoverage; exports.smoothCoverage = smoothCoverage; exports.smoothPoints = _chunkZZOTHJ4Kcjs.smoothPoints; exports.solidSurface = _chunkCRMAXIUVcjs.solidSurface; exports.splitOverlayAnnotations = splitOverlayAnnotations; exports.srgb8ToLab = srgb8ToLab; exports.srgbToLinear = srgbToLinear; exports.sumHistograms = sumHistograms; exports.surfaceBytes = _chunkCRMAXIUVcjs.surfaceBytes; exports.surfaceFromPixels = _chunkCRMAXIUVcjs.surfaceFromPixels; exports.surfacesEqual = _chunkCRMAXIUVcjs.surfacesEqual; exports.tempTintToXy = tempTintToXy; exports.temperatureToKelvin = temperatureToKelvin; exports.tileCoord = _chunkCRMAXIUVcjs.tileCoord; exports.tileKey = _chunkCRMAXIUVcjs.tileKey; exports.tileRect = _chunkCRMAXIUVcjs.tileRect; exports.tilesInRect = _chunkCRMAXIUVcjs.tilesInRect; exports.tipFalloff = _chunkZZOTHJ4Kcjs.tipFalloff; exports.tipReach = _chunkZZOTHJ4Kcjs.tipReach; exports.tipShape = _chunkZZOTHJ4Kcjs.tipShape; exports.toHex = toHex2; exports.toneCurve = toneCurve; exports.toneLuts = toneLuts; exports.toneRange = toneRange; exports.translateSurface = _chunkCRMAXIUVcjs.translateSurface; exports.ungroupLayer = ungroupLayer; exports.uniformTile = _chunkCRMAXIUVcjs.uniformTile; exports.unionRect = unionRect; exports.unprojectCanvasPoint = unprojectCanvasPoint; exports.updateLayerEffect = updateLayerEffect; exports.updateLayerFilter = updateLayerFilter; exports.updateLayerMaskProps = updateLayerMaskProps; exports.uvToXy = uvToXy; exports.versionedDescriptorBytes = versionedDescriptorBytes; exports.vibranceLinear = vibranceLinear; exports.vibrancePixel = vibrancePixel; exports.walkDabs = _chunkZZOTHJ4Kcjs.walkDabs; exports.wbMatrix = wbMatrix; exports.whiteBalanceFromSample = whiteBalanceFromSample; exports.whiteBalanceMatrix = whiteBalanceMatrix; exports.withNewIds = withNewIds; exports.writeAdjustmentBlock = writeAdjustmentBlock; exports.writePsd = writePsd; exports.writeRegion = _chunkCRMAXIUVcjs.writeRegion; exports.xyToTempTint = xyToTempTint; exports.xyToUv = xyToUv;
|
|
13226
13430
|
//# sourceMappingURL=index.cjs.map
|