@pixerate/editor 0.248.0 → 0.250.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/README.md +1 -0
- package/dist/animation-editor/index.cjs +118 -114
- package/dist/animation-editor/index.js +11 -7
- package/dist/{brushstrokeRender-QLCXROJK.js → brushstrokeRender-2FHFLSEG.js} +8 -4
- package/dist/{brushstrokeRender-DTDPFBLC.cjs → brushstrokeRender-QGRXOKDA.cjs} +15 -11
- package/dist/canvas/index.cjs +71 -15
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +58 -2
- package/dist/canvas/stickers.d.cts +35 -0
- package/dist/canvas/stickers.d.ts +35 -0
- package/dist/{chunk-RXZL4NG5.js → chunk-226QDRO3.js} +1 -1
- package/dist/{chunk-SC2RZ5EF.js → chunk-2VJAVXLI.js} +2 -2
- package/dist/{chunk-OLNIPTB3.cjs → chunk-2VX55NFM.cjs} +1 -320
- package/dist/chunk-3K6HWEXZ.cjs +92 -0
- package/dist/{chunk-UOOK7HTX.js → chunk-3PPJRMIG.js} +1 -1
- package/dist/{chunk-ZFSLEOSQ.js → chunk-3TWOCSCY.js} +11 -9
- package/dist/chunk-4D6KP5BV.js +92 -0
- package/dist/chunk-4JNWA3VT.cjs +302 -0
- package/dist/{chunk-L3JFOTBQ.js → chunk-5E2Q7ZHI.js} +1 -1
- package/dist/{chunk-2ONK3ERD.cjs → chunk-75K3W4D6.cjs} +20 -20
- package/dist/{chunk-AU6MWQKZ.js → chunk-ABL7IWFZ.js} +1 -1
- package/dist/chunk-ATK6ABN3.cjs +303 -0
- package/dist/{chunk-7T7JWTVE.cjs → chunk-BOHDJJ2O.cjs} +8 -8
- package/dist/{chunk-2PBZBRP5.js → chunk-D5KGAO4Z.js} +10 -92
- package/dist/{chunk-HB4ICNNA.cjs → chunk-DPYAO5U6.cjs} +42 -42
- package/dist/{chunk-6G6ZDDDB.cjs → chunk-GT77U7QG.cjs} +303 -149
- package/dist/{chunk-PQ3H2AAN.cjs → chunk-I7NJPHWV.cjs} +122 -204
- package/dist/{chunk-42TWUPNJ.js → chunk-IRSTHLQQ.js} +1 -320
- package/dist/{chunk-GHCSC2WP.cjs → chunk-ISIO63Q5.cjs} +21 -15
- package/dist/{chunk-OFH6Q67U.js → chunk-JA57JIT5.js} +9 -3
- package/dist/{chunk-VMROIWLL.cjs → chunk-KBYB7OWB.cjs} +3 -3
- package/dist/{chunk-Q2HA52V4.js → chunk-KDLBJ6QR.js} +2 -2
- package/dist/{chunk-WVS5KQDH.cjs → chunk-M2VKFE5L.cjs} +246 -244
- package/dist/{chunk-5GLYUSNT.js → chunk-NOHJP5TK.js} +1 -1
- package/dist/{chunk-XNRBMYNB.js → chunk-NTRAVM2I.js} +1 -1
- package/dist/{chunk-VNBUDVD4.js → chunk-OTEPAQJX.js} +228 -74
- package/dist/chunk-OTTT5N3K.js +322 -0
- package/dist/{chunk-QOBCBGGI.cjs → chunk-QKXO6JPP.cjs} +14 -14
- package/dist/{chunk-NZ3O3A5C.js → chunk-SMSGP2HQ.js} +1 -1
- package/dist/chunk-SZTI6EER.js +13 -0
- package/dist/chunk-U4NUOKBT.js +303 -0
- package/dist/chunk-U67EN7GG.cjs +13 -0
- package/dist/chunk-W5M3J7PV.cjs +322 -0
- package/dist/{chunk-4P6H35HU.js → chunk-WA44NKPF.js} +2 -2
- package/dist/chunk-WKH5ZAUA.js +302 -0
- package/dist/{chunk-L6REDLNB.cjs → chunk-WPUXGDH4.cjs} +7 -7
- package/dist/{chunk-P3NIPIKS.js → chunk-WQCNC4DK.js} +1 -1
- package/dist/{chunk-IBDU6EGZ.cjs → chunk-X7WRL5ZZ.cjs} +35 -35
- package/dist/{chunk-XWTRATIM.cjs → chunk-YM6ZBTXG.cjs} +23 -23
- package/dist/{chunk-TPWB4Y6L.cjs → chunk-YW43M56C.cjs} +1 -1
- package/dist/{chunk-K5DS2JTA.cjs → chunk-Z3BRH4JK.cjs} +6 -6
- package/dist/{chunk-XNZFVYC2.cjs → chunk-ZBCT5MEA.cjs} +7 -7
- package/dist/effects/helpers.d.cts +6 -0
- package/dist/effects/helpers.d.ts +6 -0
- package/dist/effects/index.cjs +62 -60
- package/dist/effects/index.js +5 -3
- package/dist/effects/tools.d.cts +6 -0
- package/dist/effects/tools.d.ts +6 -0
- package/dist/image-editor/effects.d.cts +1 -1
- package/dist/image-editor/effects.d.ts +1 -1
- package/dist/image-editor/index.cjs +1097 -1069
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +58 -30
- package/dist/image-editor/stickers.d.cts +9 -0
- package/dist/image-editor/stickers.d.ts +9 -0
- package/dist/paint/index.cjs +8 -5
- package/dist/paint/index.js +13 -10
- package/dist/paint-editor/controller.d.cts +37 -1
- package/dist/paint-editor/controller.d.ts +37 -1
- package/dist/paint-editor/index.cjs +753 -609
- package/dist/paint-editor/index.d.cts +3 -0
- package/dist/paint-editor/index.d.ts +3 -0
- package/dist/paint-editor/index.js +187 -43
- package/dist/paint-editor/sticker-art.d.cts +55 -0
- package/dist/paint-editor/sticker-art.d.ts +55 -0
- package/dist/paint-editor/stickers.d.cts +30 -17
- package/dist/paint-editor/stickers.d.ts +30 -17
- package/dist/paint-editor/stroke.d.cts +4 -0
- package/dist/paint-editor/stroke.d.ts +4 -0
- package/dist/paint-editor/ui.d.cts +10 -2
- package/dist/paint-editor/ui.d.ts +10 -2
- package/dist/raster/index.cjs +6 -4
- package/dist/raster/index.js +12 -10
- package/dist/stickers/browser.d.cts +48 -0
- package/dist/stickers/browser.d.ts +48 -0
- package/dist/stickers/combine.d.cts +10 -0
- package/dist/stickers/combine.d.ts +10 -0
- package/dist/stickers/conformance.d.cts +18 -0
- package/dist/stickers/conformance.d.ts +18 -0
- package/dist/stickers/editor.d.cts +14 -0
- package/dist/stickers/editor.d.ts +14 -0
- package/dist/stickers/errors.d.cts +6 -0
- package/dist/stickers/errors.d.ts +6 -0
- package/dist/stickers/fake.d.cts +16 -0
- package/dist/stickers/fake.d.ts +16 -0
- package/dist/stickers/helpers.d.cts +51 -0
- package/dist/stickers/helpers.d.ts +51 -0
- package/dist/stickers/index.cjs +337 -0
- package/dist/stickers/index.d.cts +16 -0
- package/dist/stickers/index.d.ts +16 -0
- package/dist/stickers/index.js +337 -0
- package/dist/stickers/stamps.d.cts +13 -0
- package/dist/stickers/stamps.d.ts +13 -0
- package/dist/stickers/tools.d.cts +81 -0
- package/dist/stickers/tools.d.ts +81 -0
- package/dist/stickers/types.d.cts +123 -0
- package/dist/stickers/types.d.ts +123 -0
- package/dist/vector/index.cjs +1018 -981
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +44 -7
- package/dist/vector/stickers.d.cts +11 -0
- package/dist/vector/stickers.d.ts +11 -0
- package/dist/video-editor/index.cjs +344 -344
- package/dist/video-editor/index.js +4 -4
- package/package.json +11 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +8 -5
- package/skills/pixerate-stickers/SKILL.md +57 -0
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14;
|
|
2
2
|
|
|
3
|
-
var _chunkXNZFVYC2cjs = require('../chunk-XNZFVYC2.cjs');
|
|
4
3
|
|
|
4
|
+
var _chunkATK6ABN3cjs = require('../chunk-ATK6ABN3.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunkZBCT5MEAcjs = require('../chunk-ZBCT5MEA.cjs');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkM2VKFE5Lcjs = require('../chunk-M2VKFE5L.cjs');
|
|
12
16
|
require('../chunk-A2IS7EHE.cjs');
|
|
13
17
|
require('../chunk-SS53NNZO.cjs');
|
|
14
18
|
|
|
@@ -26,7 +30,7 @@ require('../chunk-SS53NNZO.cjs');
|
|
|
26
30
|
|
|
27
31
|
|
|
28
32
|
|
|
29
|
-
var
|
|
33
|
+
var _chunkDPYAO5U6cjs = require('../chunk-DPYAO5U6.cjs');
|
|
30
34
|
require('../chunk-QT26RHKK.cjs');
|
|
31
35
|
require('../chunk-K6PXS6DO.cjs');
|
|
32
36
|
|
|
@@ -53,7 +57,7 @@ require('../chunk-K6PXS6DO.cjs');
|
|
|
53
57
|
|
|
54
58
|
|
|
55
59
|
|
|
56
|
-
var
|
|
60
|
+
var _chunkKBYB7OWBcjs = require('../chunk-KBYB7OWB.cjs');
|
|
57
61
|
require('../chunk-BROJYMWU.cjs');
|
|
58
62
|
|
|
59
63
|
|
|
@@ -64,7 +68,12 @@ var _chunkJLWLX52Lcjs = require('../chunk-JLWLX52L.cjs');
|
|
|
64
68
|
|
|
65
69
|
|
|
66
70
|
var _chunkK7ENM55Pcjs = require('../chunk-K7ENM55P.cjs');
|
|
67
|
-
require('../chunk-
|
|
71
|
+
require('../chunk-WPUXGDH4.cjs');
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
68
77
|
|
|
69
78
|
|
|
70
79
|
|
|
@@ -146,11 +155,19 @@ require('../chunk-L6REDLNB.cjs');
|
|
|
146
155
|
|
|
147
156
|
|
|
148
157
|
|
|
158
|
+
var _chunkGT77U7QGcjs = require('../chunk-GT77U7QG.cjs');
|
|
149
159
|
|
|
150
|
-
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
var _chunk4JNWA3VTcjs = require('../chunk-4JNWA3VT.cjs');
|
|
151
167
|
require('../chunk-CVFAAZXE.cjs');
|
|
152
168
|
require('../chunk-GF2RBSDM.cjs');
|
|
153
169
|
require('../chunk-NM3G4VQT.cjs');
|
|
170
|
+
require('../chunk-U67EN7GG.cjs');
|
|
154
171
|
|
|
155
172
|
|
|
156
173
|
var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
@@ -159,7 +176,7 @@ var _chunkPY4GWSE2cjs = require('../chunk-PY4GWSE2.cjs');
|
|
|
159
176
|
|
|
160
177
|
|
|
161
178
|
|
|
162
|
-
var
|
|
179
|
+
var _chunkISIO63Q5cjs = require('../chunk-ISIO63Q5.cjs');
|
|
163
180
|
require('../chunk-WOFXZ3XU.cjs');
|
|
164
181
|
|
|
165
182
|
|
|
@@ -214,13 +231,15 @@ require('../chunk-WOFXZ3XU.cjs');
|
|
|
214
231
|
|
|
215
232
|
|
|
216
233
|
|
|
234
|
+
var _chunkI7NJPHWVcjs = require('../chunk-I7NJPHWV.cjs');
|
|
217
235
|
|
|
218
236
|
|
|
219
237
|
|
|
220
238
|
|
|
221
239
|
|
|
222
240
|
|
|
223
|
-
|
|
241
|
+
|
|
242
|
+
var _chunk3K6HWEXZcjs = require('../chunk-3K6HWEXZ.cjs');
|
|
224
243
|
require('../chunk-YQGCPL5X.cjs');
|
|
225
244
|
|
|
226
245
|
|
|
@@ -230,6 +249,8 @@ require('../chunk-YQGCPL5X.cjs');
|
|
|
230
249
|
|
|
231
250
|
|
|
232
251
|
|
|
252
|
+
var _chunk2VX55NFMcjs = require('../chunk-2VX55NFM.cjs');
|
|
253
|
+
|
|
233
254
|
|
|
234
255
|
|
|
235
256
|
|
|
@@ -237,7 +258,7 @@ require('../chunk-YQGCPL5X.cjs');
|
|
|
237
258
|
|
|
238
259
|
|
|
239
260
|
|
|
240
|
-
var
|
|
261
|
+
var _chunkW5M3J7PVcjs = require('../chunk-W5M3J7PV.cjs');
|
|
241
262
|
|
|
242
263
|
|
|
243
264
|
|
|
@@ -309,7 +330,7 @@ function normalizeCanvas(raw) {
|
|
|
309
330
|
function createPaintDocument(options = {}) {
|
|
310
331
|
const canvas = normalizeCanvas({ width: _nullishCoalesce(options.width, () => ( 2048)), height: _nullishCoalesce(options.height, () => ( 1536)), dpi: options.dpi });
|
|
311
332
|
const layer = createPaintLayer("Layer 1");
|
|
312
|
-
return { canvas, paper:
|
|
333
|
+
return { canvas, paper: _chunkGT77U7QGcjs.normalizePaper.call(void 0, _nullishCoalesce(options.paper, () => ( {}))), layers: [layer], activeLayerId: layer.id, strokes: [] };
|
|
313
334
|
}
|
|
314
335
|
|
|
315
336
|
// src/paint-editor/dab-stroke.ts
|
|
@@ -334,7 +355,7 @@ function mixRgb(a, b, t, mixing) {
|
|
|
334
355
|
if (mixing === "pigment") {
|
|
335
356
|
const o = [0, 0, 0];
|
|
336
357
|
const q = (v) => Math.round(Math.min(1, Math.max(0, v)) * 255);
|
|
337
|
-
|
|
358
|
+
_chunk2VX55NFMcjs.mixPigment8.call(void 0, q(a[0]), q(a[1]), q(a[2]), q(b[0]), q(b[1]), q(b[2]), t, o);
|
|
338
359
|
return [o[0], o[1], o[2]];
|
|
339
360
|
}
|
|
340
361
|
return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
|
|
@@ -353,7 +374,7 @@ function multiColorForDab(mc, palette, index, seed, mixing) {
|
|
|
353
374
|
const n = palette.length;
|
|
354
375
|
if (mc.order === "random") {
|
|
355
376
|
const run = Math.floor(index / mc.length);
|
|
356
|
-
return [...palette[Math.min(n - 1, Math.floor(
|
|
377
|
+
return [...palette[Math.min(n - 1, Math.floor(_chunk3K6HWEXZcjs.rand01.call(void 0, seed, run, 11) * n))]];
|
|
357
378
|
}
|
|
358
379
|
const f = index / mc.length % n;
|
|
359
380
|
const i = Math.floor(f);
|
|
@@ -363,24 +384,24 @@ var PaintDabStroke = (_class = class {
|
|
|
363
384
|
constructor(brush, options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);
|
|
364
385
|
this.brush = brush;
|
|
365
386
|
this.options = options;
|
|
366
|
-
this.smoother = new (0,
|
|
367
|
-
this.copies = _optionalChain([options, 'access', _2 => _2.copies, 'optionalAccess', _3 => _3.length]) ? options.copies : [
|
|
387
|
+
this.smoother = new (0, _chunkGT77U7QGcjs.PenSmoother)(brush.tip.smoothing, brush.pressureSmoothing);
|
|
388
|
+
this.copies = _optionalChain([options, 'access', _2 => _2.copies, 'optionalAccess', _3 => _3.length]) ? options.copies : [_chunkGT77U7QGcjs.IDENTITY_COPY];
|
|
368
389
|
const exchanging = brush.engine === "mixer" || brush.engine === "dab";
|
|
369
|
-
const rates = brush.engine === "mixer" ?
|
|
390
|
+
const rates = brush.engine === "mixer" ? _chunkI7NJPHWVcjs.mixerRates.call(void 0, brush.mixer) : _chunkI7NJPHWVcjs.exchangeRates.call(void 0, brush.behavior.pickup, brush.behavior.mix, 1, brush.behavior.mixing);
|
|
370
391
|
this.mixing = brush.engine === "mixer" ? brush.mixer.mixing : brush.behavior.mixing;
|
|
371
392
|
this.states = this.copies.map((c, i) => ({
|
|
372
|
-
walker: new (0,
|
|
373
|
-
exchange: exchanging ? new (0,
|
|
374
|
-
smudge: brush.engine === "smudge" ? new (0,
|
|
393
|
+
walker: new (0, _chunkGT77U7QGcjs.PenDabWalker)(brush, (_nullishCoalesce(options.seed, () => ( 0))) + i * 7919 | 0, c.linear),
|
|
394
|
+
exchange: exchanging ? new (0, _chunkI7NJPHWVcjs.PaintExchange)(rates, options.load) : null,
|
|
395
|
+
smudge: brush.engine === "smudge" ? new (0, _chunkI7NJPHWVcjs.SmudgeTip)(brush.smudge, brush.tip.size * (1 + brush.dynamics.tiltSize * 1.5)) : null
|
|
375
396
|
}));
|
|
376
|
-
this.medium = new (0,
|
|
397
|
+
this.medium = new (0, _chunkI7NJPHWVcjs.TileMedium)(options.target, brush.engine === "dab" ? { blend: brush.tip.blend } : {});
|
|
377
398
|
this.depth = options.grain && !options.grain.flat ? Math.min(1, Math.max(0, options.paperDepth * brush.grain)) : 0;
|
|
378
|
-
this.coverage = brush.engine === "dab" ? new (0,
|
|
379
|
-
this.sampler = exchanging && options.paint ? new (0,
|
|
399
|
+
this.coverage = brush.engine === "dab" ? new (0, _chunkI7NJPHWVcjs.CoverageMap)() : null;
|
|
400
|
+
this.sampler = exchanging && options.paint ? new (0, _chunkI7NJPHWVcjs.PaintGradientSampler)(options.paint, _nullishCoalesce(options.seed, () => ( 0))) : null;
|
|
380
401
|
const table = _optionalChain([this, 'access', _4 => _4.sampler, 'optionalAccess', _5 => _5.acrossTip]) ? this.sampler.tipTable(GRADIENT_STEPS) : null;
|
|
381
402
|
this.gradient = table ? table.map((e) => e.rgb) : null;
|
|
382
403
|
this.gradientAlpha = table && table.some((e) => e.alpha < 1) ? table.map((e) => e.alpha) : null;
|
|
383
|
-
this.scratch = brush.engine === "blender" ?
|
|
404
|
+
this.scratch = brush.engine === "blender" ? _chunkI7NJPHWVcjs.createBlenderScratch.call(void 0, ) : null;
|
|
384
405
|
}
|
|
385
406
|
|
|
386
407
|
|
|
@@ -439,7 +460,7 @@ var PaintDabStroke = (_class = class {
|
|
|
439
460
|
}
|
|
440
461
|
paintDabs(copy, dabs, rects) {
|
|
441
462
|
for (const d of dabs) {
|
|
442
|
-
const rect =
|
|
463
|
+
const rect = _chunkI7NJPHWVcjs.dabRect.call(void 0, d, this.brush.tip.hardness);
|
|
443
464
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
444
465
|
this.dab(copy, d, rect);
|
|
445
466
|
rects.push(rect);
|
|
@@ -455,13 +476,13 @@ var PaintDabStroke = (_class = class {
|
|
|
455
476
|
}
|
|
456
477
|
const tip = this.tip.subarray(0, n);
|
|
457
478
|
tip.fill(0);
|
|
458
|
-
|
|
479
|
+
_chunkI7NJPHWVcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.brush.tip.hardness, rect, tip);
|
|
459
480
|
if (!(this.depth > 0 && this.options.grain)) return { tip, cov: tip };
|
|
460
481
|
const cov = this.cov.subarray(0, n);
|
|
461
482
|
const grain = this.options.grain;
|
|
462
483
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
463
484
|
const y = rect.y + yy + 0.5;
|
|
464
|
-
for (let xx = 0; xx < rect.width; xx++, k++) cov[k] = tip[k] > 0 ? tip[k] *
|
|
485
|
+
for (let xx = 0; xx < rect.width; xx++, k++) cov[k] = tip[k] > 0 ? tip[k] * _chunkI7NJPHWVcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, y), this.depth, d.pressure) : 0;
|
|
465
486
|
}
|
|
466
487
|
return { tip, cov };
|
|
467
488
|
}
|
|
@@ -470,7 +491,7 @@ var PaintDabStroke = (_class = class {
|
|
|
470
491
|
const { tip, cov } = this.rasterize(d, rect);
|
|
471
492
|
const st = this.states[copy];
|
|
472
493
|
if (brush.engine === "blender") {
|
|
473
|
-
|
|
494
|
+
_chunkI7NJPHWVcjs.blenderDab.call(void 0, this.medium, rect, cov, d.opacity * d.alpha * brush.tip.opacity, d.radius, brush.blender, this.scratch);
|
|
474
495
|
return;
|
|
475
496
|
}
|
|
476
497
|
if (brush.engine === "smudge") {
|
|
@@ -482,7 +503,7 @@ var PaintDabStroke = (_class = class {
|
|
|
482
503
|
let flow = 1;
|
|
483
504
|
if (this.options.effect) {
|
|
484
505
|
const rgb = [0, 0, 0];
|
|
485
|
-
flow =
|
|
506
|
+
flow = _chunkGT77U7QGcjs.sampleEffectAt.call(void 0, this.options.effect, d.x, d.y, rgb, d);
|
|
486
507
|
ex.setReservoirColor(rgb[0], rgb[1], rgb[2]);
|
|
487
508
|
} else if (this.sampler && !this.gradient) {
|
|
488
509
|
const g = this.sampler.dab(d, this.sample);
|
|
@@ -650,10 +671,10 @@ function lightTile(color, height, heightAround, material, light) {
|
|
|
650
671
|
const nh = Math.max(0, nx * hx + ny * hy + nz * hz);
|
|
651
672
|
const spec = Math.max(0, Math.pow(nh, shininess) - Math.pow(hz, shininess)) * (0.25 + 0.75 * gloss) * light.relief;
|
|
652
673
|
for (let c = 0; c < 3; c++) {
|
|
653
|
-
const a =
|
|
674
|
+
const a = _chunkKBYB7OWBcjs.SRGB_TO_LINEAR[color[i + c]];
|
|
654
675
|
const tint = metal * a + (1 - metal);
|
|
655
676
|
const v = a * shade * (1 - 0.35 * metal) + spec * tint * (1 + metal);
|
|
656
|
-
out[i + c] =
|
|
677
|
+
out[i + c] = _chunkKBYB7OWBcjs.linearToSrgb8.call(void 0, v);
|
|
657
678
|
}
|
|
658
679
|
}
|
|
659
680
|
}
|
|
@@ -713,19 +734,19 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
713
734
|
constructor(init) {;_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);_class3.prototype.__init18.call(this);_class3.prototype.__init19.call(this);_class3.prototype.__init20.call(this);_class3.prototype.__init21.call(this);
|
|
714
735
|
this.init = init;
|
|
715
736
|
const b = init.brush;
|
|
716
|
-
this.smoother = new (0,
|
|
717
|
-
const copies = init.copies.length ? init.copies : [
|
|
737
|
+
this.smoother = new (0, _chunkGT77U7QGcjs.PenSmoother)(b.tip.smoothing, b.pressureSmoothing);
|
|
738
|
+
const copies = init.copies.length ? init.copies : [_chunkGT77U7QGcjs.IDENTITY_COPY];
|
|
718
739
|
this.copies = copies;
|
|
719
|
-
const rates =
|
|
740
|
+
const rates = _chunkI7NJPHWVcjs.exchangeRates.call(void 0, b.behavior.pickup, b.behavior.mix, 1, b.behavior.mixing);
|
|
720
741
|
this.states = copies.map((c, i) => ({
|
|
721
|
-
walker: new (0,
|
|
722
|
-
exchange: new (0,
|
|
723
|
-
smudge: b.impasto.tool === "knife" ? new (0,
|
|
742
|
+
walker: new (0, _chunkGT77U7QGcjs.PenDabWalker)(b, init.seed + i * 7919 | 0, c.linear),
|
|
743
|
+
exchange: new (0, _chunkI7NJPHWVcjs.PaintExchange)(rates, init.load),
|
|
744
|
+
smudge: b.impasto.tool === "knife" ? new (0, _chunkI7NJPHWVcjs.SmudgeTip)({ strength: 0.85, length: 0.6 + 0.38 * b.impasto.drag, mixing: b.behavior.mixing }, b.tip.size * 1.2) : null,
|
|
724
745
|
carried: null,
|
|
725
746
|
amount: 1
|
|
726
747
|
}));
|
|
727
|
-
this.medium = new (0,
|
|
728
|
-
this.sampler = init.paint ? new (0,
|
|
748
|
+
this.medium = new (0, _chunkI7NJPHWVcjs.TileMedium)(init.target, {});
|
|
749
|
+
this.sampler = init.paint ? new (0, _chunkI7NJPHWVcjs.PaintGradientSampler)(init.paint.map.by === "across-tip" ? { ...init.paint, map: { by: "distance", length: 300, repeat: "mirror" } } : init.paint, init.seed) : null;
|
|
729
750
|
}
|
|
730
751
|
|
|
731
752
|
__init12() {this.dabCount = 0}
|
|
@@ -822,7 +843,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
822
843
|
}
|
|
823
844
|
applyDabs(copy, dabs, rects) {
|
|
824
845
|
for (const d of dabs) {
|
|
825
|
-
const rect =
|
|
846
|
+
const rect = _chunkI7NJPHWVcjs.dabRect.call(void 0, d, this.init.brush.tip.hardness);
|
|
826
847
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
827
848
|
this.dab(copy, d, rect);
|
|
828
849
|
rects.push(rect);
|
|
@@ -837,7 +858,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
837
858
|
const n = rect.width * rect.height;
|
|
838
859
|
if (this.tip.length < n) this.tip = new Float32Array(n);
|
|
839
860
|
const tip = this.tip.subarray(0, n);
|
|
840
|
-
|
|
861
|
+
_chunkI7NJPHWVcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, b.tip.hardness, rect, tip);
|
|
841
862
|
const sel = this.init.target.selection;
|
|
842
863
|
if (sel) {
|
|
843
864
|
for (let yy = 0, p = 0; yy < rect.height; yy++)
|
|
@@ -864,7 +885,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
864
885
|
let flow = 1;
|
|
865
886
|
const effect = this.init.effect;
|
|
866
887
|
if (effect) {
|
|
867
|
-
|
|
888
|
+
_chunkGT77U7QGcjs.sampleEffectAt.call(void 0, effect, d.x, d.y, this.centre, d);
|
|
868
889
|
ex.setReservoirColor(this.centre[0], this.centre[1], this.centre[2]);
|
|
869
890
|
} else if (this.sampler) {
|
|
870
891
|
const g = this.sampler.dab(d, this.sample);
|
|
@@ -881,7 +902,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
881
902
|
let field = null;
|
|
882
903
|
if (effect) {
|
|
883
904
|
field = new Float32Array(n * 3);
|
|
884
|
-
|
|
905
|
+
_chunkGT77U7QGcjs.effectDabField.call(void 0, effect, rect, cov, this.centre, this.paint, field, 0, d);
|
|
885
906
|
}
|
|
886
907
|
this.medium.deposit(rect, cov, dep, this.paint, ex.paintPigment, field);
|
|
887
908
|
}
|
|
@@ -900,7 +921,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
900
921
|
const full2 = 255 * thick * k;
|
|
901
922
|
switch (im.tool) {
|
|
902
923
|
case "brush": {
|
|
903
|
-
const ridge = 0.6 + 0.4 * Math.sin(u * 9 +
|
|
924
|
+
const ridge = 0.6 + 0.4 * Math.sin(u * 9 + _chunk3K6HWEXZcjs.hash2.call(void 0, Math.round(u * 6), 3, seed) * 6.28) + 0.15 * (_chunk3K6HWEXZcjs.hash2.call(void 0, lx, ly, seed) - 0.5);
|
|
904
925
|
const target = full2 * c * ridge;
|
|
905
926
|
h = Math.max(h0 * (1 - 0.25 * c * im.drag), Math.min(255, h0 * 0.35 + target));
|
|
906
927
|
break;
|
|
@@ -916,7 +937,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
916
937
|
break;
|
|
917
938
|
}
|
|
918
939
|
case "roller": {
|
|
919
|
-
const stipple = 0.75 + 0.5 *
|
|
940
|
+
const stipple = 0.75 + 0.5 * _chunk3K6HWEXZcjs.hash2.call(void 0, lx >> 1, ly >> 1, seed);
|
|
920
941
|
h = h0 + (Math.min(255, full2 * 0.6 * stipple) - h0) * Math.min(1, c * 1.5);
|
|
921
942
|
break;
|
|
922
943
|
}
|
|
@@ -988,15 +1009,15 @@ function reliefInfo(ch) {
|
|
|
988
1009
|
function thickToJSON(ch) {
|
|
989
1010
|
const b = ch.height.bounds;
|
|
990
1011
|
if (!b) return null;
|
|
991
|
-
return { rect: { ...b }, height:
|
|
1012
|
+
return { rect: { ...b }, height: _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, b.width, b.height, _chunk474IQG74cjs.readRegion.call(void 0, ch.height, b), 1), material: _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, b.width, b.height, _chunk474IQG74cjs.readRegion.call(void 0, ch.material, b), 4) };
|
|
992
1013
|
}
|
|
993
1014
|
function thickFromJSON(raw) {
|
|
994
1015
|
const r = raw;
|
|
995
1016
|
if (!r || typeof r !== "object" || !r.rect || typeof r.height !== "string" || typeof r.material !== "string") throw new Error("not saved thick-paint channels");
|
|
996
1017
|
const decode = (url, gray) => {
|
|
997
|
-
const parsed =
|
|
1018
|
+
const parsed = _chunkW5M3J7PVcjs.parseDataUrl.call(void 0, url);
|
|
998
1019
|
if (!parsed) throw new Error("a channel is not a PNG data URL");
|
|
999
|
-
return
|
|
1020
|
+
return _chunkW5M3J7PVcjs.decodePng.call(void 0, parsed.bytes, { keepGray: gray });
|
|
1000
1021
|
};
|
|
1001
1022
|
const h = decode(r.height, true);
|
|
1002
1023
|
const m = decode(r.material, false);
|
|
@@ -1058,7 +1079,7 @@ function shadowToLight(shadow) {
|
|
|
1058
1079
|
return new (0, _chunk474IQG74cjs.TiledSurface)(1, tiles, 0);
|
|
1059
1080
|
}
|
|
1060
1081
|
function lightTwinBrush(brush) {
|
|
1061
|
-
return
|
|
1082
|
+
return _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0,
|
|
1062
1083
|
{
|
|
1063
1084
|
tip: { ...brush.tip, blend: "normal", pressureOpacity: brush.tip.pressureOpacity || brush.light.pressure },
|
|
1064
1085
|
behavior: { ...brush.behavior, mixing: "rgb" },
|
|
@@ -1250,14 +1271,14 @@ function boxBlur(p, w, h, r) {
|
|
|
1250
1271
|
function lightToJSON(light) {
|
|
1251
1272
|
const b = lightInfo(light).bounds;
|
|
1252
1273
|
if (!b) return null;
|
|
1253
|
-
return { rect: { ...b }, light:
|
|
1274
|
+
return { rect: { ...b }, light: _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, b.width, b.height, _chunk474IQG74cjs.readRegion.call(void 0, light, b), 1) };
|
|
1254
1275
|
}
|
|
1255
1276
|
function lightFromJSON(raw) {
|
|
1256
1277
|
const r = raw;
|
|
1257
1278
|
if (!r || typeof r !== "object" || !r.rect || typeof r.light !== "string") throw new Error("not a saved light channel");
|
|
1258
|
-
const parsed =
|
|
1279
|
+
const parsed = _chunkW5M3J7PVcjs.parseDataUrl.call(void 0, r.light);
|
|
1259
1280
|
if (!parsed) throw new Error("the light is not a PNG data URL");
|
|
1260
|
-
const img =
|
|
1281
|
+
const img = _chunkW5M3J7PVcjs.decodePng.call(void 0, parsed.bytes, { keepGray: true });
|
|
1261
1282
|
const data = img.channels === 1 ? img.data : Uint8ClampedArray.from({ length: img.width * img.height }, (_, i) => img.data[i * 4]);
|
|
1262
1283
|
return _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width: img.width, height: img.height, data }, 1, r.rect.x, r.rect.y);
|
|
1263
1284
|
}
|
|
@@ -1288,7 +1309,7 @@ var PaintStrokeSession = (_class5 = class _PaintStrokeSession {
|
|
|
1288
1309
|
this.layerId = init.layerId;
|
|
1289
1310
|
this.base = init.surface;
|
|
1290
1311
|
this.live = new Map(this.base.tiles);
|
|
1291
|
-
this.copies = init.copies.length ? init.copies : [
|
|
1312
|
+
this.copies = init.copies.length ? init.copies : [_chunkGT77U7QGcjs.IDENTITY_COPY];
|
|
1292
1313
|
const brush = init.brush;
|
|
1293
1314
|
if (init.wet) this.wetDriver = init.wet.driver;
|
|
1294
1315
|
if (init.light && !init.wet && !init.sticker) this.lightTwin = this.makeLightTwin(init.light.surface);
|
|
@@ -1305,11 +1326,11 @@ var PaintStrokeSession = (_class5 = class _PaintStrokeSession {
|
|
|
1305
1326
|
};
|
|
1306
1327
|
if (this.wetDriver) {
|
|
1307
1328
|
} else if (init.sticker) {
|
|
1308
|
-
this.stickerSpray = new (0,
|
|
1329
|
+
this.stickerSpray = new (0, _chunkGT77U7QGcjs.StickerSpray)({ brush, target: this.tileTarget(), color: init.colorHex, seed: init.seed, copies: this.copies, nextId: init.sticker.nextId, paint: _nullishCoalesce(init.paint, () => ( null)), effect, art: init.sticker.art });
|
|
1309
1330
|
} else if (init.thick) {
|
|
1310
1331
|
const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
|
|
1311
1332
|
this.thickDriver = new ThickStrokeDriver({ brush, target: this.tileTarget(), channels: init.thick.channels, color: rgb(init.color), load: init.mixerLoad, seed: init.seed, copies: this.copies, paint: _nullishCoalesce(init.paint, () => ( null)), effect });
|
|
1312
|
-
} else if (brush.engine === "mixer" || brush.engine === "blender" || brush.engine === "smudge" ||
|
|
1333
|
+
} else if (brush.engine === "mixer" || brush.engine === "blender" || brush.engine === "smudge" || _chunkGT77U7QGcjs.usesPaintExchange.call(void 0, brush, Boolean(init.paint))) {
|
|
1313
1334
|
const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
|
|
1314
1335
|
this.wet = new PaintDabStroke(brush, {
|
|
1315
1336
|
target: this.tileTarget(),
|
|
@@ -1325,7 +1346,7 @@ var PaintStrokeSession = (_class5 = class _PaintStrokeSession {
|
|
|
1325
1346
|
});
|
|
1326
1347
|
} else {
|
|
1327
1348
|
const opts = { grain: init.grain, paperDepth: init.paperDepth, seed: init.seed, copies: this.copies, paint: _nullishCoalesce(init.paint, () => ( null)), effect };
|
|
1328
|
-
this.dry = brush.engine === "particle" ? new (0,
|
|
1349
|
+
this.dry = brush.engine === "particle" ? new (0, _chunkGT77U7QGcjs.ParticleStroke)(brush, opts) : brush.engine === "bristle" ? new (0, _chunkGT77U7QGcjs.BristleStroke)(brush, opts) : new (0, _chunkGT77U7QGcjs.DryStroke)(brush, opts);
|
|
1329
1350
|
}
|
|
1330
1351
|
}
|
|
1331
1352
|
|
|
@@ -1454,7 +1475,7 @@ var PaintStrokeSession = (_class5 = class _PaintStrokeSession {
|
|
|
1454
1475
|
const changed = d.dabCount > 0;
|
|
1455
1476
|
this.result = { layerId: this.layerId, bounds: changed ? d.bounds : null, dabs: d.dabCount, strokeId: null, wet: true };
|
|
1456
1477
|
const carried = d.load;
|
|
1457
|
-
if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried :
|
|
1478
|
+
if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried : _chunkI7NJPHWVcjs.cleanMixer.call(void 0, carried);
|
|
1458
1479
|
this.host.commit(this, changed ? this.init.wet.surface() : null, false);
|
|
1459
1480
|
}
|
|
1460
1481
|
update(rects) {
|
|
@@ -1480,7 +1501,7 @@ var PaintStrokeSession = (_class5 = class _PaintStrokeSession {
|
|
|
1480
1501
|
const src = _nullishCoalesce(_optionalChain([this, 'access', _53 => _53.base, 'access', _54 => _54.tiles, 'access', _55 => _55.get, 'call', _56 => _56(key), 'optionalAccess', _57 => _57.data]), () => ( defaultTile(this.base)));
|
|
1481
1502
|
const prev = this.touched.has(key) ? _optionalChain([this, 'access', _58 => _58.live, 'access', _59 => _59.get, 'call', _60 => _60(key), 'optionalAccess', _61 => _61.data]) : void 0;
|
|
1482
1503
|
this.touched.add(key);
|
|
1483
|
-
const data =
|
|
1504
|
+
const data = _chunkI7NJPHWVcjs.applyStrokeToTile.call(void 0, this.dry.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
|
|
1484
1505
|
this.live.set(key, { data, uniform: null });
|
|
1485
1506
|
}
|
|
1486
1507
|
this.host.update(this.layerId, new (0, _chunk474IQG74cjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
|
|
@@ -1515,8 +1536,9 @@ var PaintStrokeSession = (_class5 = class _PaintStrokeSession {
|
|
|
1515
1536
|
const surface = changed ? new (0, _chunk474IQG74cjs.TiledSurface)(ch, tiles, this.base.defaultValue) : null;
|
|
1516
1537
|
const dabs = this.dry ? this.dry.dabCount : this.thickDriver ? this.thickDriver.dabCount : this.stickerSpray ? this.stickerSpray.dabCount : this.wet.dabCount;
|
|
1517
1538
|
this.result = { layerId: this.layerId, bounds: changed ? this.bounds : null, dabs, strokeId: null };
|
|
1518
|
-
|
|
1519
|
-
|
|
1539
|
+
if (_optionalChain([this, 'access', _64 => _64.stickerSpray, 'optionalAccess', _65 => _65.skipped, 'access', _66 => _66.size])) this.result.skippedStickers = [...this.stickerSpray.skipped];
|
|
1540
|
+
const carried = _nullishCoalesce(_optionalChain([this, 'access', _67 => _67.wet, 'optionalAccess', _68 => _68.load]), () => ( _optionalChain([this, 'access', _69 => _69.thickDriver, 'optionalAccess', _70 => _70.load])));
|
|
1541
|
+
if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried : _chunkI7NJPHWVcjs.cleanMixer.call(void 0, carried);
|
|
1520
1542
|
this.host.commit(this, surface, false);
|
|
1521
1543
|
return this.result;
|
|
1522
1544
|
}
|
|
@@ -1524,7 +1546,7 @@ var PaintStrokeSession = (_class5 = class _PaintStrokeSession {
|
|
|
1524
1546
|
cancel() {
|
|
1525
1547
|
if (this.closed) return;
|
|
1526
1548
|
this.closed = true;
|
|
1527
|
-
if (_optionalChain([this, 'access',
|
|
1549
|
+
if (_optionalChain([this, 'access', _71 => _71.lightTwin, 'optionalAccess', _72 => _72.open])) this.lightTwin.cancel();
|
|
1528
1550
|
this.lightResult = null;
|
|
1529
1551
|
this.host.commit(this, null, true);
|
|
1530
1552
|
}
|
|
@@ -1539,15 +1561,15 @@ function greyPixels(data, grey) {
|
|
|
1539
1561
|
}
|
|
1540
1562
|
function mixerLoadForStroke(brush, current, color) {
|
|
1541
1563
|
if (!brush.loadsColor) return { reservoir: null, amount: 0, pickup: brush.mixer.cleanEachStroke ? null : current.pickup };
|
|
1542
|
-
if (brush.mixer.loadEachStroke || !current.reservoir) return
|
|
1564
|
+
if (brush.mixer.loadEachStroke || !current.reservoir) return _chunkI7NJPHWVcjs.loadMixer.call(void 0, current, color);
|
|
1543
1565
|
return current;
|
|
1544
1566
|
}
|
|
1545
1567
|
function brushLoadForStroke(brush, current, color) {
|
|
1546
1568
|
if (brush.engine === "mixer") return mixerLoadForStroke(brush, current, color);
|
|
1547
1569
|
if (brush.engine === "impasto") return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
|
|
1548
|
-
if (brush.engine === "wet") return brush.wet.tool === "paint" ? { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null } :
|
|
1549
|
-
if (
|
|
1550
|
-
return
|
|
1570
|
+
if (brush.engine === "wet") return brush.wet.tool === "paint" ? { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null } : _chunkI7NJPHWVcjs.EMPTY_MIXER_LOAD;
|
|
1571
|
+
if (_chunkGT77U7QGcjs.usesPaintExchange.call(void 0, brush)) return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
|
|
1572
|
+
return _chunkI7NJPHWVcjs.EMPTY_MIXER_LOAD;
|
|
1551
1573
|
}
|
|
1552
1574
|
|
|
1553
1575
|
// src/paint-editor/stencils.ts
|
|
@@ -1556,36 +1578,36 @@ var STENCIL_SHAPES = ["rect", "ellipse", "polygon"];
|
|
|
1556
1578
|
var finite = (v) => typeof v === "number" && Number.isFinite(v);
|
|
1557
1579
|
var pt = (p) => p && finite(p.x) && finite(p.y) ? { x: p.x, y: p.y } : void 0;
|
|
1558
1580
|
function normalizeStencil(raw, id, base) {
|
|
1559
|
-
const kind = STENCIL_KINDS.includes(raw.kind) ? raw.kind : _optionalChain([base, 'optionalAccess',
|
|
1581
|
+
const kind = STENCIL_KINDS.includes(raw.kind) ? raw.kind : _optionalChain([base, 'optionalAccess', _73 => _73.kind]);
|
|
1560
1582
|
if (!kind) throw new Error(`kind ${JSON.stringify(raw.kind)} is not a stencil; use ${STENCIL_KINDS.join(", ")}.`);
|
|
1561
1583
|
const s = {
|
|
1562
1584
|
id,
|
|
1563
1585
|
kind,
|
|
1564
|
-
mode: raw.mode === "guide" || raw.mode === "mask" ? raw.mode : _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
1565
|
-
enabled: typeof raw.enabled === "boolean" ? raw.enabled : _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
1566
|
-
invert: typeof raw.invert === "boolean" ? raw.invert : _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
1567
|
-
snap: finite(raw.snap) ? Math.min(400, Math.max(1, raw.snap)) : _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
1568
|
-
feather: finite(raw.feather) ? Math.min(100, Math.max(0, raw.feather)) : _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
1586
|
+
mode: raw.mode === "guide" || raw.mode === "mask" ? raw.mode : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _74 => _74.mode]), () => ( (kind === "ruler" || kind === "arc" ? "guide" : "mask"))),
|
|
1587
|
+
enabled: typeof raw.enabled === "boolean" ? raw.enabled : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _75 => _75.enabled]), () => ( true)),
|
|
1588
|
+
invert: typeof raw.invert === "boolean" ? raw.invert : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _76 => _76.invert]), () => ( false)),
|
|
1589
|
+
snap: finite(raw.snap) ? Math.min(400, Math.max(1, raw.snap)) : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _77 => _77.snap]), () => ( 40)),
|
|
1590
|
+
feather: finite(raw.feather) ? Math.min(100, Math.max(0, raw.feather)) : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _78 => _78.feather]), () => ( 1))
|
|
1569
1591
|
};
|
|
1570
1592
|
if (kind === "ruler" || kind === "line") {
|
|
1571
|
-
s.from = _nullishCoalesce(pt(raw.from), () => ( _optionalChain([base, 'optionalAccess',
|
|
1572
|
-
s.to = _nullishCoalesce(pt(raw.to), () => ( _optionalChain([base, 'optionalAccess',
|
|
1593
|
+
s.from = _nullishCoalesce(pt(raw.from), () => ( _optionalChain([base, 'optionalAccess', _79 => _79.from])));
|
|
1594
|
+
s.to = _nullishCoalesce(pt(raw.to), () => ( _optionalChain([base, 'optionalAccess', _80 => _80.to])));
|
|
1573
1595
|
if (!s.from || !s.to) throw new Error(`A ${kind} needs from and to points ({x, y} in document pixels).`);
|
|
1574
1596
|
if (Math.hypot(s.to.x - s.from.x, s.to.y - s.from.y) < 1) throw new Error(`A ${kind}'s from and to must be at least 1 px apart.`);
|
|
1575
1597
|
} else if (kind === "arc") {
|
|
1576
|
-
s.center = _nullishCoalesce(pt(raw.center), () => ( _optionalChain([base, 'optionalAccess',
|
|
1577
|
-
s.radius = finite(raw.radius) ? raw.radius : _optionalChain([base, 'optionalAccess',
|
|
1598
|
+
s.center = _nullishCoalesce(pt(raw.center), () => ( _optionalChain([base, 'optionalAccess', _81 => _81.center])));
|
|
1599
|
+
s.radius = finite(raw.radius) ? raw.radius : _optionalChain([base, 'optionalAccess', _82 => _82.radius]);
|
|
1578
1600
|
if (!s.center || !(s.radius > 0)) throw new Error("An arc needs a center ({x, y}) and a radius above 0.");
|
|
1579
|
-
s.startAngle = finite(raw.startAngle) ? raw.startAngle : _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
1580
|
-
s.endAngle = finite(raw.endAngle) ? raw.endAngle : _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
1601
|
+
s.startAngle = finite(raw.startAngle) ? raw.startAngle : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _83 => _83.startAngle]), () => ( 0));
|
|
1602
|
+
s.endAngle = finite(raw.endAngle) ? raw.endAngle : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _84 => _84.endAngle]), () => ( 360));
|
|
1581
1603
|
} else {
|
|
1582
|
-
s.shape = STENCIL_SHAPES.includes(raw.shape) ? raw.shape : _nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
1604
|
+
s.shape = STENCIL_SHAPES.includes(raw.shape) ? raw.shape : _nullishCoalesce(_optionalChain([base, 'optionalAccess', _85 => _85.shape]), () => ( "rect"));
|
|
1583
1605
|
if (s.shape === "polygon") {
|
|
1584
|
-
const pts = Array.isArray(raw.points) ? raw.points.map(pt).filter((p) => Boolean(p)) : _optionalChain([base, 'optionalAccess',
|
|
1606
|
+
const pts = Array.isArray(raw.points) ? raw.points.map(pt).filter((p) => Boolean(p)) : _optionalChain([base, 'optionalAccess', _86 => _86.points]);
|
|
1585
1607
|
if (!pts || pts.length < 3) throw new Error("A polygon stencil needs at least 3 points.");
|
|
1586
1608
|
s.points = pts;
|
|
1587
1609
|
} else {
|
|
1588
|
-
const r = _nullishCoalesce(raw.rect, () => ( _optionalChain([base, 'optionalAccess',
|
|
1610
|
+
const r = _nullishCoalesce(raw.rect, () => ( _optionalChain([base, 'optionalAccess', _87 => _87.rect])));
|
|
1589
1611
|
if (!r || !finite(r.x) || !finite(r.y) || !(r.width > 0) || !(r.height > 0)) throw new Error(`A ${s.shape} stencil needs rect {x, y, width, height} with a width and height above 0.`);
|
|
1590
1612
|
s.rect = { x: r.x, y: r.y, width: r.width, height: r.height };
|
|
1591
1613
|
}
|
|
@@ -1667,7 +1689,7 @@ var StencilSnapper = class {
|
|
|
1667
1689
|
const { distance } = nearestOnStencil(s, p);
|
|
1668
1690
|
if (distance <= s.snap && (!best || distance < best.d)) best = { s, d: distance };
|
|
1669
1691
|
}
|
|
1670
|
-
this.guide = _nullishCoalesce(_optionalChain([best, 'optionalAccess',
|
|
1692
|
+
this.guide = _nullishCoalesce(_optionalChain([best, 'optionalAccess', _88 => _88.s]), () => ( null));
|
|
1671
1693
|
}
|
|
1672
1694
|
if (!this.guide) return p;
|
|
1673
1695
|
const q = nearestOnStencil(this.guide, p).point;
|
|
@@ -1814,7 +1836,7 @@ function normalizeBrushStroke(raw) {
|
|
|
1814
1836
|
const out = {
|
|
1815
1837
|
id: r.id,
|
|
1816
1838
|
layerId: r.layerId,
|
|
1817
|
-
brush:
|
|
1839
|
+
brush: _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, _nullishCoalesce(r.brush, () => ( {}))),
|
|
1818
1840
|
color: typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : "#000000",
|
|
1819
1841
|
points,
|
|
1820
1842
|
seed: finite2(r.seed) ? r.seed | 0 : 0
|
|
@@ -1827,14 +1849,14 @@ function normalizeBrushStroke(raw) {
|
|
|
1827
1849
|
const st = [];
|
|
1828
1850
|
for (const raw2 of r.stencils) {
|
|
1829
1851
|
try {
|
|
1830
|
-
st.push(normalizeStencil(raw2, typeof _optionalChain([raw2, 'optionalAccess',
|
|
1852
|
+
st.push(normalizeStencil(raw2, typeof _optionalChain([raw2, 'optionalAccess', _89 => _89.id]) === "string" ? raw2.id : "stencil"));
|
|
1831
1853
|
} catch (e2) {
|
|
1832
1854
|
}
|
|
1833
1855
|
}
|
|
1834
1856
|
if (st.length) out.stencils = st;
|
|
1835
1857
|
}
|
|
1836
|
-
const effect =
|
|
1837
|
-
const paint = effect ? null :
|
|
1858
|
+
const effect = _chunkGT77U7QGcjs.readPaintEffectPaint.call(void 0, r.paint);
|
|
1859
|
+
const paint = effect ? null : _chunkI7NJPHWVcjs.readPaintSource.call(void 0, r.paint);
|
|
1838
1860
|
if (effect) out.paint = effect;
|
|
1839
1861
|
else if (paint && paint.type === "gradient") out.paint = paint;
|
|
1840
1862
|
if (Array.isArray(r.steps) && r.steps.length === points.length && r.steps.every((v) => Number.isInteger(v) && v >= 0)) out.steps = [...r.steps];
|
|
@@ -1873,11 +1895,11 @@ function varyStroke(stroke, m, v) {
|
|
|
1873
1895
|
if (ps !== 1) q.pressure = Math.min(1, Math.max(0, (_nullishCoalesce(p.pressure, () => ( 1))) * ps));
|
|
1874
1896
|
return q;
|
|
1875
1897
|
});
|
|
1876
|
-
const brush = s !== 1 ?
|
|
1898
|
+
const brush = s !== 1 ? _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { ...stroke.brush, tip: { ...stroke.brush.tip, size: stroke.brush.tip.size * s } }) : stroke.brush;
|
|
1877
1899
|
const out = { ...stroke, brush, points };
|
|
1878
|
-
if (_optionalChain([stroke, 'access',
|
|
1879
|
-
if (_optionalChain([stroke, 'access',
|
|
1880
|
-
if (_optionalChain([stroke, 'access',
|
|
1900
|
+
if (_optionalChain([stroke, 'access', _90 => _90.paint, 'optionalAccess', _91 => _91.type]) === "gradient" && s !== 1) out.paint = _chunkI7NJPHWVcjs.scalePaintGradient.call(void 0, stroke.paint, s);
|
|
1901
|
+
if (_optionalChain([stroke, 'access', _92 => _92.paint, 'optionalAccess', _93 => _93.type]) === "effect" && stroke.paint.map && s !== 1) out.paint = { ...stroke.paint, map: { ...stroke.paint.map, length: Math.min(4096, Math.max(16, Math.round(stroke.paint.map.length * s))) } };
|
|
1902
|
+
if (_optionalChain([stroke, 'access', _94 => _94.copies, 'optionalAccess', _95 => _95.length])) {
|
|
1881
1903
|
const inv = invertAffine(m);
|
|
1882
1904
|
out.copies = stroke.copies.map((c) => composeAffine(m, composeAffine(c, inv)));
|
|
1883
1905
|
}
|
|
@@ -1896,7 +1918,7 @@ var paperNodes = /* @__PURE__ */ new WeakMap();
|
|
|
1896
1918
|
function paperNode(paper, light) {
|
|
1897
1919
|
let n = paperNodes.get(paper);
|
|
1898
1920
|
const metal = (_nullishCoalesce(paper.metallic, () => ( 0))) > 0;
|
|
1899
|
-
if (!n || metal && (_optionalChain([n, 'access',
|
|
1921
|
+
if (!n || metal && (_optionalChain([n, 'access', _96 => _96.light, 'optionalAccess', _97 => _97.azimuth]) !== _optionalChain([light, 'optionalAccess', _98 => _98.azimuth]) || _optionalChain([n, 'access', _99 => _99.light, 'optionalAccess', _100 => _100.elevation]) !== _optionalChain([light, 'optionalAccess', _101 => _101.elevation]))) {
|
|
1900
1922
|
n = { type: "paper", id: PAPER_NODE_ID, name: "Paper", visible: true, opacity: 1, blend: "normal", paper, ...metal && light ? { light: { azimuth: light.azimuth, elevation: light.elevation } } : {} };
|
|
1901
1923
|
paperNodes.set(paper, n);
|
|
1902
1924
|
}
|
|
@@ -1908,7 +1930,7 @@ function paperGrain(paper) {
|
|
|
1908
1930
|
const key = JSON.stringify([paper.pattern, paper.seed, paper.scale, paper.tiling, paper.dry, _nullishCoalesce(paper.offset, () => ( null))]);
|
|
1909
1931
|
let g = grainCache.get(key);
|
|
1910
1932
|
if (!g) {
|
|
1911
|
-
g = new (0,
|
|
1933
|
+
g = new (0, _chunkI7NJPHWVcjs.PaperGrain)(paper, "dry");
|
|
1912
1934
|
if (grainCache.size > 16) grainCache.delete(grainCache.keys().next().value);
|
|
1913
1935
|
grainCache.set(key, g);
|
|
1914
1936
|
}
|
|
@@ -1918,7 +1940,7 @@ function paperTile(paper, r, light) {
|
|
|
1918
1940
|
const key = `${paperKey(paper, light)}|${r.x},${r.y},${r.width},${r.height}`;
|
|
1919
1941
|
let t = tileCache.get(key);
|
|
1920
1942
|
if (!t) {
|
|
1921
|
-
t =
|
|
1943
|
+
t = _chunkGT77U7QGcjs.renderPaper.call(void 0, paper, r, paperGrain(paper), light);
|
|
1922
1944
|
if (tileCache.size > 512) tileCache.delete(tileCache.keys().next().value);
|
|
1923
1945
|
tileCache.set(key, t);
|
|
1924
1946
|
}
|
|
@@ -1947,7 +1969,7 @@ var PROFILE = {
|
|
|
1947
1969
|
}
|
|
1948
1970
|
};
|
|
1949
1971
|
function createPaintCompositor() {
|
|
1950
|
-
return new (0,
|
|
1972
|
+
return new (0, _chunkDPYAO5U6cjs.RasterCompositor)(PROFILE);
|
|
1951
1973
|
}
|
|
1952
1974
|
function downsampleRgba(data, width, height, tw, th) {
|
|
1953
1975
|
tw = Math.max(1, Math.round(tw));
|
|
@@ -2017,17 +2039,17 @@ function header(state, options) {
|
|
|
2017
2039
|
if (options.swatches !== void 0) out.swatches = JSON.parse(JSON.stringify(options.swatches));
|
|
2018
2040
|
if (options.mixingPad !== void 0) out.mixingPad = JSON.parse(JSON.stringify(options.mixingPad));
|
|
2019
2041
|
if (options.wet !== void 0) out.wet = JSON.parse(JSON.stringify(options.wet));
|
|
2020
|
-
if (_optionalChain([state, 'access',
|
|
2021
|
-
if (_optionalChain([state, 'access',
|
|
2042
|
+
if (_optionalChain([state, 'access', _102 => _102.wetEvents, 'optionalAccess', _103 => _103.length])) out.wetEvents = JSON.parse(JSON.stringify(state.wetEvents));
|
|
2043
|
+
if (_optionalChain([state, 'access', _104 => _104.paintEvents, 'optionalAccess', _105 => _105.length])) out.paintEvents = JSON.parse(JSON.stringify(state.paintEvents));
|
|
2022
2044
|
if (state.origin && (state.origin.x || state.origin.y)) out.origin = { ...state.origin };
|
|
2023
2045
|
return out;
|
|
2024
2046
|
}
|
|
2025
2047
|
function serializePaintDocument(state, options = {}) {
|
|
2026
|
-
const { layers, assets } =
|
|
2048
|
+
const { layers, assets } = _chunkM2VKFE5Lcjs.serializeLayers.call(void 0, state.layers);
|
|
2027
2049
|
return { ...header(state, options), layers, assets };
|
|
2028
2050
|
}
|
|
2029
2051
|
async function serializePaintDocumentExternal(state, store, options = {}) {
|
|
2030
|
-
const { layers, assets } = await
|
|
2052
|
+
const { layers, assets } = await _chunkM2VKFE5Lcjs.serializeLayersExternal.call(void 0, state.layers, store);
|
|
2031
2053
|
return { ...header(state, options), layers, assets };
|
|
2032
2054
|
}
|
|
2033
2055
|
function paintLayersOnly(layers, problems) {
|
|
@@ -2035,7 +2057,7 @@ function paintLayersOnly(layers, problems) {
|
|
|
2035
2057
|
for (const l of layers) {
|
|
2036
2058
|
if (l.type === "pixel") {
|
|
2037
2059
|
const { filters, source, ...rest } = l;
|
|
2038
|
-
if (_optionalChain([filters, 'optionalAccess',
|
|
2060
|
+
if (_optionalChain([filters, 'optionalAccess', _106 => _106.length])) problems.push(`Layer "${l.name}": its filters are an image editor feature and were dropped.`);
|
|
2039
2061
|
if (source) problems.push(`Layer "${l.name}" refers to an image editor source image; it loads empty.`);
|
|
2040
2062
|
out.push(rest);
|
|
2041
2063
|
} else if (l.type === "group") out.push({ ...l, children: paintLayersOnly(l.children, problems) });
|
|
@@ -2062,11 +2084,11 @@ function deserializePaintDocument(raw) {
|
|
|
2062
2084
|
}
|
|
2063
2085
|
const problems = [];
|
|
2064
2086
|
const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
|
|
2065
|
-
const paper =
|
|
2087
|
+
const paper = _chunkGT77U7QGcjs.normalizePaper.call(void 0, _nullishCoalesce(r.paper, () => ( {})));
|
|
2066
2088
|
const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
|
|
2067
|
-
const layers = paintLayersOnly(
|
|
2089
|
+
const layers = paintLayersOnly(_chunkM2VKFE5Lcjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
|
|
2068
2090
|
const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
|
|
2069
|
-
const activeLayerId = wanted &&
|
|
2091
|
+
const activeLayerId = wanted && _chunkDPYAO5U6cjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers), 'access', _107 => _107.filter, 'call', _108 => _108((l) => l.type === "pixel"), 'access', _109 => _109.pop, 'call', _110 => _110(), 'optionalAccess', _111 => _111.id]), () => ( null));
|
|
2070
2092
|
const wetEvents = Array.isArray(r.wetEvents) ? r.wetEvents.filter((e) => e && typeof e === "object" && Number.isInteger(e.clock) && typeof e.kind === "string") : [];
|
|
2071
2093
|
const state = { canvas, paper, layers, activeLayerId, strokes: readStrokes(r.strokes, problems) };
|
|
2072
2094
|
if (wetEvents.length) state.wetEvents = wetEvents;
|
|
@@ -2080,7 +2102,7 @@ async function deserializePaintDocumentAsync(raw, store) {
|
|
|
2080
2102
|
if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
|
|
2081
2103
|
const r = raw;
|
|
2082
2104
|
const problems = [];
|
|
2083
|
-
const assets = await
|
|
2105
|
+
const assets = await _chunkM2VKFE5Lcjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
|
|
2084
2106
|
const loaded = deserializePaintDocument({ ...r, assets });
|
|
2085
2107
|
return { ...loaded, problems: [...problems, ...loaded.problems] };
|
|
2086
2108
|
}
|
|
@@ -2157,13 +2179,13 @@ function viewPenToDocument(view, p) {
|
|
|
2157
2179
|
|
|
2158
2180
|
// src/paint-editor/input.ts
|
|
2159
2181
|
function samplePressure(e) {
|
|
2160
|
-
return
|
|
2182
|
+
return _chunkKBYB7OWBcjs.pointerPressure.call(void 0, e);
|
|
2161
2183
|
}
|
|
2162
2184
|
function pointerToPenPoint(e, x, y, view) {
|
|
2163
2185
|
const p = { x, y, pressure: samplePressure(e) };
|
|
2164
2186
|
if (typeof e.timeStamp === "number" && Number.isFinite(e.timeStamp)) p.t = e.timeStamp;
|
|
2165
2187
|
if (e.pointerType !== "pen") return p;
|
|
2166
|
-
const o =
|
|
2188
|
+
const o = _chunkGT77U7QGcjs.penOrientation.call(void 0, {
|
|
2167
2189
|
x,
|
|
2168
2190
|
y,
|
|
2169
2191
|
altitude: typeof e.altitudeAngle === "number" ? e.altitudeAngle : void 0,
|
|
@@ -2211,7 +2233,7 @@ async function decodeImageBlob(blob) {
|
|
|
2211
2233
|
if (!ctx) throw new Error("No 2D context to decode with.");
|
|
2212
2234
|
ctx.drawImage(bitmap, 0, 0);
|
|
2213
2235
|
const data = new Uint8ClampedArray(ctx.getImageData(0, 0, bitmap.width, bitmap.height).data);
|
|
2214
|
-
_optionalChain([bitmap, 'access',
|
|
2236
|
+
_optionalChain([bitmap, 'access', _112 => _112.close, 'optionalCall', _113 => _113()]);
|
|
2215
2237
|
return { width: bitmap.width, height: bitmap.height, data };
|
|
2216
2238
|
}
|
|
2217
2239
|
function downloadBytes(bytes, fileName, mimeType) {
|
|
@@ -2227,7 +2249,7 @@ function downloadBytes(bytes, fileName, mimeType) {
|
|
|
2227
2249
|
|
|
2228
2250
|
// src/paint-editor/wet.ts
|
|
2229
2251
|
var STROKE_WATER = 0.9;
|
|
2230
|
-
var STROKE_MASS =
|
|
2252
|
+
var STROKE_MASS = _chunkKBYB7OWBcjs.PIGMENT_UNIT * 2.5;
|
|
2231
2253
|
var STROKE_LIGHT = 1.5;
|
|
2232
2254
|
var COVERAGE_STEPS = 4096;
|
|
2233
2255
|
function union2(a, b) {
|
|
@@ -2237,13 +2259,13 @@ function union2(a, b) {
|
|
|
2237
2259
|
return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
|
|
2238
2260
|
}
|
|
2239
2261
|
function wetPaperInput(paper) {
|
|
2240
|
-
const grain = new (0,
|
|
2262
|
+
const grain = new (0, _chunkI7NJPHWVcjs.PaperGrain)(paper, "wet");
|
|
2241
2263
|
const flat = grain.flat;
|
|
2242
2264
|
return {
|
|
2243
2265
|
absorption: paper.absorption,
|
|
2244
2266
|
permeability: paper.permeability,
|
|
2245
2267
|
roughness: flat ? 0 : paper.roughness,
|
|
2246
|
-
color:
|
|
2268
|
+
color: _chunkGT77U7QGcjs.hexToRgb8.call(void 0, paper.color),
|
|
2247
2269
|
heightAt: flat ? () => 0.5 : (x, y) => grain.at(x, y)
|
|
2248
2270
|
};
|
|
2249
2271
|
}
|
|
@@ -2251,29 +2273,29 @@ var WetStrokeDriver = (_class6 = class {
|
|
|
2251
2273
|
constructor(init) {;_class6.prototype.__init40.call(this);_class6.prototype.__init41.call(this);_class6.prototype.__init42.call(this);_class6.prototype.__init43.call(this);_class6.prototype.__init44.call(this);_class6.prototype.__init45.call(this);_class6.prototype.__init46.call(this);_class6.prototype.__init47.call(this);_class6.prototype.__init48.call(this);_class6.prototype.__init49.call(this);_class6.prototype.__init50.call(this);_class6.prototype.__init51.call(this);_class6.prototype.__init52.call(this);
|
|
2252
2274
|
this.init = init;
|
|
2253
2275
|
const brush = init.brush;
|
|
2254
|
-
this.smoother = new (0,
|
|
2255
|
-
const copies = init.copies.length ? init.copies : [
|
|
2276
|
+
this.smoother = new (0, _chunkGT77U7QGcjs.PenSmoother)(brush.tip.smoothing, brush.pressureSmoothing);
|
|
2277
|
+
const copies = init.copies.length ? init.copies : [_chunkGT77U7QGcjs.IDENTITY_COPY];
|
|
2256
2278
|
const wet = brush.wet;
|
|
2257
2279
|
const spacing = Math.max(0.02, brush.tip.spacing);
|
|
2258
2280
|
const perDab = Math.min(1, spacing * 1.2);
|
|
2259
2281
|
const thin = wet.thinner;
|
|
2260
|
-
this.medium = new (0,
|
|
2282
|
+
this.medium = new (0, _chunkKBYB7OWBcjs.WetMedium)(init.world, init.laneId, {
|
|
2261
2283
|
water: STROKE_WATER * Math.min(1, wet.water * (1 + thin)) * perDab,
|
|
2262
2284
|
mass: STROKE_MASS * wet.pigment * (1 - 0.6 * thin) * perDab,
|
|
2263
2285
|
body: wet.body * (1 - thin),
|
|
2264
2286
|
light: 0
|
|
2265
2287
|
});
|
|
2266
2288
|
this.lightBase = wet.tool === "paint" ? STROKE_LIGHT * brush.light.amount * (1 - 0.6 * thin) * perDab : 0;
|
|
2267
|
-
const rates =
|
|
2289
|
+
const rates = _chunkI7NJPHWVcjs.exchangeRates.call(void 0, brush.behavior.pickup, brush.behavior.mix, wet.load, brush.behavior.mixing);
|
|
2268
2290
|
this.states = copies.map((c, i) => ({
|
|
2269
|
-
walker: new (0,
|
|
2270
|
-
exchange: wet.tool === "paint" ? new (0,
|
|
2291
|
+
walker: new (0, _chunkGT77U7QGcjs.PenDabWalker)(brush, init.seed + i * 7919 | 0, c.linear),
|
|
2292
|
+
exchange: wet.tool === "paint" ? new (0, _chunkI7NJPHWVcjs.PaintExchange)(rates, init.load) : null,
|
|
2271
2293
|
last: null
|
|
2272
2294
|
}));
|
|
2273
2295
|
this.copies = copies;
|
|
2274
2296
|
this.depth = init.grain && !init.grain.flat ? Math.min(1, Math.max(0, init.paperDepth * brush.grain)) : 0;
|
|
2275
2297
|
const g = _nullishCoalesce(init.paint, () => ( null));
|
|
2276
|
-
this.sampler = g ? new (0,
|
|
2298
|
+
this.sampler = g ? new (0, _chunkI7NJPHWVcjs.PaintGradientSampler)(g.map.by === "across-tip" ? { ...g, map: { by: "distance", length: 300, repeat: "mirror" } } : g, init.seed) : null;
|
|
2277
2299
|
}
|
|
2278
2300
|
|
|
2279
2301
|
__init40() {this.dabCount = 0}
|
|
@@ -2299,7 +2321,7 @@ var WetStrokeDriver = (_class6 = class {
|
|
|
2299
2321
|
|
|
2300
2322
|
/** What copy 0's brush carries after the dabs so far. */
|
|
2301
2323
|
get load() {
|
|
2302
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2324
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _114 => _114.states, 'access', _115 => _115[0], 'access', _116 => _116.exchange, 'optionalAccess', _117 => _117.load]), () => ( null));
|
|
2303
2325
|
}
|
|
2304
2326
|
/** Whether every point (and the end) has been applied. */
|
|
2305
2327
|
get done() {
|
|
@@ -2347,7 +2369,7 @@ var WetStrokeDriver = (_class6 = class {
|
|
|
2347
2369
|
}
|
|
2348
2370
|
applyDabs(copy, dabs, rects) {
|
|
2349
2371
|
for (const d of dabs) {
|
|
2350
|
-
const rect =
|
|
2372
|
+
const rect = _chunkI7NJPHWVcjs.dabRect.call(void 0, d, this.init.brush.tip.hardness);
|
|
2351
2373
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
2352
2374
|
this.dab(copy, d, rect);
|
|
2353
2375
|
rects.push(rect);
|
|
@@ -2364,7 +2386,7 @@ var WetStrokeDriver = (_class6 = class {
|
|
|
2364
2386
|
const tip = this.tip.subarray(0, n);
|
|
2365
2387
|
const cov = this.cov.subarray(0, n);
|
|
2366
2388
|
tip.fill(0);
|
|
2367
|
-
|
|
2389
|
+
_chunkI7NJPHWVcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.init.brush.tip.hardness, rect, tip);
|
|
2368
2390
|
const grain = this.depth > 0 ? this.init.grain : null;
|
|
2369
2391
|
const mask = this.init.mask;
|
|
2370
2392
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
@@ -2375,7 +2397,7 @@ var WetStrokeDriver = (_class6 = class {
|
|
|
2375
2397
|
tip[k] *= mx >= 0 && my >= 0 && mx < mask.width && my < mask.height ? mask.data[my * mask.width + mx] / 255 : 0;
|
|
2376
2398
|
}
|
|
2377
2399
|
let v = tip[k];
|
|
2378
|
-
if (v > 0 && grain) v *=
|
|
2400
|
+
if (v > 0 && grain) v *= _chunkI7NJPHWVcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, rect.y + yy + 0.5), this.depth, d.pressure);
|
|
2379
2401
|
tip[k] = Math.round(tip[k] * COVERAGE_STEPS) / COVERAGE_STEPS;
|
|
2380
2402
|
cov[k] = Math.round(v * COVERAGE_STEPS) / COVERAGE_STEPS;
|
|
2381
2403
|
}
|
|
@@ -2396,7 +2418,7 @@ var WetStrokeDriver = (_class6 = class {
|
|
|
2396
2418
|
let flow = 1;
|
|
2397
2419
|
const effect = this.init.effect;
|
|
2398
2420
|
if (effect) {
|
|
2399
|
-
|
|
2421
|
+
_chunkGT77U7QGcjs.sampleEffectAt.call(void 0, effect, d.x, d.y, this.centre, d);
|
|
2400
2422
|
ex.setReservoirColor(this.centre[0], this.centre[1], this.centre[2]);
|
|
2401
2423
|
} else if (this.sampler) {
|
|
2402
2424
|
const g = this.sampler.dab(d, this.sample);
|
|
@@ -2408,7 +2430,7 @@ var WetStrokeDriver = (_class6 = class {
|
|
|
2408
2430
|
if (total > 0 && flow > 0 && effect) {
|
|
2409
2431
|
const ec = cov.slice();
|
|
2410
2432
|
const field = new Float32Array(ec.length * 3);
|
|
2411
|
-
|
|
2433
|
+
_chunkGT77U7QGcjs.effectDabField.call(void 0, effect, rect, ec, this.centre, this.paint, field, COVERAGE_STEPS, d);
|
|
2412
2434
|
this.medium.deposit(rect, ec, Math.min(1, total) * k, this.paint, null, field);
|
|
2413
2435
|
} else if (total > 0 && flow > 0) this.medium.deposit(rect, cov, Math.min(1, total) * k * flow, this.paint, null);
|
|
2414
2436
|
else world.paint(laneId, rect, cov, this.medium.options.water * k, null);
|
|
@@ -2463,7 +2485,7 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2463
2485
|
|
|
2464
2486
|
|
|
2465
2487
|
__init53() {this.world = null}
|
|
2466
|
-
__init54() {this.tilt = { ...
|
|
2488
|
+
__init54() {this.tilt = { ..._chunkKBYB7OWBcjs.FLAT }}
|
|
2467
2489
|
__init55() {this.settings = /* @__PURE__ */ new Map()}
|
|
2468
2490
|
__init56() {this.paused = false}
|
|
2469
2491
|
/** Wet strokes dry as soon as they end (one undo step with the stroke). */
|
|
@@ -2487,8 +2509,8 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2487
2509
|
/** Starts the GPU engine for the world (once; it may turn out unavailable). */
|
|
2488
2510
|
startGpu() {
|
|
2489
2511
|
if (this.gpuMode === "off" || this.gpu || this.gpuStarting || this.gpuSupport) return;
|
|
2490
|
-
const provider = this.options.gpuProvider === void 0 ?
|
|
2491
|
-
this.gpuStarting =
|
|
2512
|
+
const provider = this.options.gpuProvider === void 0 ? _chunkKBYB7OWBcjs.findWebGpu.call(void 0, ) : this.options.gpuProvider;
|
|
2513
|
+
this.gpuStarting = _chunkKBYB7OWBcjs.createWetGpuEngine.call(void 0, provider).then(({ engine, support }) => {
|
|
2492
2514
|
this.gpuSupport = support;
|
|
2493
2515
|
if (!engine) return;
|
|
2494
2516
|
if (this.gpuMode === "off" || !this.world) {
|
|
@@ -2518,8 +2540,8 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2518
2540
|
if (mode === this.gpuMode) return this.engineInfo();
|
|
2519
2541
|
this.gpuMode = mode;
|
|
2520
2542
|
if (mode === "off") {
|
|
2521
|
-
_optionalChain([this, 'access',
|
|
2522
|
-
_optionalChain([this, 'access',
|
|
2543
|
+
_optionalChain([this, 'access', _118 => _118.world, 'optionalAccess', _119 => _119.attachGpu, 'call', _120 => _120(null)]);
|
|
2544
|
+
_optionalChain([this, 'access', _121 => _121.gpu, 'optionalAccess', _122 => _122.destroy, 'call', _123 => _123()]);
|
|
2523
2545
|
this.gpu = null;
|
|
2524
2546
|
this.gpuSupport = null;
|
|
2525
2547
|
} else if (this.world) this.startGpu();
|
|
@@ -2527,13 +2549,13 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2527
2549
|
}
|
|
2528
2550
|
engineInfo() {
|
|
2529
2551
|
const w = this.world;
|
|
2530
|
-
const base = { mode: this.gpuMode, adapter: _nullishCoalesce(_optionalChain([this, 'access',
|
|
2552
|
+
const base = { mode: this.gpuMode, adapter: _nullishCoalesce(_optionalChain([this, 'access', _124 => _124.gpuSupport, 'optionalAccess', _125 => _125.adapter]), () => ( null)), maxTiles: _nullishCoalesce(_optionalChain([this, 'access', _126 => _126.gpuSupport, 'optionalAccess', _127 => _127.maxSlots]), () => ( 0)), minTiles: this.gpuMinTiles, activeTiles: _nullishCoalesce(_optionalChain([w, 'optionalAccess', _128 => _128.activeTiles, 'call', _129 => _129()]), () => ( 0)), cpu: this.backend() };
|
|
2531
2553
|
if (this.gpuMode === "off") return { ...base, state: "off", reason: "Forced to the CPU." };
|
|
2532
2554
|
if (this.gpuStarting) return { ...base, state: "starting", reason: null };
|
|
2533
|
-
if (_optionalChain([w, 'optionalAccess',
|
|
2555
|
+
if (_optionalChain([w, 'optionalAccess', _130 => _130.gpuError])) return { ...base, state: "failed", reason: w.gpuError };
|
|
2534
2556
|
if (this.gpuSupport && !this.gpuSupport.supported) return { ...base, state: "unavailable", reason: this.gpuSupport.reason };
|
|
2535
2557
|
if (!this.gpu) return { ...base, state: "not-started", reason: "Starts with the first wet stroke." };
|
|
2536
|
-
if (_optionalChain([w, 'optionalAccess',
|
|
2558
|
+
if (_optionalChain([w, 'optionalAccess', _131 => _131.gpuActive])) return { ...base, state: "active", reason: null };
|
|
2537
2559
|
return { ...base, state: "standby", reason: `The GPU takes over at ${this.gpuMinTiles} wet tiles (256 px).` };
|
|
2538
2560
|
}
|
|
2539
2561
|
/** The world (made on first use, at the canvas size). */
|
|
@@ -2547,7 +2569,7 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2547
2569
|
return this.world;
|
|
2548
2570
|
}
|
|
2549
2571
|
makeWorld(width, height, paper) {
|
|
2550
|
-
const world = new (0,
|
|
2572
|
+
const world = new (0, _chunkKBYB7OWBcjs.WetWorld)(width, height, wetPaperInput(paper), { kernel: this.options.kernel, threads: this.options.threads });
|
|
2551
2573
|
world.setTilt(this.tilt);
|
|
2552
2574
|
world.gpuMinTiles = this.gpuMinTiles;
|
|
2553
2575
|
if (this.gpu) world.attachGpu(this.gpu);
|
|
@@ -2559,7 +2581,7 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2559
2581
|
* sides: the shift has to be whole wet tiles (256 px), and no wet stroke may be live.
|
|
2560
2582
|
*/
|
|
2561
2583
|
canExtend(left, top) {
|
|
2562
|
-
return left %
|
|
2584
|
+
return left % _chunkKBYB7OWBcjs.WET_TILE === 0 && top % _chunkKBYB7OWBcjs.WET_TILE === 0 && !this.driver;
|
|
2563
2585
|
}
|
|
2564
2586
|
/**
|
|
2565
2587
|
* Keeps the wet paint while the canvas grows to `width`×`height` by `left` / `top` on those
|
|
@@ -2572,17 +2594,17 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2572
2594
|
if (!this.canExtend(left, top)) throw new Error("Wet paint only moves by whole 256 px tiles, between strokes.");
|
|
2573
2595
|
for (const [id, s] of this.settings) if (s.flow.center) this.settings.set(id, { ...s, flow: { ...s.flow, center: { x: s.flow.center.x + left, y: s.flow.center.y + top } } });
|
|
2574
2596
|
const old = this.world;
|
|
2575
|
-
const snap = _optionalChain([old, 'optionalAccess',
|
|
2597
|
+
const snap = _optionalChain([old, 'optionalAccess', _132 => _132.laneIds, 'call', _133 => _133(), 'access', _134 => _134.length]) ? old.snapshot() : null;
|
|
2576
2598
|
this.dropWorld();
|
|
2577
2599
|
this.lastTick = null;
|
|
2578
2600
|
this.stepsOwed = 0;
|
|
2579
2601
|
if (!old || !snap) return;
|
|
2580
|
-
const moved =
|
|
2581
|
-
const flow = _optionalChain([this, 'access',
|
|
2602
|
+
const moved = _chunkKBYB7OWBcjs.moveWetSnapshot.call(void 0, snap, old, { width, height }, left, top, (l) => {
|
|
2603
|
+
const flow = _optionalChain([this, 'access', _135 => _135.settings, 'access', _136 => _136.get, 'call', _137 => _137(l.id), 'optionalAccess', _138 => _138.flow]);
|
|
2582
2604
|
return {
|
|
2583
2605
|
base: _chunk474IQG74cjs.translateSurface.call(void 0, l.base, left, top),
|
|
2584
2606
|
...l.light ? { light: _chunk474IQG74cjs.translateSurface.call(void 0, l.light, left, top) } : {},
|
|
2585
|
-
flow: l.flow && flow && flow.kind !== "none" ?
|
|
2607
|
+
flow: l.flow && flow && flow.kind !== "none" ? _chunkKBYB7OWBcjs.flowField.call(void 0, flow, width, height) : l.flow
|
|
2586
2608
|
};
|
|
2587
2609
|
});
|
|
2588
2610
|
this.world = this.makeWorld(width, height, paper);
|
|
@@ -2597,11 +2619,11 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2597
2619
|
}
|
|
2598
2620
|
/** Layers holding a wet layer (wet or drying). */
|
|
2599
2621
|
wetLayerIds() {
|
|
2600
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2622
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _139 => _139.world, 'optionalAccess', _140 => _140.laneIds, 'call', _141 => _141()]), () => ( []));
|
|
2601
2623
|
}
|
|
2602
2624
|
/** Whether a batch is running (edits wait). */
|
|
2603
2625
|
get busy() {
|
|
2604
|
-
return Boolean(_optionalChain([this, 'access',
|
|
2626
|
+
return Boolean(_optionalChain([this, 'access', _142 => _142.world, 'optionalAccess', _143 => _143.busy]));
|
|
2605
2627
|
}
|
|
2606
2628
|
/** Resolves when no batch is running. */
|
|
2607
2629
|
async idle() {
|
|
@@ -2610,7 +2632,7 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2610
2632
|
settingsOf(layerId, medium = "watercolor") {
|
|
2611
2633
|
let s = this.settings.get(layerId);
|
|
2612
2634
|
if (!s) {
|
|
2613
|
-
s = { params:
|
|
2635
|
+
s = { params: _chunkKBYB7OWBcjs.normalizeWetParams.call(void 0, WET_MEDIUM_PARAMS[medium], _chunkKBYB7OWBcjs.DEFAULT_WET_PARAMS), flow: { ..._chunkKBYB7OWBcjs.DEFAULT_FLOW } };
|
|
2614
2636
|
this.settings.set(layerId, s);
|
|
2615
2637
|
}
|
|
2616
2638
|
return s;
|
|
@@ -2623,50 +2645,50 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2623
2645
|
const s = this.settingsOf(layerId, medium);
|
|
2624
2646
|
w.ensureLane(layerId, { params: s.params, base, light: this.host.layerLight(layerId) });
|
|
2625
2647
|
const { width, height } = this.host.canvas();
|
|
2626
|
-
if (s.flow.kind !== "none") w.setFlow(layerId,
|
|
2648
|
+
if (s.flow.kind !== "none") w.setFlow(layerId, _chunkKBYB7OWBcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
|
|
2627
2649
|
}
|
|
2628
2650
|
return w;
|
|
2629
2651
|
}
|
|
2630
2652
|
setParams(layerId, update) {
|
|
2631
2653
|
const s = this.settingsOf(layerId);
|
|
2632
|
-
s.params =
|
|
2633
|
-
if (_optionalChain([this, 'access',
|
|
2654
|
+
s.params = _chunkKBYB7OWBcjs.normalizeWetParams.call(void 0, update, s.params);
|
|
2655
|
+
if (_optionalChain([this, 'access', _144 => _144.world, 'optionalAccess', _145 => _145.hasLane, 'call', _146 => _146(layerId)])) this.world.setParams(layerId, s.params);
|
|
2634
2656
|
return { ...s.params };
|
|
2635
2657
|
}
|
|
2636
2658
|
setFlow(layerId, update) {
|
|
2637
2659
|
const s = this.settingsOf(layerId);
|
|
2638
|
-
s.flow =
|
|
2639
|
-
if (_optionalChain([this, 'access',
|
|
2660
|
+
s.flow = _chunkKBYB7OWBcjs.normalizeFlow.call(void 0, update, s.flow);
|
|
2661
|
+
if (_optionalChain([this, 'access', _147 => _147.world, 'optionalAccess', _148 => _148.hasLane, 'call', _149 => _149(layerId)])) {
|
|
2640
2662
|
const { width, height } = this.host.canvas();
|
|
2641
|
-
this.world.setFlow(layerId,
|
|
2663
|
+
this.world.setFlow(layerId, _chunkKBYB7OWBcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
|
|
2642
2664
|
}
|
|
2643
2665
|
return { ...s.flow };
|
|
2644
2666
|
}
|
|
2645
2667
|
setTilt(update) {
|
|
2646
|
-
this.tilt =
|
|
2647
|
-
_optionalChain([this, 'access',
|
|
2668
|
+
this.tilt = _chunkKBYB7OWBcjs.normalizeTilt.call(void 0, update, this.tilt);
|
|
2669
|
+
_optionalChain([this, 'access', _150 => _150.world, 'optionalAccess', _151 => _151.setTilt, 'call', _152 => _152(this.tilt)]);
|
|
2648
2670
|
return { ...this.tilt };
|
|
2649
2671
|
}
|
|
2650
2672
|
/** The paper changed. */
|
|
2651
2673
|
paperChanged() {
|
|
2652
|
-
_optionalChain([this, 'access',
|
|
2674
|
+
_optionalChain([this, 'access', _153 => _153.world, 'optionalAccess', _154 => _154.setPaper, 'call', _155 => _155(wetPaperInput(this.host.paper()))]);
|
|
2653
2675
|
}
|
|
2654
2676
|
/** A layer as tools describe it. */
|
|
2655
2677
|
info(layerId) {
|
|
2656
2678
|
const s = this.settingsOf(layerId);
|
|
2657
|
-
const st = _optionalChain([this, 'access',
|
|
2679
|
+
const st = _optionalChain([this, 'access', _156 => _156.world, 'optionalAccess', _157 => _157.hasLane, 'call', _158 => _158(layerId)]) ? this.world.stats(layerId) : null;
|
|
2658
2680
|
return {
|
|
2659
2681
|
layerId,
|
|
2660
2682
|
wet: Boolean(st && st.wetCells > 0),
|
|
2661
|
-
wetCells: _nullishCoalesce(_optionalChain([st, 'optionalAccess',
|
|
2662
|
-
wetBounds: _nullishCoalesce(_optionalChain([st, 'optionalAccess',
|
|
2663
|
-
activeTiles: _nullishCoalesce(_optionalChain([st, 'optionalAccess',
|
|
2683
|
+
wetCells: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _159 => _159.wetCells]), () => ( 0)),
|
|
2684
|
+
wetBounds: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _160 => _160.wetBounds]), () => ( null)),
|
|
2685
|
+
activeTiles: _nullishCoalesce(_optionalChain([st, 'optionalAccess', _161 => _161.activeTiles]), () => ( 0)),
|
|
2664
2686
|
params: { ...s.params },
|
|
2665
2687
|
flow: { ...s.flow }
|
|
2666
2688
|
};
|
|
2667
2689
|
}
|
|
2668
2690
|
backend() {
|
|
2669
|
-
return _nullishCoalesce(_optionalChain([this, 'access',
|
|
2691
|
+
return _nullishCoalesce(_optionalChain([this, 'access', _162 => _162.world, 'optionalAccess', _163 => _163.backend, 'call', _164 => _164()]), () => ( null));
|
|
2670
2692
|
}
|
|
2671
2693
|
/** Shows the current wet pixels (at most `maxTiles` reshaded per layer). */
|
|
2672
2694
|
syncDisplays(maxTiles = Infinity) {
|
|
@@ -2715,7 +2737,7 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2715
2737
|
const w = this.world;
|
|
2716
2738
|
if (!w) return;
|
|
2717
2739
|
for (const id of w.laneIds()) {
|
|
2718
|
-
if (w.isActive(id) || _optionalChain([this, 'access',
|
|
2740
|
+
if (w.isActive(id) || _optionalChain([this, 'access', _165 => _165.driver, 'optionalAccess', _166 => _166.init, 'access', _167 => _167.laneId]) === id) continue;
|
|
2719
2741
|
const base = w.getBase(id);
|
|
2720
2742
|
const light = w.isLit(id) ? w.getLight(id) : null;
|
|
2721
2743
|
w.removeLane(id);
|
|
@@ -2797,7 +2819,7 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2797
2819
|
if (!d || !this.world) return;
|
|
2798
2820
|
const rects = d.flush();
|
|
2799
2821
|
if (rects.length) this.syncDisplays(DISPLAY_TILES_PER_TICK);
|
|
2800
|
-
if (d.done) _optionalChain([this, 'access',
|
|
2822
|
+
if (d.done) _optionalChain([this, 'access', _168 => _168.onDriverDone, 'optionalCall', _169 => _169(d)]);
|
|
2801
2823
|
}
|
|
2802
2824
|
/** Called when a live stroke that ended mid-batch has finished applying. */
|
|
2803
2825
|
__init68() {this.onDriverDone = null}
|
|
@@ -2841,13 +2863,13 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2841
2863
|
/** The layer's light paint with all its wet paint dried (`null` without a wet layer or light), without changing anything. */
|
|
2842
2864
|
bakedLight(layerId) {
|
|
2843
2865
|
const w = this.world;
|
|
2844
|
-
if (!_optionalChain([w, 'optionalAccess',
|
|
2866
|
+
if (!_optionalChain([w, 'optionalAccess', _170 => _170.hasLane, 'call', _171 => _171(layerId)]) || !w.isLit(layerId)) return null;
|
|
2845
2867
|
return w.bakedLight(layerId);
|
|
2846
2868
|
}
|
|
2847
2869
|
/** The layer's pixels with all its wet paint dried (deterministic), without changing anything. */
|
|
2848
2870
|
bakedSurface(layerId) {
|
|
2849
2871
|
const w = this.world;
|
|
2850
|
-
if (!_optionalChain([w, 'optionalAccess',
|
|
2872
|
+
if (!_optionalChain([w, 'optionalAccess', _172 => _172.hasLane, 'call', _173 => _173(layerId)])) return null;
|
|
2851
2873
|
return w.bakedSurface(layerId);
|
|
2852
2874
|
}
|
|
2853
2875
|
/** A snapshot of the world for undo (`null` when there is none). */
|
|
@@ -2868,13 +2890,13 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2868
2890
|
this.syncDisplays();
|
|
2869
2891
|
}
|
|
2870
2892
|
dropWorld() {
|
|
2871
|
-
_optionalChain([this, 'access',
|
|
2893
|
+
_optionalChain([this, 'access', _174 => _174.world, 'optionalAccess', _175 => _175.destroy, 'call', _176 => _176()]);
|
|
2872
2894
|
this.world = null;
|
|
2873
2895
|
this.driver = null;
|
|
2874
2896
|
}
|
|
2875
2897
|
/** Forgets everything wet (a new canvas, a resize, opening a document). */
|
|
2876
2898
|
reset() {
|
|
2877
|
-
_optionalChain([this, 'access',
|
|
2899
|
+
_optionalChain([this, 'access', _177 => _177.world, 'optionalAccess', _178 => _178.destroy, 'call', _179 => _179()]);
|
|
2878
2900
|
this.world = null;
|
|
2879
2901
|
this.driver = null;
|
|
2880
2902
|
this.settings.clear();
|
|
@@ -2904,44 +2926,44 @@ var PaintWetLayers = (_class7 = class {
|
|
|
2904
2926
|
return out;
|
|
2905
2927
|
}
|
|
2906
2928
|
destroy() {
|
|
2907
|
-
_optionalChain([this, 'access',
|
|
2929
|
+
_optionalChain([this, 'access', _180 => _180.world, 'optionalAccess', _181 => _181.destroy, 'call', _182 => _182()]);
|
|
2908
2930
|
this.world = null;
|
|
2909
|
-
_optionalChain([this, 'access',
|
|
2931
|
+
_optionalChain([this, 'access', _183 => _183.gpu, 'optionalAccess', _184 => _184.destroy, 'call', _185 => _185()]);
|
|
2910
2932
|
this.gpu = null;
|
|
2911
2933
|
}
|
|
2912
2934
|
}, _class7);
|
|
2913
2935
|
function wetPigmentOf(hex, body) {
|
|
2914
|
-
const [r, g, b] =
|
|
2915
|
-
return Array.from(
|
|
2936
|
+
const [r, g, b] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, hex);
|
|
2937
|
+
return Array.from(_chunkKBYB7OWBcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], body));
|
|
2916
2938
|
}
|
|
2917
2939
|
|
|
2918
2940
|
// src/paint-editor/thumbnails.ts
|
|
2919
2941
|
var thumbWorld = null;
|
|
2920
2942
|
function paintWetTestStroke(brush, paper, color, width, height) {
|
|
2921
2943
|
if (!thumbWorld || thumbWorld.width !== width || thumbWorld.height !== height) {
|
|
2922
|
-
_optionalChain([thumbWorld, 'optionalAccess',
|
|
2923
|
-
thumbWorld = new (0,
|
|
2944
|
+
_optionalChain([thumbWorld, 'optionalAccess', _186 => _186.destroy, 'call', _187 => _187()]);
|
|
2945
|
+
thumbWorld = new (0, _chunkKBYB7OWBcjs.WetWorld)(width, height, wetPaperInput(paper), { kernel: "typescript", threads: 0 });
|
|
2924
2946
|
} else thumbWorld.setPaper(wetPaperInput(paper));
|
|
2925
2947
|
const w = thumbWorld;
|
|
2926
2948
|
if (w.hasLane("thumb")) w.removeLane("thumb");
|
|
2927
2949
|
w.ensureLane("thumb");
|
|
2928
|
-
const [r, g, b] =
|
|
2950
|
+
const [r, g, b] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, color);
|
|
2929
2951
|
if (brush.wet.tool !== "paint" && brush.wet.tool !== "water") {
|
|
2930
2952
|
const half = Math.ceil(height / 2);
|
|
2931
|
-
w.paint("thumb", { x: 0, y: 0, width, height: half }, null, 0.4, Array.from(
|
|
2932
|
-
w.paint("thumb", { x: 0, y: half, width, height: height - half }, null, 0.4, Array.from(
|
|
2953
|
+
w.paint("thumb", { x: 0, y: 0, width, height: half }, null, 0.4, Array.from(_chunkKBYB7OWBcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], 0), (v) => v * 0.05));
|
|
2954
|
+
w.paint("thumb", { x: 0, y: half, width, height: height - half }, null, 0.4, Array.from(_chunkKBYB7OWBcjs.pigmentOf.call(void 0, [232 / 255, 196 / 255, 64 / 255], 0), (v) => v * 0.05));
|
|
2933
2955
|
}
|
|
2934
2956
|
const driver = new WetStrokeDriver({
|
|
2935
2957
|
world: w,
|
|
2936
2958
|
laneId: "thumb",
|
|
2937
2959
|
brush,
|
|
2938
2960
|
color: [r / 255, g / 255, b / 255],
|
|
2939
|
-
load: brushLoadForStroke(brush,
|
|
2961
|
+
load: brushLoadForStroke(brush, _chunkI7NJPHWVcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255]),
|
|
2940
2962
|
grain: paperGrain(paper),
|
|
2941
2963
|
paperDepth: paper.depth,
|
|
2942
|
-
paperColor:
|
|
2964
|
+
paperColor: _chunkGT77U7QGcjs.hexToRgb8.call(void 0, paper.color),
|
|
2943
2965
|
seed: 7,
|
|
2944
|
-
copies: [
|
|
2966
|
+
copies: [_chunkGT77U7QGcjs.IDENTITY_COPY]
|
|
2945
2967
|
});
|
|
2946
2968
|
driver.push(thumbnailStroke(width, height));
|
|
2947
2969
|
driver.finish();
|
|
@@ -2961,7 +2983,7 @@ function thumbnailStroke(width, height) {
|
|
|
2961
2983
|
return pts;
|
|
2962
2984
|
}
|
|
2963
2985
|
function paintTestStroke(surface, brush, paper, color, width, height) {
|
|
2964
|
-
const [r, g, b] =
|
|
2986
|
+
const [r, g, b] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, color);
|
|
2965
2987
|
let result = surface;
|
|
2966
2988
|
let thick = null;
|
|
2967
2989
|
let light = null;
|
|
@@ -2982,14 +3004,14 @@ function paintTestStroke(surface, brush, paper, color, width, height) {
|
|
|
2982
3004
|
lockTransparency: false,
|
|
2983
3005
|
brush,
|
|
2984
3006
|
color: [r, g, b, 255],
|
|
2985
|
-
background: [...
|
|
3007
|
+
background: [..._chunkGT77U7QGcjs.hexToRgb8.call(void 0, paper.color), 255],
|
|
2986
3008
|
grain: paperGrain(paper),
|
|
2987
3009
|
paperDepth: paper.depth,
|
|
2988
3010
|
seed: 7,
|
|
2989
3011
|
colorHex: color,
|
|
2990
3012
|
affineCopies: [],
|
|
2991
|
-
copies: [
|
|
2992
|
-
mixerLoad: brushLoadForStroke(brush,
|
|
3013
|
+
copies: [_chunkGT77U7QGcjs.IDENTITY_COPY],
|
|
3014
|
+
mixerLoad: brushLoadForStroke(brush, _chunkI7NJPHWVcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255]),
|
|
2993
3015
|
thick: brush.engine === "impasto" ? { channels: emptyThickChannels() } : void 0,
|
|
2994
3016
|
sticker: brush.engine === "sticker" ? { nextId: 1 } : void 0,
|
|
2995
3017
|
light: brush.light.amount > 0 && brush.engine !== "wet" && brush.engine !== "sticker" ? { surface: emptyLight() } : null
|
|
@@ -3004,8 +3026,8 @@ function renderBrushThumbnail(brush, options) {
|
|
|
3004
3026
|
const width = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.width, () => ( 160)))));
|
|
3005
3027
|
const height = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.height, () => ( 48)))));
|
|
3006
3028
|
const maxSize = height * 0.42;
|
|
3007
|
-
const b = brush.tip.size > maxSize ?
|
|
3008
|
-
const rgba = [...
|
|
3029
|
+
const b = brush.tip.size > maxSize ? _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: maxSize } }, brush) : brush;
|
|
3030
|
+
const rgba = [..._chunkGT77U7QGcjs.hexToRgb8.call(void 0, options.color), 255];
|
|
3009
3031
|
let surface = _chunk474IQG74cjs.emptySurface.call(void 0, 4);
|
|
3010
3032
|
if (b.engine === "eraser") {
|
|
3011
3033
|
surface = _chunk474IQG74cjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height }, rgba);
|
|
@@ -3263,12 +3285,12 @@ function colorHarmony2(base, kind, options = {}) {
|
|
|
3263
3285
|
function readSwatch(raw) {
|
|
3264
3286
|
if (!raw || typeof raw !== "object") return null;
|
|
3265
3287
|
const r = raw;
|
|
3266
|
-
const g =
|
|
3267
|
-
const color = typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : _optionalChain([g, 'optionalAccess',
|
|
3288
|
+
const g = _chunkI7NJPHWVcjs.readPaintSource.call(void 0, r.paint);
|
|
3289
|
+
const color = typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : _optionalChain([g, 'optionalAccess', _188 => _188.type]) === "gradient" ? _chunkI7NJPHWVcjs.paintSourceColor.call(void 0, g) : null;
|
|
3268
3290
|
if (!color) return null;
|
|
3269
3291
|
const out = { color };
|
|
3270
3292
|
if (typeof r.name === "string" && r.name.trim()) out.name = r.name.trim().slice(0, 80);
|
|
3271
|
-
if (_optionalChain([g, 'optionalAccess',
|
|
3293
|
+
if (_optionalChain([g, 'optionalAccess', _189 => _189.type]) === "gradient") out.paint = g;
|
|
3272
3294
|
return out;
|
|
3273
3295
|
}
|
|
3274
3296
|
var DEFAULT_SWATCHES = [
|
|
@@ -3287,7 +3309,7 @@ var DEFAULT_SWATCHES = [
|
|
|
3287
3309
|
// src/paint-editor/mixing-pad.ts
|
|
3288
3310
|
var MIXING_PAD_WIDTH = 360;
|
|
3289
3311
|
var MIXING_PAD_HEIGHT = 220;
|
|
3290
|
-
var PAD_PAINT =
|
|
3312
|
+
var PAD_PAINT = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, {
|
|
3291
3313
|
id: "pad-paint",
|
|
3292
3314
|
name: "Pad paint",
|
|
3293
3315
|
category: "mixer",
|
|
@@ -3295,7 +3317,7 @@ var PAD_PAINT = _chunk6G6ZDDDBcjs.normalizePaintBrush.call(void 0, {
|
|
|
3295
3317
|
tip: { size: 28, hardness: 0.75, spacing: 0.1, opacity: 1, flow: 0.7, pressureSize: false, pressureOpacity: false },
|
|
3296
3318
|
mixer: { wet: 0.45, load: 1, mix: 0.4, loadEachStroke: true, cleanEachStroke: true, mixing: "pigment" }
|
|
3297
3319
|
});
|
|
3298
|
-
var PAD_KNIFE =
|
|
3320
|
+
var PAD_KNIFE = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, {
|
|
3299
3321
|
id: "pad-knife",
|
|
3300
3322
|
name: "Palette knife",
|
|
3301
3323
|
category: "smudge",
|
|
@@ -3305,7 +3327,7 @@ var PAD_KNIFE = _chunk6G6ZDDDBcjs.normalizePaintBrush.call(void 0, {
|
|
|
3305
3327
|
// A knife drags streaks of paint and folds them into each other, mixing them as pigment.
|
|
3306
3328
|
smudge: { strength: 0.6, length: 0.8, mixing: "pigment" }
|
|
3307
3329
|
});
|
|
3308
|
-
var PAD_BLOB =
|
|
3330
|
+
var PAD_BLOB = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, {
|
|
3309
3331
|
id: "pad-blob",
|
|
3310
3332
|
name: "Pad blob",
|
|
3311
3333
|
category: "custom",
|
|
@@ -3327,12 +3349,12 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init71.cal
|
|
|
3327
3349
|
}
|
|
3328
3350
|
}
|
|
3329
3351
|
let brush = options.tool === "knife" ? PAD_KNIFE : PAD_PAINT;
|
|
3330
|
-
if (options.size !== void 0) brush =
|
|
3352
|
+
if (options.size !== void 0) brush = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: options.size } }, brush);
|
|
3331
3353
|
return this.run(brush, points, options.color);
|
|
3332
3354
|
}
|
|
3333
3355
|
/** Paints `points` with `brush` in `color` on the pad. */
|
|
3334
3356
|
run(brush, points, color) {
|
|
3335
|
-
const [r, g, b] =
|
|
3357
|
+
const [r, g, b] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, color);
|
|
3336
3358
|
let result = null;
|
|
3337
3359
|
const session = new PaintStrokeSession(
|
|
3338
3360
|
{ update: () => {
|
|
@@ -3350,8 +3372,8 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init71.cal
|
|
|
3350
3372
|
seed: 1,
|
|
3351
3373
|
colorHex: color,
|
|
3352
3374
|
affineCopies: [],
|
|
3353
|
-
copies: [
|
|
3354
|
-
mixerLoad: brushLoadForStroke(brush,
|
|
3375
|
+
copies: [_chunkGT77U7QGcjs.IDENTITY_COPY],
|
|
3376
|
+
mixerLoad: brushLoadForStroke(brush, _chunkI7NJPHWVcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255])
|
|
3355
3377
|
}
|
|
3356
3378
|
);
|
|
3357
3379
|
session.push(points);
|
|
@@ -3426,10 +3448,10 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init71.cal
|
|
|
3426
3448
|
const off = used.length === 1 ? 0 : 0.45 * R;
|
|
3427
3449
|
const x = Math.min(cx + R - r, Math.max(cx - R + r, cx + Math.cos(a) * off));
|
|
3428
3450
|
const y = Math.min(cy + R - r, Math.max(cy - R + r, cy + Math.sin(a) * off));
|
|
3429
|
-
const blob =
|
|
3451
|
+
const blob = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: Math.max(2, 2 * r) } }, PAD_BLOB);
|
|
3430
3452
|
this.run(blob, [{ x, y }], p.color.toLowerCase());
|
|
3431
3453
|
});
|
|
3432
|
-
const knife =
|
|
3454
|
+
const knife = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_KNIFE.tip, size: Math.max(12, R * 0.5) } }, PAD_KNIFE);
|
|
3433
3455
|
for (let k = 0; k < passes; k++) {
|
|
3434
3456
|
const stir = [];
|
|
3435
3457
|
const turns = 1.6;
|
|
@@ -3440,24 +3462,24 @@ var MixingPad = (_class9 = class {constructor() { _class9.prototype.__init71.cal
|
|
|
3440
3462
|
}
|
|
3441
3463
|
this.run(knife, stir, "#000000");
|
|
3442
3464
|
}
|
|
3443
|
-
const mixed =
|
|
3444
|
-
paints.map((p) =>
|
|
3465
|
+
const mixed = _chunk2VX55NFMcjs.mixPigments.call(void 0,
|
|
3466
|
+
paints.map((p) => _chunkGT77U7QGcjs.hexToRgb8.call(void 0, p.color).map((v) => v / 255)),
|
|
3445
3467
|
paints.map((p) => p.parts)
|
|
3446
3468
|
);
|
|
3447
|
-
const core =
|
|
3469
|
+
const core = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: R * 1.1, hardness: 0.55 } }, PAD_BLOB);
|
|
3448
3470
|
const hex = "#" + mixed.map((v) => Math.round(v * 255).toString(16).padStart(2, "0")).join("");
|
|
3449
3471
|
this.run(core, [{ x: cx, y: cy }], hex);
|
|
3450
3472
|
return { color: this.pick(cx, cy, 2), bounds };
|
|
3451
3473
|
}
|
|
3452
3474
|
/** The pad's pixels as a PNG data URL (with alpha), for saving. */
|
|
3453
3475
|
toPng() {
|
|
3454
|
-
return
|
|
3476
|
+
return _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, this.width, this.height, _chunk474IQG74cjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height }));
|
|
3455
3477
|
}
|
|
3456
3478
|
/** Replaces the pad with a PNG (data URL or base64) of the pad's size, as `toPng` writes. */
|
|
3457
3479
|
fromPng(png) {
|
|
3458
|
-
const bytes = png.startsWith("data:") ? _optionalChain([
|
|
3459
|
-
if (!bytes || !
|
|
3460
|
-
const img =
|
|
3480
|
+
const bytes = png.startsWith("data:") ? _optionalChain([_chunkW5M3J7PVcjs.parseDataUrl.call(void 0, png), 'optionalAccess', _190 => _190.bytes]) : _chunkW5M3J7PVcjs.base64ToBytes.call(void 0, png);
|
|
3481
|
+
if (!bytes || !_chunkW5M3J7PVcjs.isPng.call(void 0, bytes)) throw new Error("The pad image is not a PNG data URL or base64 PNG.");
|
|
3482
|
+
const img = _chunkW5M3J7PVcjs.decodePng.call(void 0, bytes);
|
|
3461
3483
|
if (img.width !== this.width || img.height !== this.height) throw new Error(`The pad image is ${img.width}\xD7${img.height}; a mixing pad is ${this.width}\xD7${this.height}.`);
|
|
3462
3484
|
this.surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width: img.width, height: img.height, data: img.data }, 4);
|
|
3463
3485
|
this.version++;
|
|
@@ -3577,8 +3599,8 @@ var BacklightCache = (_class10 = class {constructor() { _class10.prototype.__ini
|
|
|
3577
3599
|
refs.length = 0;
|
|
3578
3600
|
for (const l of layers) {
|
|
3579
3601
|
tilesUnder(l.surface, rect, l.offset, refs);
|
|
3580
|
-
tilesUnder(_optionalChain([l, 'access',
|
|
3581
|
-
tilesUnder(_optionalChain([l, 'access',
|
|
3602
|
+
tilesUnder(_optionalChain([l, 'access', _191 => _191.thick, 'optionalAccess', _192 => _192.height]), rect, l.offset, refs);
|
|
3603
|
+
tilesUnder(_optionalChain([l, 'access', _193 => _193.thick, 'optionalAccess', _194 => _194.material]), rect, l.offset, refs);
|
|
3582
3604
|
}
|
|
3583
3605
|
const k = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
|
|
3584
3606
|
let r = this.tiles.get(k);
|
|
@@ -3650,10 +3672,10 @@ function addTiles(a, b) {
|
|
|
3650
3672
|
}
|
|
3651
3673
|
function computeTile(paper, grain, amount, rect, layers) {
|
|
3652
3674
|
const n = rect.width * rect.height;
|
|
3653
|
-
const [p0, p1, p2] =
|
|
3675
|
+
const [p0, p1, p2] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, paper.color);
|
|
3654
3676
|
const pb = [p0, p1, p2];
|
|
3655
3677
|
const pl = [Math.max(1e-4, LIN[p0]), Math.max(1e-4, LIN[p1]), Math.max(1e-4, LIN[p2])];
|
|
3656
|
-
const [c0, c1, c2] =
|
|
3678
|
+
const [c0, c1, c2] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, _nullishCoalesce(paper.backlightColor, () => ( DEFAULT_BACKLIGHT_COLOR)));
|
|
3657
3679
|
const t0 = new Float32Array(n).fill(amount * LIN[c0]);
|
|
3658
3680
|
const t1 = new Float32Array(n).fill(amount * LIN[c1]);
|
|
3659
3681
|
const t2 = new Float32Array(n).fill(amount * LIN[c2]);
|
|
@@ -3672,8 +3694,8 @@ function computeTile(paper, grain, amount, rect, layers) {
|
|
|
3672
3694
|
const lr = { x: rect.x - l.offset.x, y: rect.y - l.offset.y, width: rect.width, height: rect.height };
|
|
3673
3695
|
if (!l.surface.tiles.size) continue;
|
|
3674
3696
|
const px = _chunk474IQG74cjs.readRegion.call(void 0, l.surface, lr);
|
|
3675
|
-
const h = _optionalChain([l, 'access',
|
|
3676
|
-
const m = h && _optionalChain([l, 'access',
|
|
3697
|
+
const h = _optionalChain([l, 'access', _195 => _195.thick, 'optionalAccess', _196 => _196.height, 'access', _197 => _197.tiles, 'access', _198 => _198.size]) ? _chunk474IQG74cjs.readRegion.call(void 0, l.thick.height, lr) : null;
|
|
3698
|
+
const m = h && _optionalChain([l, 'access', _199 => _199.thick, 'optionalAccess', _200 => _200.material, 'access', _201 => _201.tiles, 'access', _202 => _202.size]) ? _chunk474IQG74cjs.readRegion.call(void 0, l.thick.material, lr) : null;
|
|
3677
3699
|
const op = l.opacity;
|
|
3678
3700
|
for (let i = 0; i < n; i++) {
|
|
3679
3701
|
const a8 = px[i * 4 + 3];
|
|
@@ -3738,7 +3760,7 @@ function replayItems(doc) {
|
|
|
3738
3760
|
}
|
|
3739
3761
|
function emptiedLayers(layers) {
|
|
3740
3762
|
let out = [...layers];
|
|
3741
|
-
for (const l of
|
|
3763
|
+
for (const l of _chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers)) if (l.type === "pixel") out = _chunkDPYAO5U6cjs.mapLayer.call(void 0, out, l.id, () => ({ ...l, surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } }));
|
|
3742
3764
|
return out;
|
|
3743
3765
|
}
|
|
3744
3766
|
async function replayPainting(source, target, options = {}) {
|
|
@@ -3748,7 +3770,7 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3748
3770
|
const maxStrokes = _nullishCoalesce(options.strokes, () => ( source.strokes.length));
|
|
3749
3771
|
const chunk = Math.max(1, _nullishCoalesce(options.wetChunk, () => ( 0))) || Infinity;
|
|
3750
3772
|
let strokes = 0;
|
|
3751
|
-
await target.prepareEffectPaints(source.strokes.slice(0, maxStrokes).flatMap((st) => _optionalChain([st, 'access',
|
|
3773
|
+
await target.prepareEffectPaints(source.strokes.slice(0, maxStrokes).flatMap((st) => _optionalChain([st, 'access', _203 => _203.paint, 'optionalAccess', _204 => _204.type]) === "effect" ? [st.paint] : []));
|
|
3752
3774
|
const advanceTo = async (clock) => {
|
|
3753
3775
|
const now = target.getState().wet.clock;
|
|
3754
3776
|
let left = clock - now;
|
|
@@ -3756,7 +3778,7 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3756
3778
|
const n = Math.min(left, chunk);
|
|
3757
3779
|
await target.advanceWet({ steps: n });
|
|
3758
3780
|
left -= n;
|
|
3759
|
-
if (Number.isFinite(chunk)) await _optionalChain([options, 'access',
|
|
3781
|
+
if (Number.isFinite(chunk)) await _optionalChain([options, 'access', _205 => _205.onWetSteps, 'optionalCall', _206 => _206(target.getState().wet.clock)]);
|
|
3760
3782
|
}
|
|
3761
3783
|
};
|
|
3762
3784
|
const sr = (r) => ({ x: r.x * s, y: r.y * s, width: r.width * s, height: r.height * s });
|
|
@@ -3769,14 +3791,14 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3769
3791
|
else if (e.kind === "clear") target.clearLayer(e.layerId);
|
|
3770
3792
|
else if (e.kind === "live-strokes") {
|
|
3771
3793
|
const d = e.data;
|
|
3772
|
-
if (_optionalChain([d, 'optionalAccess',
|
|
3794
|
+
if (_optionalChain([d, 'optionalAccess', _207 => _207.rasterized])) target.replaceLiveStrokes(e.layerId, null);
|
|
3773
3795
|
else {
|
|
3774
|
-
const list = (_nullishCoalesce(_optionalChain([d, 'optionalAccess',
|
|
3775
|
-
await target.prepareEffectPaints(list.flatMap((st2) => _optionalChain([st2, 'access',
|
|
3796
|
+
const list = (_nullishCoalesce(_optionalChain([d, 'optionalAccess', _208 => _208.strokes]), () => ( []))).map((st2) => s === 1 ? st2 : { ...varyStroke(st2, scaleM, { scale: s }), ...st2.stencils ? { stencils: st2.stencils.map((x) => scaleStencil(x, s)) } : {} });
|
|
3797
|
+
await target.prepareEffectPaints(list.flatMap((st2) => _optionalChain([st2, 'access', _209 => _209.paint, 'optionalAccess', _210 => _210.type]) === "effect" ? [st2.paint] : []));
|
|
3776
3798
|
target.replaceLiveStrokes(e.layerId, list);
|
|
3777
3799
|
}
|
|
3778
3800
|
} else if (e.kind === "stickers") {
|
|
3779
|
-
const list = (_nullishCoalesce(_optionalChain([e, 'access',
|
|
3801
|
+
const list = (_nullishCoalesce(_optionalChain([e, 'access', _211 => _211.data, 'optionalAccess', _212 => _212.stickers]), () => ( []))).map((x) => s === 1 ? x : { ...x, x: x.x * s, y: x.y * s, size: x.size * s });
|
|
3780
3802
|
target.replaceStickers(e.layerId, list);
|
|
3781
3803
|
} else target.flattenRelief(e.layerId);
|
|
3782
3804
|
continue;
|
|
@@ -3789,8 +3811,8 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3789
3811
|
switch (e.kind) {
|
|
3790
3812
|
case "dry": {
|
|
3791
3813
|
const rect = e.data;
|
|
3792
|
-
const ids = _optionalChain([e, 'access',
|
|
3793
|
-
if (_optionalChain([ids, 'optionalAccess',
|
|
3814
|
+
const ids = _optionalChain([e, 'access', _213 => _213.layerId, 'optionalAccess', _214 => _214.split, 'call', _215 => _215(","), 'access', _216 => _216.filter, 'call', _217 => _217(Boolean)]);
|
|
3815
|
+
if (_optionalChain([ids, 'optionalAccess', _218 => _218.length])) for (const id of ids) target.dryPaint({ layerId: id, rect: rect ? sr(rect) : void 0 });
|
|
3794
3816
|
else target.dryPaint({ rect: rect ? sr(rect) : void 0 });
|
|
3795
3817
|
break;
|
|
3796
3818
|
}
|
|
@@ -3821,7 +3843,7 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3821
3843
|
strokes++;
|
|
3822
3844
|
if (!target.getLayer(st.layerId)) continue;
|
|
3823
3845
|
const init = { layerId: st.layerId, color: st.color, brush: st.brush, seed: st.seed, copies: _nullishCoalesce(st.copies, () => ( [])), ...st.load ? { load: st.load } : {}, ...st.paint ? { paint: st.paint } : {}, snapToPerspective: false, stencils: false, maskStencils: (_nullishCoalesce(st.stencils, () => ( []))).map((x) => s === 1 ? x : scaleStencil(x, s)) };
|
|
3824
|
-
if (st.brush.engine === "wet" && _optionalChain([st, 'access',
|
|
3846
|
+
if (st.brush.engine === "wet" && _optionalChain([st, 'access', _219 => _219.steps, 'optionalAccess', _220 => _220.length]) === st.points.length) {
|
|
3825
3847
|
await target.wetIdle();
|
|
3826
3848
|
await advanceTo(st.steps[0]);
|
|
3827
3849
|
const session = target.beginStroke({ ...init, start: st.points[0] });
|
|
@@ -3841,7 +3863,7 @@ async function replayPainting(source, target, options = {}) {
|
|
|
3841
3863
|
await target.wetIdle();
|
|
3842
3864
|
target.paintStroke({ ...init, points: st.points });
|
|
3843
3865
|
}
|
|
3844
|
-
await _optionalChain([options, 'access',
|
|
3866
|
+
await _optionalChain([options, 'access', _221 => _221.onStroke, 'optionalCall', _222 => _222(strokes)]);
|
|
3845
3867
|
}
|
|
3846
3868
|
void IDENTITY_AFFINE;
|
|
3847
3869
|
}
|
|
@@ -3864,7 +3886,7 @@ function timeLapseVideo(frameCount, width, height, fps, holdMs, name = "Time-lap
|
|
|
3864
3886
|
}
|
|
3865
3887
|
const video = { version: 1, name, width: w, height: h, fps, background: "#000000", assets, tracks: [{ id: "v1", kind: "video", clips }] };
|
|
3866
3888
|
const durationMs = frameCount ? clips[clips.length - 1].start + clips[clips.length - 1].duration : 0;
|
|
3867
|
-
return { video, ffmpeg:
|
|
3889
|
+
return { video, ffmpeg: _chunkZBCT5MEAcjs.toVideoFfmpeg.call(void 0, video, { output: "timelapse.mp4" }), durationMs };
|
|
3868
3890
|
}
|
|
3869
3891
|
async function buildTimeLapse(source, target, options = {}) {
|
|
3870
3892
|
const maxSide = Math.max(32, Math.min(4096, Math.round(_nullishCoalesce(options.maxSide, () => ( 720)))));
|
|
@@ -3879,14 +3901,14 @@ async function buildTimeLapse(source, target, options = {}) {
|
|
|
3879
3901
|
const f = replayFrame(target, maxSide, stroke);
|
|
3880
3902
|
width = f.width;
|
|
3881
3903
|
height = f.height;
|
|
3882
|
-
frames.push(
|
|
3904
|
+
frames.push(_chunkW5M3J7PVcjs.encodePng.call(void 0, f.width, f.height, f.data));
|
|
3883
3905
|
};
|
|
3884
3906
|
shoot(0);
|
|
3885
3907
|
await replayPainting(source, target, {
|
|
3886
3908
|
wetChunk: wetEvery > 0 ? wetEvery : 0,
|
|
3887
3909
|
onStroke: (i) => {
|
|
3888
3910
|
if (i % perFrame === 0 || i === total) shoot(i);
|
|
3889
|
-
_optionalChain([options, 'access',
|
|
3911
|
+
_optionalChain([options, 'access', _223 => _223.onProgress, 'optionalCall', _224 => _224(total ? i / total : 1)]);
|
|
3890
3912
|
},
|
|
3891
3913
|
onWetSteps: wetEvery > 0 ? () => shoot(-1) : void 0
|
|
3892
3914
|
});
|
|
@@ -3947,7 +3969,7 @@ function checkPaintEffectPlace(d, place) {
|
|
|
3947
3969
|
else if (d.uses.includes("filter") && place !== "light") instead = "; run it on a layer's dried paint with apply_effect instead";
|
|
3948
3970
|
else if (place === "light" && d.uses.some((u) => PAINT_EFFECT_PLACES.layer.includes(u))) instead = "; add it as an effect layer (add_effect_layer) or fill a layer with it (fill_layer_with_effect) instead";
|
|
3949
3971
|
else if (place === "paper" && d.uses.some((u) => u === "overlay" || u === "title")) instead = "; add it as an effect layer with add_effect_layer instead";
|
|
3950
|
-
throw new (0,
|
|
3972
|
+
throw new (0, _chunkISIO63Q5cjs.EffectUnsupportedError)(`"${d.id}" (${d.name}) is a ${d.uses.join(" / ") || d.kind} effect, and ${PLACE_WORDS[place]}${instead}.`, d.id);
|
|
3951
3973
|
}
|
|
3952
3974
|
var PAPER_EFFECT_BLENDS = ["multiply", "normal", "overlay", "soft-light", "screen", "color"];
|
|
3953
3975
|
var paperVersion = 1;
|
|
@@ -4027,15 +4049,15 @@ function readPaintEffectSource(raw) {
|
|
|
4027
4049
|
};
|
|
4028
4050
|
}
|
|
4029
4051
|
function paperEffectToJSON(p) {
|
|
4030
|
-
return { ...sourceOut(p), opacity: p.opacity, blend: p.blend, png:
|
|
4052
|
+
return { ...sourceOut(p), opacity: p.opacity, blend: p.blend, png: _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, p.image.width, p.image.height, p.image.data) };
|
|
4031
4053
|
}
|
|
4032
4054
|
function paperEffectFromJSON(raw, width, height) {
|
|
4033
4055
|
const source = readPaintEffectSource(raw);
|
|
4034
4056
|
if (!source) throw new Error("it is not an effect (effect id and values)");
|
|
4035
4057
|
const r = raw;
|
|
4036
|
-
const parsed = typeof r.png === "string" ?
|
|
4058
|
+
const parsed = typeof r.png === "string" ? _chunkW5M3J7PVcjs.parseDataUrl.call(void 0, r.png) : null;
|
|
4037
4059
|
if (!parsed) throw new Error("its pixels are missing");
|
|
4038
|
-
const image =
|
|
4060
|
+
const image = _chunkW5M3J7PVcjs.decodePng.call(void 0, parsed.bytes);
|
|
4039
4061
|
if (image.width !== width || image.height !== height) throw new Error(`its pixels are ${image.width}\xD7${image.height}, not the canvas size ${width}\xD7${height}`);
|
|
4040
4062
|
const opacity = typeof r.opacity === "number" && r.opacity >= 0 && r.opacity <= 1 ? r.opacity : 1;
|
|
4041
4063
|
const blend = PAPER_EFFECT_BLENDS.includes(r.blend) ? r.blend : "multiply";
|
|
@@ -4052,7 +4074,7 @@ function effectGuard(fn) {
|
|
|
4052
4074
|
try {
|
|
4053
4075
|
return fn();
|
|
4054
4076
|
} catch (e) {
|
|
4055
|
-
if (e instanceof
|
|
4077
|
+
if (e instanceof _chunkDPYAO5U6cjs.LayerEffectError) throw new PaintEditorError(e.message);
|
|
4056
4078
|
throw e;
|
|
4057
4079
|
}
|
|
4058
4080
|
}
|
|
@@ -4069,7 +4091,7 @@ function parseColor(value, what = "color") {
|
|
|
4069
4091
|
return value.trim().toLowerCase();
|
|
4070
4092
|
}
|
|
4071
4093
|
function rgbaOf(hex) {
|
|
4072
|
-
const [r, g, b] =
|
|
4094
|
+
const [r, g, b] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, hex);
|
|
4073
4095
|
return [r, g, b, 255];
|
|
4074
4096
|
}
|
|
4075
4097
|
function rgbToHex(r, g, b) {
|
|
@@ -4082,7 +4104,7 @@ function unionRect(a, b) {
|
|
|
4082
4104
|
const y = Math.min(a.y, b.y);
|
|
4083
4105
|
return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
|
|
4084
4106
|
}
|
|
4085
|
-
var isPixelLayer = (l) => _optionalChain([l, 'optionalAccess',
|
|
4107
|
+
var isPixelLayer = (l) => _optionalChain([l, 'optionalAccess', _225 => _225.type]) === "pixel";
|
|
4086
4108
|
var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
4087
4109
|
|
|
4088
4110
|
__init82() {this.extensions = {}}
|
|
@@ -4104,7 +4126,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4104
4126
|
__init90() {this.paintEpoch = 0}
|
|
4105
4127
|
/** Rendered effect paints by `effectPaintKey` (most recently used last). */
|
|
4106
4128
|
__init91() {this.effectPaintPixels = /* @__PURE__ */ new Map()}
|
|
4107
|
-
__init92() {this.mixerLoad =
|
|
4129
|
+
__init92() {this.mixerLoad = _chunkI7NJPHWVcjs.EMPTY_MIXER_LOAD}
|
|
4108
4130
|
__init93() {this.view = { ...DEFAULT_VIEW, pan: { ...DEFAULT_VIEW.pan } }}
|
|
4109
4131
|
|
|
4110
4132
|
__init94() {this.selectedStroke = null}
|
|
@@ -4160,15 +4182,21 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4160
4182
|
/** Set while an operation that changes wet paint runs: the simulation before it (for undo). */
|
|
4161
4183
|
__init129() {this.wetOp = null}
|
|
4162
4184
|
/** The effects provider slot (see `setEffectsProvider`). */
|
|
4163
|
-
__init130() {this.effects = new (0,
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4185
|
+
__init130() {this.effects = new (0, _chunkISIO63Q5cjs.EffectsSlot)()}
|
|
4186
|
+
/** The sticker library slot (see `setStickersProvider`). */
|
|
4187
|
+
__init131() {this.stickers = new (0, _chunk4JNWA3VTcjs.StickersSlot)(_chunkATK6ABN3cjs.editorStickers.call(void 0, ))}
|
|
4188
|
+
__init132() {this.stickerArt = new (0, _chunkGT77U7QGcjs.StickerArtCache)()}
|
|
4189
|
+
|
|
4190
|
+
__init133() {this.effectsRenderer = new PaintEffectsRenderer()}
|
|
4191
|
+
__init134() {this.paperEffectNodeCache = null}
|
|
4192
|
+
constructor(options = {}) {;_class12.prototype.__init82.call(this);_class12.prototype.__init83.call(this);_class12.prototype.__init84.call(this);_class12.prototype.__init85.call(this);_class12.prototype.__init86.call(this);_class12.prototype.__init87.call(this);_class12.prototype.__init88.call(this);_class12.prototype.__init89.call(this);_class12.prototype.__init90.call(this);_class12.prototype.__init91.call(this);_class12.prototype.__init92.call(this);_class12.prototype.__init93.call(this);_class12.prototype.__init94.call(this);_class12.prototype.__init95.call(this);_class12.prototype.__init96.call(this);_class12.prototype.__init97.call(this);_class12.prototype.__init98.call(this);_class12.prototype.__init99.call(this);_class12.prototype.__init100.call(this);_class12.prototype.__init101.call(this);_class12.prototype.__init102.call(this);_class12.prototype.__init103.call(this);_class12.prototype.__init104.call(this);_class12.prototype.__init105.call(this);_class12.prototype.__init106.call(this);_class12.prototype.__init107.call(this);_class12.prototype.__init108.call(this);_class12.prototype.__init109.call(this);_class12.prototype.__init110.call(this);_class12.prototype.__init111.call(this);_class12.prototype.__init112.call(this);_class12.prototype.__init113.call(this);_class12.prototype.__init114.call(this);_class12.prototype.__init115.call(this);_class12.prototype.__init116.call(this);_class12.prototype.__init117.call(this);_class12.prototype.__init118.call(this);_class12.prototype.__init119.call(this);_class12.prototype.__init120.call(this);_class12.prototype.__init121.call(this);_class12.prototype.__init122.call(this);_class12.prototype.__init123.call(this);_class12.prototype.__init124.call(this);_class12.prototype.__init125.call(this);_class12.prototype.__init126.call(this);_class12.prototype.__init127.call(this);_class12.prototype.__init128.call(this);_class12.prototype.__init129.call(this);_class12.prototype.__init130.call(this);_class12.prototype.__init131.call(this);_class12.prototype.__init132.call(this);_class12.prototype.__init133.call(this);_class12.prototype.__init134.call(this);_class12.prototype.__init135.call(this);_class12.prototype.__init136.call(this);_class12.prototype.__init137.call(this);_class12.prototype.__init138.call(this);
|
|
4167
4193
|
this.historyLimit = Math.max(1, _nullishCoalesce(options.historyLimit, () => ( 200)));
|
|
4194
|
+
this.rasterizeSticker = _nullishCoalesce(options.rasterizeSticker, () => ( _chunkGT77U7QGcjs.defaultStickerRasterizer));
|
|
4195
|
+
if (options.stickers) this.stickers.set(options.stickers);
|
|
4168
4196
|
this.doc = createPaintDocument({ width: options.width, height: options.height, dpi: options.dpi, paper: this.resolvePaper(options.paper) });
|
|
4169
|
-
this.userBrushes = (_nullishCoalesce(options.brushes, () => ( []))).map((b) =>
|
|
4170
|
-
const start = _nullishCoalesce(this.findBrush(_nullishCoalesce(options.brushId, () => (
|
|
4171
|
-
this.brush =
|
|
4197
|
+
this.userBrushes = (_nullishCoalesce(options.brushes, () => ( []))).map((b) => _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { ...b, builtin: false }));
|
|
4198
|
+
const start = _nullishCoalesce(this.findBrush(_nullishCoalesce(options.brushId, () => ( _chunkGT77U7QGcjs.DEFAULT_BRUSH_ID))), () => ( this.findBrush(_chunkGT77U7QGcjs.DEFAULT_BRUSH_ID)));
|
|
4199
|
+
this.brush = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, start);
|
|
4172
4200
|
this.color = options.color ? parseColor(options.color) : "#1f2937";
|
|
4173
4201
|
this.hand = options.hand === "left" ? "left" : "right";
|
|
4174
4202
|
this.encodeImage = options.encodeImage;
|
|
@@ -4179,19 +4207,19 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4179
4207
|
canvas: () => this.doc.canvas,
|
|
4180
4208
|
paper: () => this.doc.paper,
|
|
4181
4209
|
layerSurface: (id) => {
|
|
4182
|
-
const l = _optionalChain([
|
|
4210
|
+
const l = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _226 => _226.layer]);
|
|
4183
4211
|
return isPixelLayer(l) ? l.surface : null;
|
|
4184
4212
|
},
|
|
4185
4213
|
updateSurfaces: (surfaces, rects) => {
|
|
4186
4214
|
let layers = this.doc.layers;
|
|
4187
|
-
for (const [id, surface] of surfaces) if (
|
|
4215
|
+
for (const [id, surface] of surfaces) if (_chunkDPYAO5U6cjs.findLayer.call(void 0, layers, id)) layers = _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, (l) => ({ ...l, surface }));
|
|
4188
4216
|
this.doc = { ...this.doc, layers };
|
|
4189
4217
|
this.emit(rects.length ? rects : "all");
|
|
4190
4218
|
},
|
|
4191
|
-
layerLight: (id) => _nullishCoalesce(_optionalChain([this, 'access',
|
|
4219
|
+
layerLight: (id) => _nullishCoalesce(_optionalChain([this, 'access', _227 => _227.doc, 'access', _228 => _228.light, 'optionalAccess', _229 => _229[id]]), () => ( null)),
|
|
4192
4220
|
updateLights: (lights) => {
|
|
4193
4221
|
let light = this.doc.light;
|
|
4194
|
-
for (const [id, surface] of lights) if (
|
|
4222
|
+
for (const [id, surface] of lights) if (_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id)) light = withLayerLight(light, id, surface);
|
|
4195
4223
|
this.doc = { ...this.doc, ...light ? { light } : {} };
|
|
4196
4224
|
},
|
|
4197
4225
|
changed: () => {
|
|
@@ -4199,7 +4227,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4199
4227
|
},
|
|
4200
4228
|
options.wet
|
|
4201
4229
|
);
|
|
4202
|
-
this.wet.onDriverDone = () => _optionalChain([this, 'access',
|
|
4230
|
+
this.wet.onDriverDone = () => _optionalChain([this, 'access', _230 => _230.session, 'optionalAccess', _231 => _231.completeWetEnd, 'call', _232 => _232()]);
|
|
4203
4231
|
}
|
|
4204
4232
|
// --- State and events ----------------------------------------------------------
|
|
4205
4233
|
subscribe(listener) {
|
|
@@ -4221,7 +4249,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4221
4249
|
this.cached = {
|
|
4222
4250
|
document: this.doc,
|
|
4223
4251
|
brush: this.brush,
|
|
4224
|
-
brushes: this.library ??= [...
|
|
4252
|
+
brushes: this.library ??= [..._chunkGT77U7QGcjs.BUILTIN_BRUSHES, ...this.userBrushes],
|
|
4225
4253
|
color: this.color,
|
|
4226
4254
|
secondaryColor: this.secondaryColor,
|
|
4227
4255
|
paint: _nullishCoalesce(this.gradient, () => ( { type: "color", color: this.color })),
|
|
@@ -4235,8 +4263,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4235
4263
|
selectedSticker: this.selectedSticker,
|
|
4236
4264
|
canUndo: this.undoStack.length > 0 && !this.session,
|
|
4237
4265
|
canRedo: this.redoStack.length > 0 && !this.session,
|
|
4238
|
-
undoLabel: _nullishCoalesce(_optionalChain([last, 'optionalAccess',
|
|
4239
|
-
redoLabel: _nullishCoalesce(_optionalChain([next, 'optionalAccess',
|
|
4266
|
+
undoLabel: _nullishCoalesce(_optionalChain([last, 'optionalAccess', _233 => _233.label]), () => ( null)),
|
|
4267
|
+
redoLabel: _nullishCoalesce(_optionalChain([next, 'optionalAccess', _234 => _234.label]), () => ( null)),
|
|
4240
4268
|
guides: this.guides,
|
|
4241
4269
|
swatches: this.swatches,
|
|
4242
4270
|
mixingPadVersion: this.pad.version,
|
|
@@ -4249,10 +4277,10 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4249
4277
|
overlay: this.wet.overlay,
|
|
4250
4278
|
instantDry: this.wet.instantDry,
|
|
4251
4279
|
speed: this.wet.speed,
|
|
4252
|
-
clock: _nullishCoalesce(_optionalChain([this, 'access',
|
|
4280
|
+
clock: _nullishCoalesce(_optionalChain([this, 'access', _235 => _235.wet, 'access', _236 => _236.world, 'optionalAccess', _237 => _237.clock]), () => ( 0)),
|
|
4253
4281
|
tilt: { ...this.wet.tilt },
|
|
4254
4282
|
gpu: this.wet.gpuMode,
|
|
4255
|
-
gpuActive: Boolean(_optionalChain([this, 'access',
|
|
4283
|
+
gpuActive: Boolean(_optionalChain([this, 'access', _238 => _238.wet, 'access', _239 => _239.world, 'optionalAccess', _240 => _240.gpuActive]))
|
|
4256
4284
|
},
|
|
4257
4285
|
version: this.version
|
|
4258
4286
|
};
|
|
@@ -4271,7 +4299,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4271
4299
|
return d;
|
|
4272
4300
|
}
|
|
4273
4301
|
// --- History -------------------------------------------------------------------
|
|
4274
|
-
|
|
4302
|
+
__init135() {this.docRevision = 0}
|
|
4275
4303
|
/**
|
|
4276
4304
|
* Bumped on every change to the painting (a committed or amended step, undo, redo, opening a
|
|
4277
4305
|
* document), not on wet-paint frames or view changes. `createPaintEditorDocument` uses it.
|
|
@@ -4354,9 +4382,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4354
4382
|
return wetIds;
|
|
4355
4383
|
}
|
|
4356
4384
|
/** Records a wet event (for replays) in the document being built. */
|
|
4357
|
-
|
|
4385
|
+
__init136() {this.pendingWetEvents = []}
|
|
4358
4386
|
logWet(e) {
|
|
4359
|
-
this.pendingWetEvents.push({ clock: _nullishCoalesce(_optionalChain([this, 'access',
|
|
4387
|
+
this.pendingWetEvents.push({ clock: _nullishCoalesce(_optionalChain([this, 'access', _241 => _241.wet, 'access', _242 => _242.world, 'optionalAccess', _243 => _243.clock]), () => ( 0)), at: this.doc.strokes.length, ...e });
|
|
4360
4388
|
}
|
|
4361
4389
|
/** The document with a paint event appended (for replays). */
|
|
4362
4390
|
withPaintEvent(doc, e) {
|
|
@@ -4417,7 +4445,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4417
4445
|
// --- Canvas and paper ----------------------------------------------------------
|
|
4418
4446
|
resolvePaper(paper) {
|
|
4419
4447
|
if (typeof paper === "string") {
|
|
4420
|
-
const p =
|
|
4448
|
+
const p = _chunkGT77U7QGcjs.paperPreset.call(void 0, paper);
|
|
4421
4449
|
if (!p) throw new PaintEditorError(`Unknown paper "${paper}". Call list_papers for the ids.`);
|
|
4422
4450
|
return p;
|
|
4423
4451
|
}
|
|
@@ -4500,8 +4528,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4500
4528
|
}
|
|
4501
4529
|
let next = { ...shiftDocument(this.withWetEvents(this.doc), left, top), canvas: { ...was, width, height } };
|
|
4502
4530
|
for (const id of keptWet) {
|
|
4503
|
-
const l = _optionalChain([
|
|
4504
|
-
if (isPixelLayer(l)) next = { ...next, layers:
|
|
4531
|
+
const l = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, next.layers, id), 'optionalAccess', _244 => _244.layer]);
|
|
4532
|
+
if (isPixelLayer(l)) next = { ...next, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, next.layers, id, () => ({ ...l, surface: _chunk474IQG74cjs.translateSurface.call(void 0, l.surface, l.offset.x, l.offset.y), offset: { x: 0, y: 0 } })) };
|
|
4505
4533
|
}
|
|
4506
4534
|
if (this.wet.world) {
|
|
4507
4535
|
if (keptWet.length) this.wet.extend(width, height, left, top, next.paper);
|
|
@@ -4528,23 +4556,23 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4528
4556
|
this.requireIdle("changing the paper");
|
|
4529
4557
|
let base = this.doc.paper;
|
|
4530
4558
|
if (update.preset !== void 0 && update.preset !== this.doc.paper.preset) {
|
|
4531
|
-
const p =
|
|
4559
|
+
const p = _chunkGT77U7QGcjs.paperPreset.call(void 0, update.preset);
|
|
4532
4560
|
if (!p) throw new PaintEditorError(`Unknown paper "${update.preset}". Call list_papers for the ids.`);
|
|
4533
4561
|
base = p;
|
|
4534
4562
|
}
|
|
4535
4563
|
const { preset: _p, ...rest } = update;
|
|
4536
4564
|
if (rest.color !== void 0) parseColor(rest.color, "paper color");
|
|
4537
|
-
const paper =
|
|
4565
|
+
const paper = _chunkGT77U7QGcjs.normalizePaper.call(void 0, { ...rest, preset: base.preset, offset: _nullishCoalesce(rest.offset, () => ( this.doc.paper.offset)) }, base);
|
|
4538
4566
|
const changedKeys = Object.keys(rest).filter((k) => k !== "name");
|
|
4539
4567
|
if (changedKeys.length && update.preset === void 0) paper.preset = base.preset;
|
|
4540
4568
|
if (this.wet.world) this.beginWetOp();
|
|
4541
4569
|
this.commit("Paper", { ...this.doc, paper });
|
|
4542
4570
|
this.wet.paperChanged();
|
|
4543
|
-
return
|
|
4571
|
+
return _chunkGT77U7QGcjs.clonePaper.call(void 0, paper);
|
|
4544
4572
|
}
|
|
4545
4573
|
// --- Layers --------------------------------------------------------------------
|
|
4546
4574
|
getLayer(id) {
|
|
4547
|
-
return _optionalChain([
|
|
4575
|
+
return _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _245 => _245.layer]);
|
|
4548
4576
|
}
|
|
4549
4577
|
/** The active pixel layer (or `undefined`). */
|
|
4550
4578
|
getActiveLayer() {
|
|
@@ -4563,12 +4591,12 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4563
4591
|
walk(this.doc.layers, null, 0);
|
|
4564
4592
|
return out;
|
|
4565
4593
|
}
|
|
4566
|
-
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([
|
|
4594
|
+
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _246 => _246.parent, 'optionalAccess', _247 => _247.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _248 => _248.path, 'access', _249 => _249.length]), () => ( 0))) {
|
|
4567
4595
|
let bounds = null;
|
|
4568
4596
|
if (l.type === "pixel") {
|
|
4569
4597
|
const b = _chunk474IQG74cjs.contentBounds.call(void 0, l.surface);
|
|
4570
4598
|
bounds = b ? { ...b, x: b.x + l.offset.x, y: b.y + l.offset.y } : null;
|
|
4571
|
-
} else for (const c of
|
|
4599
|
+
} else for (const c of _chunkDPYAO5U6cjs.flattenLayers.call(void 0, l.children)) if (c.type === "pixel") bounds = unionRect(bounds, this.describeLayer(c, l.id, depth + 1).bounds);
|
|
4572
4600
|
return {
|
|
4573
4601
|
id: l.id,
|
|
4574
4602
|
name: l.name,
|
|
@@ -4580,8 +4608,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4580
4608
|
locks: { ..._nullishCoalesce(l.locks, () => ( {})) },
|
|
4581
4609
|
active: l.id === this.doc.activeLayerId,
|
|
4582
4610
|
bounds,
|
|
4583
|
-
..._optionalChain([this, 'access',
|
|
4584
|
-
..._optionalChain([l, 'access',
|
|
4611
|
+
..._optionalChain([this, 'access', _250 => _250.doc, 'access', _251 => _251.liveStrokes, 'optionalAccess', _252 => _252[l.id]]) ? { liveStrokes: this.doc.liveStrokes[l.id].length } : {},
|
|
4612
|
+
..._optionalChain([l, 'access', _253 => _253.effects, 'optionalAccess', _254 => _254.items, 'access', _255 => _255.length]) ? { effects: l.effects.items.length } : {},
|
|
4585
4613
|
parentId,
|
|
4586
4614
|
depth
|
|
4587
4615
|
};
|
|
@@ -4597,7 +4625,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4597
4625
|
if (!id) throw new PaintEditorError(`There is no active layer to ${what}; add one with add_layer.`);
|
|
4598
4626
|
const l = this.requireLayer(id);
|
|
4599
4627
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; ${what} a pixel layer inside it.`);
|
|
4600
|
-
if (
|
|
4628
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it (update_layer locks) before you ${what} it.`);
|
|
4601
4629
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) before you ${what} it.`);
|
|
4602
4630
|
return l;
|
|
4603
4631
|
}
|
|
@@ -4611,9 +4639,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4611
4639
|
/** Adds a layer above the active one: `pixel` (default), `group`, or `strokes`, a live stroke layer whose strokes stay editable. */
|
|
4612
4640
|
addLayer(options = {}) {
|
|
4613
4641
|
this.requireIdle("adding a layer");
|
|
4614
|
-
const count =
|
|
4642
|
+
const count = _chunkDPYAO5U6cjs.flattenLayers.call(void 0, this.doc.layers).length;
|
|
4615
4643
|
const type = _nullishCoalesce(options.type, () => ( "pixel"));
|
|
4616
|
-
const name = _optionalChain([options, 'access',
|
|
4644
|
+
const name = _optionalChain([options, 'access', _256 => _256.name, 'optionalAccess', _257 => _257.trim, 'call', _258 => _258()]) || (type === "group" ? `Group ${count + 1}` : type === "strokes" ? `Strokes ${count + 1}` : `Layer ${count + 1}`);
|
|
4617
4645
|
const layer = type === "group" ? { type: "group", id: newPaintLayerId(), name, visible: true, opacity: 1, blend: "pass-through", children: [] } : createPaintLayer(name);
|
|
4618
4646
|
let parentId = null;
|
|
4619
4647
|
let index;
|
|
@@ -4623,12 +4651,12 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4623
4651
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
4624
4652
|
parentId = g.id;
|
|
4625
4653
|
} else if (above) {
|
|
4626
|
-
const loc =
|
|
4654
|
+
const loc = _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, above);
|
|
4627
4655
|
if (!loc) throw new PaintEditorError(`Unknown layer "${above}". Call list_layers for the ids.`);
|
|
4628
|
-
parentId = _nullishCoalesce(_optionalChain([loc, 'access',
|
|
4656
|
+
parentId = _nullishCoalesce(_optionalChain([loc, 'access', _259 => _259.parent, 'optionalAccess', _260 => _260.id]), () => ( null));
|
|
4629
4657
|
index = loc.index + 1;
|
|
4630
4658
|
}
|
|
4631
|
-
const layers =
|
|
4659
|
+
const layers = _chunkDPYAO5U6cjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
|
|
4632
4660
|
const live = type === "strokes" ? { liveStrokes: { ..._nullishCoalesce(this.doc.liveStrokes, () => ( {})), [layer.id]: [] } } : {};
|
|
4633
4661
|
this.commit(type === "group" ? "Add group" : type === "strokes" ? "Add stroke layer" : "Add layer", { ...this.doc, layers, activeLayerId: layer.id, ...live });
|
|
4634
4662
|
return this.describeLayer(layer);
|
|
@@ -4636,9 +4664,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4636
4664
|
updateLayer(id, update) {
|
|
4637
4665
|
this.requireIdle("changing a layer");
|
|
4638
4666
|
const l = this.requireLayer(id);
|
|
4639
|
-
if (
|
|
4667
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, l, "all") && Object.keys(update).some((k) => k !== "locks")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it first (locks {all: false}).`);
|
|
4640
4668
|
if (update.opacity !== void 0 && !(update.opacity >= 0 && update.opacity <= 1)) throw new PaintEditorError(`opacity ${update.opacity} is out of range; use 0..1.`);
|
|
4641
|
-
if (update.blend !== void 0 && !
|
|
4669
|
+
if (update.blend !== void 0 && !_chunk2VX55NFMcjs.isBlendMode.call(void 0, update.blend) && !(l.type === "group" && update.blend === "pass-through")) {
|
|
4642
4670
|
throw new PaintEditorError(`Unknown blend mode "${update.blend}". Call get_canvas_info for the blend modes.`);
|
|
4643
4671
|
}
|
|
4644
4672
|
if (update.name !== void 0 && !update.name.trim()) throw new PaintEditorError("name is empty; give the layer a name.");
|
|
@@ -4652,7 +4680,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4652
4680
|
const locks = { ..._nullishCoalesce(l.locks, () => ( {})), ...update.locks };
|
|
4653
4681
|
next.locks = Object.values(locks).some(Boolean) ? locks : void 0;
|
|
4654
4682
|
}
|
|
4655
|
-
this.commit("Layer properties", { ...this.doc, layers:
|
|
4683
|
+
this.commit("Layer properties", { ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, id, () => next) });
|
|
4656
4684
|
return this.describeLayer(next);
|
|
4657
4685
|
}
|
|
4658
4686
|
// --- Layer effects (layer styles) ---------------------------------------------
|
|
@@ -4667,17 +4695,17 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4667
4695
|
* layer's pixels when it is composited, so it follows later painting. One undo step.
|
|
4668
4696
|
*/
|
|
4669
4697
|
addLayerEffect(id, kind, settings = {}, index) {
|
|
4670
|
-
if (!
|
|
4698
|
+
if (!_chunkDPYAO5U6cjs.isLayerEffectKind.call(void 0, kind)) throw new PaintEditorError(`Unknown effect kind "${String(kind)}". Kinds: ${_chunkDPYAO5U6cjs.LAYER_EFFECT_KINDS.join(", ")}.`);
|
|
4671
4699
|
const current = _nullishCoalesce(this.effectsLayer(id, "add effects").effects, () => ( { enabled: true, items: [] }));
|
|
4672
4700
|
const ids = new Set(current.items.map((e) => e.id));
|
|
4673
|
-
let effectId =
|
|
4674
|
-
while (ids.has(effectId)) effectId =
|
|
4701
|
+
let effectId = _chunkDPYAO5U6cjs.newEffectId.call(void 0, );
|
|
4702
|
+
while (ids.has(effectId)) effectId = _chunkDPYAO5U6cjs.newEffectId.call(void 0, );
|
|
4675
4703
|
const { id: _id, kind: _kind, ...rest } = settings;
|
|
4676
|
-
const effect = effectGuard(() =>
|
|
4704
|
+
const effect = effectGuard(() => _chunkDPYAO5U6cjs.mergeLayerEffect.call(void 0, _chunkDPYAO5U6cjs.defaultLayerEffect.call(void 0, kind, effectId), rest));
|
|
4677
4705
|
const items = [...current.items];
|
|
4678
4706
|
const at = index === void 0 ? items.length : Math.max(0, Math.min(items.length, Math.floor(index)));
|
|
4679
4707
|
items.splice(at, 0, effect);
|
|
4680
|
-
this.writeLayerEffects(id, { ...current, items }, `Add ${
|
|
4708
|
+
this.writeLayerEffects(id, { ...current, items }, `Add ${_chunkDPYAO5U6cjs.layerEffectLabel.call(void 0, kind)}`, true);
|
|
4681
4709
|
return { effect, effects: this.getLayerEffects(id) };
|
|
4682
4710
|
}
|
|
4683
4711
|
/**
|
|
@@ -4689,15 +4717,15 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4689
4717
|
const current = this.effectsLayer(id, "change its effects").effects;
|
|
4690
4718
|
const i = this.requireEffect(id, effectId);
|
|
4691
4719
|
const items = [...current.items];
|
|
4692
|
-
items[i] = effectGuard(() =>
|
|
4693
|
-
this.writeLayerEffects(id, { ...current, items }, `Change ${
|
|
4720
|
+
items[i] = effectGuard(() => _chunkDPYAO5U6cjs.mergeLayerEffect.call(void 0, items[i], changes));
|
|
4721
|
+
this.writeLayerEffects(id, { ...current, items }, `Change ${_chunkDPYAO5U6cjs.layerEffectLabel.call(void 0, items[i].kind)}`, commitToHistory);
|
|
4694
4722
|
return this.getLayerEffects(id);
|
|
4695
4723
|
}
|
|
4696
4724
|
/** Removes one effect (one undo step). Returns the layer's remaining effects. */
|
|
4697
4725
|
removeLayerEffect(id, effectId) {
|
|
4698
4726
|
const current = this.effectsLayer(id, "change its effects").effects;
|
|
4699
4727
|
const i = this.requireEffect(id, effectId);
|
|
4700
|
-
this.writeLayerEffects(id, { ...current, items: current.items.filter((e) => e.id !== effectId) }, `Remove ${
|
|
4728
|
+
this.writeLayerEffects(id, { ...current, items: current.items.filter((e) => e.id !== effectId) }, `Remove ${_chunkDPYAO5U6cjs.layerEffectLabel.call(void 0, current.items[i].kind)}`, true);
|
|
4701
4729
|
return this.getLayerEffects(id);
|
|
4702
4730
|
}
|
|
4703
4731
|
/** Turns all of a layer's effects on or off and, when given, sets Scale Effects (0.01..10). One undo step. */
|
|
@@ -4715,7 +4743,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4715
4743
|
/** Replaces a layer's effects, validated (`null` removes them). One undo step. Returns the effects. */
|
|
4716
4744
|
setLayerEffects(id, effects, commitToHistory = true) {
|
|
4717
4745
|
this.effectsLayer(id, "change its effects");
|
|
4718
|
-
if (effects) effectGuard(() =>
|
|
4746
|
+
if (effects) effectGuard(() => _chunkDPYAO5U6cjs.validateLayerEffects.call(void 0, effects));
|
|
4719
4747
|
this.writeLayerEffects(id, effects, "Layer effects", commitToHistory);
|
|
4720
4748
|
return this.getLayerEffects(id);
|
|
4721
4749
|
}
|
|
@@ -4726,12 +4754,12 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4726
4754
|
effectsLayer(id, action) {
|
|
4727
4755
|
this.requireIdle("changing layer effects");
|
|
4728
4756
|
const l = this.requireLayer(id);
|
|
4729
|
-
if (
|
|
4757
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, l, "all")) throw new PaintEditorError(`Layer "${l.name}" is fully locked, so it can't ${action}; unlock it first (locks {all: false}).`);
|
|
4730
4758
|
return l;
|
|
4731
4759
|
}
|
|
4732
4760
|
requireEffect(id, effectId) {
|
|
4733
4761
|
const l = this.requireLayer(id);
|
|
4734
|
-
const items = _nullishCoalesce(_optionalChain([l, 'access',
|
|
4762
|
+
const items = _nullishCoalesce(_optionalChain([l, 'access', _261 => _261.effects, 'optionalAccess', _262 => _262.items]), () => ( []));
|
|
4735
4763
|
const i = items.findIndex((e) => e.id === effectId);
|
|
4736
4764
|
if (i === -1) throw new PaintEditorError(`Layer "${l.name}" has no effect "${effectId}". Effects: ${items.map((e) => `${e.id} (${e.kind})`).join(", ") || "none"}; call list_layer_effects.`);
|
|
4737
4765
|
return i;
|
|
@@ -4741,30 +4769,30 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4741
4769
|
const next = { ...this.requireLayer(id) };
|
|
4742
4770
|
if (effects && (effects.items.length || effects.psd || effects.scale !== void 0 || !effects.enabled)) next.effects = effects;
|
|
4743
4771
|
else delete next.effects;
|
|
4744
|
-
this.commitOrAmend(label, { ...this.doc, layers:
|
|
4772
|
+
this.commitOrAmend(label, { ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, id, () => next) }, commitToHistory);
|
|
4745
4773
|
}
|
|
4746
4774
|
removeLayer(id) {
|
|
4747
4775
|
this.requireIdle("removing a layer");
|
|
4748
4776
|
const l = this.requireLayer(id);
|
|
4749
|
-
if (
|
|
4750
|
-
const wetIds = this.wet.wetLayerIds().filter((x) => x === id || l.type === "group" &&
|
|
4777
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, l, "all")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it before removing it.`);
|
|
4778
|
+
const wetIds = this.wet.wetLayerIds().filter((x) => x === id || l.type === "group" && _chunkDPYAO5U6cjs.findLayer.call(void 0, l.children, x));
|
|
4751
4779
|
if (wetIds.length) {
|
|
4752
4780
|
this.beginWetOp();
|
|
4753
4781
|
for (const x of wetIds) this.wet.world.removeLane(x);
|
|
4754
4782
|
}
|
|
4755
|
-
const layers =
|
|
4783
|
+
const layers = _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
4756
4784
|
let active = this.doc.activeLayerId;
|
|
4757
|
-
if (active && !
|
|
4758
|
-
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(
|
|
4785
|
+
if (active && !_chunkDPYAO5U6cjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkDPYAO5U6cjs.flattenLayers.call(void 0, layers), 'access', _263 => _263.filter, 'call', _264 => _264((x) => x.type === "pixel"), 'access', _265 => _265.pop, 'call', _266 => _266(), 'optionalAccess', _267 => _267.id]), () => ( null));
|
|
4786
|
+
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(_chunkDPYAO5U6cjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.stickersWithout(_chunkDPYAO5U6cjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.liveStrokesWithout(_chunkDPYAO5U6cjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.lightWithout(_chunkDPYAO5U6cjs.flattenLayers.call(void 0, [l]).map((x) => x.id)) });
|
|
4759
4787
|
return { removed: id, activeLayerId: active };
|
|
4760
4788
|
}
|
|
4761
4789
|
duplicateLayer(id) {
|
|
4762
4790
|
this.requireIdle("duplicating a layer");
|
|
4763
|
-
if (
|
|
4791
|
+
if (_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id)) {
|
|
4764
4792
|
const inside = (l) => l.type === "group" ? l.children.flatMap(inside) : [l.id];
|
|
4765
|
-
this.dryLayersFirst(inside(
|
|
4793
|
+
this.dryLayersFirst(inside(_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id).layer));
|
|
4766
4794
|
}
|
|
4767
|
-
const loc =
|
|
4795
|
+
const loc = _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id);
|
|
4768
4796
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
4769
4797
|
const thick = { ..._nullishCoalesce(this.doc.thick, () => ( {})) };
|
|
4770
4798
|
const stickers = { ..._nullishCoalesce(this.doc.stickers, () => ( {})) };
|
|
@@ -4780,43 +4808,43 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4780
4808
|
return l.type === "group" ? { ...l, id: id2, children: l.children.map(copy) } : { ...l, id: id2 };
|
|
4781
4809
|
};
|
|
4782
4810
|
const dup = { ...copy(loc.layer), name: `${loc.layer.name} copy` };
|
|
4783
|
-
const layers =
|
|
4811
|
+
const layers = _chunkDPYAO5U6cjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _268 => _268.parent, 'optionalAccess', _269 => _269.id]), () => ( null)), loc.index + 1);
|
|
4784
4812
|
this.commit("Duplicate layer", this.withWetEvents({ ...this.doc, layers, activeLayerId: dup.id, ...this.doc.thick ? { thick } : {}, ...this.doc.stickers ? { stickers } : {}, ...this.doc.liveStrokes ? { liveStrokes } : {}, ...this.doc.light ? { light } : {} }));
|
|
4785
4813
|
return this.describeLayer(dup);
|
|
4786
4814
|
}
|
|
4787
4815
|
/** Moves a layer to `index` (0 = bottom) within `parentId` (default its own parent; `null` = top level). */
|
|
4788
4816
|
moveLayer(id, index, parentId) {
|
|
4789
4817
|
this.requireIdle("moving a layer");
|
|
4790
|
-
const loc =
|
|
4818
|
+
const loc = _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id);
|
|
4791
4819
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
4792
|
-
const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access',
|
|
4820
|
+
const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _270 => _270.parent, 'optionalAccess', _271 => _271.id]), () => ( null)) : parentId;
|
|
4793
4821
|
if (target) {
|
|
4794
4822
|
const g = this.requireLayer(target);
|
|
4795
4823
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
4796
|
-
if (target === id || loc.layer.type === "group" &&
|
|
4824
|
+
if (target === id || loc.layer.type === "group" && _chunkDPYAO5U6cjs.findLayer.call(void 0, loc.layer.children, target)) throw new PaintEditorError("A group cannot move into itself.");
|
|
4797
4825
|
}
|
|
4798
|
-
const without =
|
|
4799
|
-
const siblings = target ?
|
|
4826
|
+
const without = _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
4827
|
+
const siblings = target ? _chunkDPYAO5U6cjs.findLayer.call(void 0, without, target).layer.children : without;
|
|
4800
4828
|
if (!Number.isInteger(index) || index < 0 || index > siblings.length) throw new PaintEditorError(`index ${index} is out of range; use 0..${siblings.length} (0 is the bottom).`);
|
|
4801
|
-
const layers =
|
|
4829
|
+
const layers = _chunkDPYAO5U6cjs.insertLayer.call(void 0, without, loc.layer, target, index);
|
|
4802
4830
|
this.commit("Move layer", { ...this.doc, layers });
|
|
4803
4831
|
return this.describeLayer(loc.layer);
|
|
4804
4832
|
}
|
|
4805
4833
|
/** Merges a pixel layer into the pixel layer below it (keeping the lower one's settings). */
|
|
4806
4834
|
mergeDown(id) {
|
|
4807
4835
|
this.requireIdle("merging");
|
|
4808
|
-
const pre =
|
|
4836
|
+
const pre = _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id);
|
|
4809
4837
|
if (pre) {
|
|
4810
4838
|
const sib = pre.parent ? pre.parent.children : this.doc.layers;
|
|
4811
|
-
this.dryLayersFirst([id, _optionalChain([sib, 'access',
|
|
4839
|
+
this.dryLayersFirst([id, _optionalChain([sib, 'access', _272 => _272[pre.index - 1], 'optionalAccess', _273 => _273.id])].filter((x) => Boolean(x)));
|
|
4812
4840
|
}
|
|
4813
|
-
const loc =
|
|
4841
|
+
const loc = _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id);
|
|
4814
4842
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
4815
4843
|
const siblings = loc.parent ? loc.parent.children : this.doc.layers;
|
|
4816
4844
|
const below = siblings[loc.index - 1];
|
|
4817
4845
|
const upper = loc.layer;
|
|
4818
4846
|
if (!isPixelLayer(upper) || !isPixelLayer(below)) throw new PaintEditorError("Merge down needs a pixel layer directly above another pixel layer in the same group.");
|
|
4819
|
-
if (
|
|
4847
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, below, "pixels")) throw new PaintEditorError(`Layer "${below.name}" has its pixels locked; unlock it to merge into it.`);
|
|
4820
4848
|
const rect = unionRect(this.describeLayer(below).bounds, this.describeLayer(upper).bounds);
|
|
4821
4849
|
let surface = _chunk474IQG74cjs.emptySurface.call(void 0, 4);
|
|
4822
4850
|
if (rect) {
|
|
@@ -4826,9 +4854,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4826
4854
|
surface = _chunk474IQG74cjs.surfaceFromPixels.call(void 0, { width: rect.width, height: rect.height, data: px }, 4, rect.x, rect.y);
|
|
4827
4855
|
}
|
|
4828
4856
|
const merged = { ...below, surface, offset: { x: 0, y: 0 } };
|
|
4829
|
-
const layers =
|
|
4857
|
+
const layers = _chunkDPYAO5U6cjs.mapLayer.call(void 0, _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
|
|
4830
4858
|
const toDoc = (t, l) => t ? _chunk474IQG74cjs.translateSurface.call(void 0, t, l.offset.x, l.offset.y) : void 0;
|
|
4831
|
-
const mergedLight = _optionalChain([this, 'access',
|
|
4859
|
+
const mergedLight = _optionalChain([this, 'access', _274 => _274.doc, 'access', _275 => _275.light, 'optionalAccess', _276 => _276[upper.id]]) || _optionalChain([this, 'access', _277 => _277.doc, 'access', _278 => _278.light, 'optionalAccess', _279 => _279[below.id]]) ? mergeLight(toDoc(_optionalChain([this, 'access', _280 => _280.doc, 'access', _281 => _281.light, 'optionalAccess', _282 => _282[below.id]]), below), upper.visible ? toDoc(_optionalChain([this, 'access', _283 => _283.doc, 'access', _284 => _284.light, 'optionalAccess', _285 => _285[upper.id]]), upper) : void 0, _chunk474IQG74cjs.translateSurface.call(void 0, upper.surface, upper.offset.x, upper.offset.y)) : void 0;
|
|
4832
4860
|
const lightAfter = _nullishCoalesce(this.lightWithout([upper.id, below.id]).light, () => ( (this.doc.light ? { ...this.doc.light } : void 0)));
|
|
4833
4861
|
const light = mergedLight ? { ..._nullishCoalesce(lightAfter, () => ( {})), [below.id]: mergedLight } : lightAfter;
|
|
4834
4862
|
this.commit("Merge down", this.withWetEvents({ ...this.doc, layers, activeLayerId: below.id, ...this.thickWithout([upper.id]), ...this.stickersWithout([upper.id, below.id]), ...this.liveStrokesWithout([upper.id, below.id]), ...light ? { light } : {} }));
|
|
@@ -4843,7 +4871,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4843
4871
|
this.wet.world.removeLane(l.id);
|
|
4844
4872
|
}
|
|
4845
4873
|
const bounds = this.describeLayer(l).bounds;
|
|
4846
|
-
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers:
|
|
4874
|
+
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunk474IQG74cjs.emptySurface.call(void 0, 4) })), ...this.thickWithout([l.id]), ...this.stickersWithout([l.id]), ..._optionalChain([this, 'access', _286 => _286.doc, 'access', _287 => _287.liveStrokes, 'optionalAccess', _288 => _288[l.id]]) ? { liveStrokes: { ...this.doc.liveStrokes, [l.id]: [] } } : {}, ...this.lightWithout([l.id]) }, { kind: "clear", layerId: l.id }));
|
|
4847
4875
|
return { layerId: l.id, bounds };
|
|
4848
4876
|
}
|
|
4849
4877
|
/**
|
|
@@ -4853,8 +4881,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4853
4881
|
fillLayer(options = {}) {
|
|
4854
4882
|
this.requireIdle("filling");
|
|
4855
4883
|
const fillTarget = this.paintTarget(options.layerId, "fill");
|
|
4856
|
-
if (_optionalChain([this, 'access',
|
|
4857
|
-
if (_optionalChain([this, 'access',
|
|
4884
|
+
if (_optionalChain([this, 'access', _289 => _289.doc, 'access', _290 => _290.stickers, 'optionalAccess', _291 => _291[fillTarget.id], 'optionalAccess', _292 => _292.length])) throw new PaintEditorError(`Layer "${fillTarget.name}" is a sticker layer; fill another layer (add_layer).`);
|
|
4885
|
+
if (_optionalChain([this, 'access', _293 => _293.doc, 'access', _294 => _294.liveStrokes, 'optionalAccess', _295 => _295[fillTarget.id]])) throw new PaintEditorError(`Layer "${fillTarget.name}" is a stroke layer (its pixels are drawn from its strokes); fill another layer (add_layer), or rasterize it first (rasterize_stroke_layer).`);
|
|
4858
4886
|
this.dryLayersFirst([_nullishCoalesce(_nullishCoalesce(options.layerId, () => ( this.doc.activeLayerId)), () => ( ""))]);
|
|
4859
4887
|
const l = this.paintTarget(options.layerId, "fill");
|
|
4860
4888
|
const color = options.color === void 0 ? this.color : parseColor(options.color);
|
|
@@ -4864,16 +4892,16 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4864
4892
|
if (!(grainAmount >= 0 && grainAmount <= 1)) throw new PaintEditorError(`grain ${grainAmount} is out of range; use 0..1.`);
|
|
4865
4893
|
const pressure = _nullishCoalesce(options.pressure, () => ( 0.5));
|
|
4866
4894
|
const blend = _nullishCoalesce(options.blend, () => ( "normal"));
|
|
4867
|
-
if (!
|
|
4895
|
+
if (!_chunk2VX55NFMcjs.isBlendMode.call(void 0, blend)) throw new PaintEditorError(`Unknown blend mode "${blend}".`);
|
|
4868
4896
|
const { width, height } = this.doc.canvas;
|
|
4869
4897
|
const rect = { x: 0, y: 0, width, height };
|
|
4870
|
-
const coverage = new (0,
|
|
4898
|
+
const coverage = new (0, _chunkI7NJPHWVcjs.CoverageMap)();
|
|
4871
4899
|
const depth = grainAmount * this.doc.paper.depth;
|
|
4872
4900
|
const grain = depth > 0 ? paperGrain(this.doc.paper) : null;
|
|
4873
4901
|
for (const { tx, ty } of _chunk474IQG74cjs.tilesInRect.call(void 0, rect)) {
|
|
4874
4902
|
const r = { x: tx * _chunk474IQG74cjs.TILE, y: ty * _chunk474IQG74cjs.TILE, width: Math.min(_chunk474IQG74cjs.TILE, width - tx * _chunk474IQG74cjs.TILE), height: Math.min(_chunk474IQG74cjs.TILE, height - ty * _chunk474IQG74cjs.TILE) };
|
|
4875
4903
|
const vals = new Float32Array(r.width * r.height);
|
|
4876
|
-
for (let y = 0, k = 0; y < r.height; y++) for (let x = 0; x < r.width; x++, k++) vals[k] = grain ?
|
|
4904
|
+
for (let y = 0, k = 0; y < r.height; y++) for (let x = 0; x < r.width; x++, k++) vals[k] = grain ? _chunkI7NJPHWVcjs.grainCatch.call(void 0, grain.at(r.x + x + 0.5, r.y + y + 0.5), depth, pressure) : 1;
|
|
4877
4905
|
coverage.accumulate(r, vals, 1);
|
|
4878
4906
|
}
|
|
4879
4907
|
const apply = {
|
|
@@ -4882,14 +4910,14 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4882
4910
|
background: rgbaOf(this.doc.paper.color),
|
|
4883
4911
|
opacity,
|
|
4884
4912
|
blend,
|
|
4885
|
-
lockTransparency:
|
|
4913
|
+
lockTransparency: _chunkDPYAO5U6cjs.isLayerLocked.call(void 0, l, "transparency"),
|
|
4886
4914
|
selection: null,
|
|
4887
4915
|
offset: l.offset
|
|
4888
4916
|
};
|
|
4889
4917
|
const surface = this.applyCoverage(l, coverage, rect, apply);
|
|
4890
|
-
const lit = _optionalChain([this, 'access',
|
|
4918
|
+
const lit = _optionalChain([this, 'access', _296 => _296.doc, 'access', _297 => _297.light, 'optionalAccess', _298 => _298[l.id]]);
|
|
4891
4919
|
const light = lit ? withLayerLight(this.doc.light, l.id, scaleLight(lit, 1 - opacity)) : void 0;
|
|
4892
|
-
this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers:
|
|
4920
|
+
this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), ...light ? { light } : {} }), { kind: "fill", layerId: l.id, data: { color, opacity, grain: grainAmount, pressure, blend } }));
|
|
4893
4921
|
return { layerId: l.id, bounds: rect };
|
|
4894
4922
|
}
|
|
4895
4923
|
applyCoverage(l, coverage, rect, apply) {
|
|
@@ -4897,8 +4925,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4897
4925
|
const tiles = new Map(base.tiles);
|
|
4898
4926
|
for (const { tx, ty } of _chunk474IQG74cjs.tilesInRect.call(void 0, { x: rect.x - l.offset.x, y: rect.y - l.offset.y, width: rect.width, height: rect.height })) {
|
|
4899
4927
|
const key = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
|
|
4900
|
-
const src = _nullishCoalesce(_optionalChain([base, 'access',
|
|
4901
|
-
const tile = _chunk474IQG74cjs.finishTile.call(void 0,
|
|
4928
|
+
const src = _nullishCoalesce(_optionalChain([base, 'access', _299 => _299.tiles, 'access', _300 => _300.get, 'call', _301 => _301(key), 'optionalAccess', _302 => _302.data]), () => ( new Uint8ClampedArray(_chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4)));
|
|
4929
|
+
const tile = _chunk474IQG74cjs.finishTile.call(void 0, _chunkI7NJPHWVcjs.applyStrokeToTile.call(void 0, coverage, src, 4, tx, ty, apply), 4, 0);
|
|
4902
4930
|
if (tile) tiles.set(key, tile);
|
|
4903
4931
|
else tiles.delete(key);
|
|
4904
4932
|
}
|
|
@@ -4930,7 +4958,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4930
4958
|
}
|
|
4931
4959
|
/** The effect a layer is drawn from, or `undefined` for other layers. */
|
|
4932
4960
|
getEffectLayer(layerId) {
|
|
4933
|
-
return
|
|
4961
|
+
return _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, layerId) ? _optionalChain([this, 'access', _303 => _303.doc, 'access', _304 => _304.effectLayers, 'optionalAccess', _305 => _305[layerId]]) : void 0;
|
|
4934
4962
|
}
|
|
4935
4963
|
/** The effect paper (without its pixels), or `null`. */
|
|
4936
4964
|
getPaperEffect() {
|
|
@@ -4948,7 +4976,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4948
4976
|
if (v === null) merged[k] = d.defaults[k];
|
|
4949
4977
|
else given[k] = v;
|
|
4950
4978
|
}
|
|
4951
|
-
return { ...merged, ...
|
|
4979
|
+
return { ...merged, ..._chunkISIO63Q5cjs.resolveEffectValues.call(void 0, { ...d, defaults: merged }, given) };
|
|
4952
4980
|
}
|
|
4953
4981
|
/** Renders a generator, overlay or title effect at the canvas size. */
|
|
4954
4982
|
renderEffectCanvas(d, values, time = 0) {
|
|
@@ -4967,8 +4995,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
4967
4995
|
/** A pixel layer that takes effect pixels: unlocked, visible, no sticker layer, no wet paint. */
|
|
4968
4996
|
effectTarget(layerId, what) {
|
|
4969
4997
|
const l = this.paintTarget(layerId, what);
|
|
4970
|
-
if (_optionalChain([this, 'access',
|
|
4971
|
-
if (_optionalChain([this, 'access',
|
|
4998
|
+
if (_optionalChain([this, 'access', _306 => _306.doc, 'access', _307 => _307.stickers, 'optionalAccess', _308 => _308[l.id], 'optionalAccess', _309 => _309.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; ${what} another layer (add_layer).`);
|
|
4999
|
+
if (_optionalChain([this, 'access', _310 => _310.doc, 'access', _311 => _311.liveStrokes, 'optionalAccess', _312 => _312[l.id]])) throw new PaintEditorError(`Layer "${l.name}" is a stroke layer (its pixels are drawn from its strokes); ${what} another layer (add_layer), or rasterize it first (rasterize_stroke_layer).`);
|
|
4972
5000
|
if (this.wet.wetLayerIds().includes(l.id)) throw new PaintEditorError(`Layer "${l.name}" holds wet paint; effects go on dried paint, so dry it first (dry_paint) and try again.`);
|
|
4973
5001
|
return l;
|
|
4974
5002
|
}
|
|
@@ -5007,8 +5035,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5007
5035
|
const was = this.doc.paperEffect;
|
|
5008
5036
|
const paperEffect = {
|
|
5009
5037
|
...this.sourceOf(d, values, options.time),
|
|
5010
|
-
opacity: _nullishCoalesce(_nullishCoalesce(options.opacity, () => ( _optionalChain([was, 'optionalAccess',
|
|
5011
|
-
blend: _nullishCoalesce(_nullishCoalesce(options.blend, () => ( _optionalChain([was, 'optionalAccess',
|
|
5038
|
+
opacity: _nullishCoalesce(_nullishCoalesce(options.opacity, () => ( _optionalChain([was, 'optionalAccess', _313 => _313.opacity]))), () => ( 1)),
|
|
5039
|
+
blend: _nullishCoalesce(_nullishCoalesce(options.blend, () => ( _optionalChain([was, 'optionalAccess', _314 => _314.blend]))), () => ( "multiply")),
|
|
5012
5040
|
image: { width: pixels.width, height: pixels.height, data: new Uint8ClampedArray(pixels.data) },
|
|
5013
5041
|
version: nextPaperEffectVersion()
|
|
5014
5042
|
};
|
|
@@ -5052,17 +5080,17 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5052
5080
|
this.requireIdle("adding a layer");
|
|
5053
5081
|
this.checkOpacity(options.opacity);
|
|
5054
5082
|
this.checkTime(options.time);
|
|
5055
|
-
if (options.blend !== void 0 && !
|
|
5083
|
+
if (options.blend !== void 0 && !_chunk2VX55NFMcjs.isBlendMode.call(void 0, options.blend)) throw new PaintEditorError(`Unknown blend mode "${options.blend}". Call get_canvas_info for the blend modes.`);
|
|
5056
5084
|
if (options.aboveId !== void 0) this.requireLayer(options.aboveId);
|
|
5057
5085
|
const d = await this.describeEffect(effect, "layer");
|
|
5058
5086
|
const values = this.effectValues(d, { ...d.defaults }, options.values);
|
|
5059
5087
|
const pixels = await this.renderEffectCanvas(d, values, options.time);
|
|
5060
5088
|
this.requireIdle("adding a layer");
|
|
5061
5089
|
const above = _nullishCoalesce(options.aboveId, () => ( this.doc.activeLayerId));
|
|
5062
|
-
const loc = above ?
|
|
5090
|
+
const loc = above ? _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, above) : null;
|
|
5063
5091
|
if (options.aboveId !== void 0 && !loc) throw new PaintEditorError(`Layer "${options.aboveId}" was removed while the effect rendered.`);
|
|
5064
|
-
const layer = { ...createPaintLayer(_optionalChain([options, 'access',
|
|
5065
|
-
const layers =
|
|
5092
|
+
const layer = { ...createPaintLayer(_optionalChain([options, 'access', _315 => _315.name, 'optionalAccess', _316 => _316.trim, 'call', _317 => _317()]) || d.name), surface: _chunk474IQG74cjs.surfaceFromPixels.call(void 0, pixels, 4), opacity: _nullishCoalesce(options.opacity, () => ( 1)), blend: _nullishCoalesce(options.blend, () => ( "normal")) };
|
|
5093
|
+
const layers = _chunkDPYAO5U6cjs.insertLayer.call(void 0, this.doc.layers, layer, _nullishCoalesce(_optionalChain([loc, 'optionalAccess', _318 => _318.parent, 'optionalAccess', _319 => _319.id]), () => ( null)), loc ? loc.index + 1 : void 0);
|
|
5066
5094
|
const source = this.sourceOf(d, values, options.time);
|
|
5067
5095
|
this.commit("Add effect layer", { ...this.doc, layers, activeLayerId: layer.id, effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [layer.id]: source } });
|
|
5068
5096
|
return { layer: this.describeLayer(layer), source };
|
|
@@ -5086,7 +5114,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5086
5114
|
this.requireIdle("changing an effect layer");
|
|
5087
5115
|
if (!isPixelLayer(now)) throw new PaintEditorError(`Layer "${l.name}" was removed while the effect rendered.`);
|
|
5088
5116
|
const source = this.sourceOf(d, values, time);
|
|
5089
|
-
this.commitOrAmend("Effect layer", { ...this.doc, layers:
|
|
5117
|
+
this.commitOrAmend("Effect layer", { ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...now, surface: _chunk474IQG74cjs.surfaceFromPixels.call(void 0, pixels, 4), offset: { x: 0, y: 0 } })), effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [l.id]: source } }, commitToHistory);
|
|
5090
5118
|
return source;
|
|
5091
5119
|
}
|
|
5092
5120
|
/** Turns an effect layer into a plain pixel layer, keeping its pixels (one undo step). */
|
|
@@ -5114,9 +5142,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5114
5142
|
const rect = this.canvasRectOf(now);
|
|
5115
5143
|
const before = _chunk474IQG74cjs.readRegion.call(void 0, now.surface, rect);
|
|
5116
5144
|
let after = overPixels(before, pixels.data, _nullishCoalesce(options.opacity, () => ( 1)));
|
|
5117
|
-
if (options.lockTransparency ||
|
|
5145
|
+
if (options.lockTransparency || _chunkDPYAO5U6cjs.isLayerLocked.call(void 0, now, "transparency")) after = mixPixels(before, after, 1);
|
|
5118
5146
|
const surface = _chunk474IQG74cjs.writeRegion.call(void 0, now.surface, rect, after);
|
|
5119
|
-
this.commit("Effect fill", { ...this.doc, layers:
|
|
5147
|
+
this.commit("Effect fill", { ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, now.id, () => ({ ...now, surface })) });
|
|
5120
5148
|
return { layerId: now.id, source: this.sourceOf(d, values, options.time) };
|
|
5121
5149
|
}
|
|
5122
5150
|
// --- Effect paint ----------------------------------------------------------------
|
|
@@ -5140,7 +5168,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5140
5168
|
this.checkTime(source.time);
|
|
5141
5169
|
let map;
|
|
5142
5170
|
try {
|
|
5143
|
-
map =
|
|
5171
|
+
map = _chunkGT77U7QGcjs.readEffectStrokeMap.call(void 0, source.map);
|
|
5144
5172
|
} catch (e) {
|
|
5145
5173
|
throw new PaintEditorError(e.message);
|
|
5146
5174
|
}
|
|
@@ -5171,9 +5199,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5171
5199
|
}
|
|
5172
5200
|
/** The rendered pixels of an effect paint at the current canvas size, or `null` when it has not been rendered. */
|
|
5173
5201
|
effectPaintImage(p) {
|
|
5174
|
-
const key =
|
|
5202
|
+
const key = _chunkGT77U7QGcjs.effectPaintKey.call(void 0, p);
|
|
5175
5203
|
const img = this.effectPaintPixels.get(key);
|
|
5176
|
-
const size =
|
|
5204
|
+
const size = _chunkGT77U7QGcjs.effectPaintSize.call(void 0, p, this.doc.canvas);
|
|
5177
5205
|
if (!img || img.width !== size.width || img.height !== size.height) return null;
|
|
5178
5206
|
this.effectPaintPixels.delete(key);
|
|
5179
5207
|
this.effectPaintPixels.set(key, img);
|
|
@@ -5187,7 +5215,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5187
5215
|
const what = `the effect "${p.effect}"${p.provider ? ` from provider "${p.provider}"` : ""}`;
|
|
5188
5216
|
if (!provider) throw new PaintEditorError(`Effect paint needs ${what}, but no effects provider is registered; register it (setEffectsProvider) and try again.`);
|
|
5189
5217
|
if (p.provider && provider.id !== p.provider) throw new PaintEditorError(`Effect paint needs ${what}, but the registered provider is "${provider.id}"; register "${p.provider}" (setEffectsProvider) and try again.`);
|
|
5190
|
-
const { width, height } =
|
|
5218
|
+
const { width, height } = _chunkGT77U7QGcjs.effectPaintSize.call(void 0, p, this.doc.canvas);
|
|
5191
5219
|
let pixels;
|
|
5192
5220
|
try {
|
|
5193
5221
|
pixels = await this.effectsRenderer.render(provider, p.effect, { width, height }, { time: p.time, values: p.values });
|
|
@@ -5195,7 +5223,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5195
5223
|
throw new PaintEditorError(`Effect paint could not render ${what}: ${e instanceof Error ? e.message : String(e)}`);
|
|
5196
5224
|
}
|
|
5197
5225
|
const img = { width, height, data: new Uint8ClampedArray(pixels.data), ...p.map ? { map: p.map } : {} };
|
|
5198
|
-
this.effectPaintPixels.set(
|
|
5226
|
+
this.effectPaintPixels.set(_chunkGT77U7QGcjs.effectPaintKey.call(void 0, p), img);
|
|
5199
5227
|
while (this.effectPaintPixels.size > _PaintEditorController.EFFECT_PAINT_CACHE) this.effectPaintPixels.delete(this.effectPaintPixels.keys().next().value);
|
|
5200
5228
|
return img;
|
|
5201
5229
|
}
|
|
@@ -5206,7 +5234,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5206
5234
|
async prepareEffectPaints(paints) {
|
|
5207
5235
|
const seen = /* @__PURE__ */ new Set();
|
|
5208
5236
|
for (const p of paints) {
|
|
5209
|
-
const key =
|
|
5237
|
+
const key = _chunkGT77U7QGcjs.effectPaintKey.call(void 0, p);
|
|
5210
5238
|
if (seen.has(key)) continue;
|
|
5211
5239
|
seen.add(key);
|
|
5212
5240
|
await this.renderEffectPaint(p);
|
|
@@ -5215,7 +5243,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5215
5243
|
/** Renders the effect paints of recorded strokes (default all of them) before a replay. */
|
|
5216
5244
|
async prepareStrokeEffects(strokeIds) {
|
|
5217
5245
|
const ids = strokeIds ? new Set(strokeIds) : null;
|
|
5218
|
-
const paints = this.doc.strokes.filter((s) => (!ids || ids.has(s.id)) && _optionalChain([s, 'access',
|
|
5246
|
+
const paints = this.doc.strokes.filter((s) => (!ids || ids.has(s.id)) && _optionalChain([s, 'access', _320 => _320.paint, 'optionalAccess', _321 => _321.type]) === "effect").map((s) => s.paint);
|
|
5219
5247
|
await this.prepareEffectPaints(paints);
|
|
5220
5248
|
}
|
|
5221
5249
|
/** A small preview of the effect paint (a PNG data URL `size` px wide), or `null` without a rendered one. */
|
|
@@ -5235,7 +5263,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5235
5263
|
for (let c = 0; c < 4; c++) out[o + c] = img.data[i + c];
|
|
5236
5264
|
}
|
|
5237
5265
|
}
|
|
5238
|
-
return
|
|
5266
|
+
return _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, w, h, out);
|
|
5239
5267
|
}
|
|
5240
5268
|
/**
|
|
5241
5269
|
* The effect paint a stroke paints with and its pixels, or `null`: the stroke's own effect
|
|
@@ -5244,11 +5272,11 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5244
5272
|
* its pixels are not rendered.
|
|
5245
5273
|
*/
|
|
5246
5274
|
strokeEffect(init, brush) {
|
|
5247
|
-
if (!
|
|
5275
|
+
if (!_chunkGT77U7QGcjs.brushTakesPaint.call(void 0, brush)) return null;
|
|
5248
5276
|
let source = null;
|
|
5249
5277
|
if (init.paint !== void 0) {
|
|
5250
|
-
if (!
|
|
5251
|
-
source =
|
|
5278
|
+
if (!_chunkGT77U7QGcjs.isPaintEffectPaint.call(void 0, init.paint)) return null;
|
|
5279
|
+
source = _chunkGT77U7QGcjs.readPaintEffectPaint.call(void 0, init.paint);
|
|
5252
5280
|
if (!source) throw new PaintEditorError("The stroke's effect paint needs an effect id and values (getEffectPaint returns one).");
|
|
5253
5281
|
} else if (init.color === void 0 && !brush.paint) {
|
|
5254
5282
|
if (this.effectPaintPending) throw new PaintEditorError(`The effect paint "${this.effectPaintPending.effect}" is still rendering; wait for set_effect_paint to finish, then paint.`);
|
|
@@ -5278,14 +5306,14 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5278
5306
|
const before = _chunk474IQG74cjs.readRegion.call(void 0, l.surface, rect);
|
|
5279
5307
|
const inputs = { source: { width: rect.width, height: rect.height, data: before } };
|
|
5280
5308
|
const heightInput = d.inputs.find((i) => i.kind === "image" && /^(height|depth|relief)$/i.test(i.name));
|
|
5281
|
-
const relief = _optionalChain([this, 'access',
|
|
5309
|
+
const relief = _optionalChain([this, 'access', _322 => _322.doc, 'access', _323 => _323.thick, 'optionalAccess', _324 => _324[l.id]]);
|
|
5282
5310
|
if (heightInput && relief) {
|
|
5283
5311
|
const h = _chunk474IQG74cjs.readRegion.call(void 0, relief.height, rect);
|
|
5284
5312
|
const rgba = new Uint8ClampedArray(rect.width * rect.height * 4);
|
|
5285
5313
|
for (let i = 0; i < h.length; i++) rgba.set([h[i], h[i], h[i], 255], i * 4);
|
|
5286
5314
|
inputs[heightInput.name] = { width: rect.width, height: rect.height, data: rgba };
|
|
5287
5315
|
}
|
|
5288
|
-
const sourceInput = _nullishCoalesce(_optionalChain([d, 'access',
|
|
5316
|
+
const sourceInput = _nullishCoalesce(_optionalChain([d, 'access', _325 => _325.inputs, 'access', _326 => _326.find, 'call', _327 => _327((i) => i.kind === "image" && i.name !== _optionalChain([heightInput, 'optionalAccess', _328 => _328.name])), 'optionalAccess', _329 => _329.name]), () => ( "source"));
|
|
5289
5317
|
if (sourceInput !== "source") {
|
|
5290
5318
|
inputs[sourceInput] = inputs.source;
|
|
5291
5319
|
delete inputs.source;
|
|
@@ -5293,17 +5321,17 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5293
5321
|
const out = await this.effectsRenderer.render(this.effects.require(), d.id, { width: rect.width, height: rect.height }, { time: _nullishCoalesce(options.time, () => ( 0)), values, inputs });
|
|
5294
5322
|
const now = this.sameLayerAfterRender(l);
|
|
5295
5323
|
const surface = _chunk474IQG74cjs.writeRegion.call(void 0, now.surface, rect, mixPixels(before, out.data, amount));
|
|
5296
|
-
this.commit("Light effect", { ...this.doc, layers:
|
|
5324
|
+
this.commit("Light effect", { ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, now.id, () => ({ ...now, surface })) });
|
|
5297
5325
|
return { layerId: now.id, source: this.sourceOf(d, values, options.time), amount };
|
|
5298
5326
|
}
|
|
5299
5327
|
// --- Brushes -------------------------------------------------------------------
|
|
5300
5328
|
findBrush(id) {
|
|
5301
|
-
return _nullishCoalesce(
|
|
5329
|
+
return _nullishCoalesce(_chunkGT77U7QGcjs.BUILTIN_BRUSHES.find((b) => b.id === id), () => ( this.userBrushes.find((b) => b.id === id)));
|
|
5302
5330
|
}
|
|
5303
5331
|
/** A library brush by id (`undefined` when unknown). */
|
|
5304
5332
|
getBrush(id) {
|
|
5305
5333
|
const b = this.findBrush(id);
|
|
5306
|
-
return b ?
|
|
5334
|
+
return b ? _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, b, b) : void 0;
|
|
5307
5335
|
}
|
|
5308
5336
|
requireBrush(id) {
|
|
5309
5337
|
const b = this.findBrush(id);
|
|
@@ -5318,19 +5346,20 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5318
5346
|
const { id, ...changes } = update;
|
|
5319
5347
|
const base = id !== void 0 ? this.requireBrush(id) : this.brush;
|
|
5320
5348
|
if (changes.paint !== void 0 && changes.paint !== null) this.readStrokePaint(changes.paint);
|
|
5321
|
-
const next =
|
|
5349
|
+
const next = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { ...changes, id: base.id }, base);
|
|
5322
5350
|
if (base.builtin && !Object.keys(changes).length) next.builtin = true;
|
|
5323
5351
|
else delete next.builtin;
|
|
5324
5352
|
this.brush = next;
|
|
5325
5353
|
this.emit([]);
|
|
5354
|
+
if (next.engine === "sticker" && next.sticker.stamps.some((r) => !_chunk4JNWA3VTcjs.editorStampOf.call(void 0, r))) void this.prepareStickers(next.sticker.stamps).catch(() => this.emit([]));
|
|
5326
5355
|
return this.brush;
|
|
5327
5356
|
}
|
|
5328
5357
|
/** Saves the active brush (or `brush`) into the user library under `id` / `name`. */
|
|
5329
5358
|
saveBrush(options) {
|
|
5330
|
-
if (!
|
|
5331
|
-
if (
|
|
5332
|
-
const source = options.brush ?
|
|
5333
|
-
const saved =
|
|
5359
|
+
if (!_chunkGT77U7QGcjs.BRUSH_ID.test(options.id)) throw new PaintEditorError(`Brush id "${options.id}" is invalid; use lowercase letters, digits and dashes (e.g. "my-pencil").`);
|
|
5360
|
+
if (_chunkGT77U7QGcjs.BUILTIN_BRUSHES.some((b) => b.id === options.id)) throw new PaintEditorError(`"${options.id}" is a built-in brush; save under another id.`);
|
|
5361
|
+
const source = options.brush ? _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, options.brush, this.brush) : this.brush;
|
|
5362
|
+
const saved = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { ...source, id: options.id, name: _nullishCoalesce(options.name, () => ( source.name)) });
|
|
5334
5363
|
delete saved.builtin;
|
|
5335
5364
|
const i = this.userBrushes.findIndex((b) => b.id === options.id);
|
|
5336
5365
|
if (i >= 0) this.userBrushes[i] = saved;
|
|
@@ -5340,7 +5369,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5340
5369
|
return saved;
|
|
5341
5370
|
}
|
|
5342
5371
|
removeBrush(id) {
|
|
5343
|
-
if (
|
|
5372
|
+
if (_chunkGT77U7QGcjs.BUILTIN_BRUSHES.some((b) => b.id === id)) throw new PaintEditorError(`"${id}" is a built-in brush and cannot be removed.`);
|
|
5344
5373
|
const i = this.userBrushes.findIndex((b) => b.id === id);
|
|
5345
5374
|
if (i < 0) throw new PaintEditorError(`Unknown brush "${id}". Call list_brushes for the ids.`);
|
|
5346
5375
|
this.userBrushes.splice(i, 1);
|
|
@@ -5349,12 +5378,12 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5349
5378
|
}
|
|
5350
5379
|
/** The user's saved brushes. */
|
|
5351
5380
|
getUserBrushes() {
|
|
5352
|
-
return this.userBrushes.map((b) =>
|
|
5381
|
+
return this.userBrushes.map((b) => _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, b, b));
|
|
5353
5382
|
}
|
|
5354
5383
|
/** A brush library file of the given brushes (default: the user's brushes). */
|
|
5355
5384
|
exportBrushes(ids) {
|
|
5356
5385
|
const list = ids ? ids.map((id) => this.requireBrush(id)) : this.userBrushes;
|
|
5357
|
-
return { format: "pixerate-brushes", version: 1, brushes: list.map(
|
|
5386
|
+
return { format: "pixerate-brushes", version: 1, brushes: list.map(_chunkGT77U7QGcjs.brushToJSON) };
|
|
5358
5387
|
}
|
|
5359
5388
|
/**
|
|
5360
5389
|
* Adds the brushes of a library file to the user library. A brush whose id is taken is skipped
|
|
@@ -5364,14 +5393,14 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5364
5393
|
const problems = [];
|
|
5365
5394
|
let list;
|
|
5366
5395
|
try {
|
|
5367
|
-
list =
|
|
5396
|
+
list = _chunkGT77U7QGcjs.parseBrushLibrary.call(void 0, file, problems);
|
|
5368
5397
|
} catch (e) {
|
|
5369
5398
|
throw new PaintEditorError(e.message);
|
|
5370
5399
|
}
|
|
5371
5400
|
const added = [];
|
|
5372
5401
|
const skipped = [];
|
|
5373
5402
|
for (const b of list) {
|
|
5374
|
-
if (
|
|
5403
|
+
if (_chunkGT77U7QGcjs.BUILTIN_BRUSHES.some((x) => x.id === b.id)) {
|
|
5375
5404
|
skipped.push(b.id);
|
|
5376
5405
|
problems.push(`"${b.id}" is a built-in brush id; rename it to import it.`);
|
|
5377
5406
|
continue;
|
|
@@ -5415,9 +5444,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5415
5444
|
setPaint(paint) {
|
|
5416
5445
|
let p;
|
|
5417
5446
|
try {
|
|
5418
|
-
p =
|
|
5447
|
+
p = _chunkI7NJPHWVcjs.parsePaintSource.call(void 0, paint);
|
|
5419
5448
|
} catch (e) {
|
|
5420
|
-
if (e instanceof
|
|
5449
|
+
if (e instanceof _chunkI7NJPHWVcjs.PaintSourceError) throw new PaintEditorError(e.message);
|
|
5421
5450
|
throw e;
|
|
5422
5451
|
}
|
|
5423
5452
|
if (p.type === "color") {
|
|
@@ -5436,20 +5465,20 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5436
5465
|
* brush's gradient, else the editor's gradient paint. Erasers, blenders and smudges take none.
|
|
5437
5466
|
*/
|
|
5438
5467
|
strokeGradient(init, brush, color) {
|
|
5439
|
-
if (!
|
|
5468
|
+
if (!_chunkGT77U7QGcjs.brushTakesPaint.call(void 0, brush)) return null;
|
|
5440
5469
|
let g = null;
|
|
5441
5470
|
if (init.paint !== void 0) {
|
|
5442
|
-
if (
|
|
5471
|
+
if (_chunkGT77U7QGcjs.isPaintEffectPaint.call(void 0, init.paint)) return null;
|
|
5443
5472
|
const p = this.readStrokePaint(init.paint);
|
|
5444
5473
|
g = p.type === "gradient" ? p : null;
|
|
5445
5474
|
} else g = _nullishCoalesce(brush.paint, () => ( (init.color === void 0 ? this.gradient : null)));
|
|
5446
|
-
return g ?
|
|
5475
|
+
return g ? _chunkI7NJPHWVcjs.resolvePaintGradient.call(void 0, g, { paint: color, secondary: this.secondaryColor }) : null;
|
|
5447
5476
|
}
|
|
5448
5477
|
readStrokePaint(raw) {
|
|
5449
5478
|
try {
|
|
5450
|
-
return
|
|
5479
|
+
return _chunkI7NJPHWVcjs.parsePaintSource.call(void 0, raw);
|
|
5451
5480
|
} catch (e) {
|
|
5452
|
-
if (e instanceof
|
|
5481
|
+
if (e instanceof _chunkI7NJPHWVcjs.PaintSourceError) throw new PaintEditorError(e.message);
|
|
5453
5482
|
throw e;
|
|
5454
5483
|
}
|
|
5455
5484
|
}
|
|
@@ -5483,14 +5512,14 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5483
5512
|
// --- Mixer Brush ---------------------------------------------------------------
|
|
5484
5513
|
/** Fills the Mixer Brush reservoir with a colour (default the editor colour). */
|
|
5485
5514
|
loadMixerBrush(color) {
|
|
5486
|
-
const [r, g, b] =
|
|
5487
|
-
this.mixerLoad =
|
|
5515
|
+
const [r, g, b] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, color === void 0 ? this.color : parseColor(color));
|
|
5516
|
+
this.mixerLoad = _chunkI7NJPHWVcjs.loadMixer.call(void 0, this.mixerLoad, [r / 255, g / 255, b / 255]);
|
|
5488
5517
|
this.emit([]);
|
|
5489
5518
|
return this.mixerLoad;
|
|
5490
5519
|
}
|
|
5491
5520
|
/** Empties the pickup well (and with `emptyReservoir` the loaded paint too). */
|
|
5492
5521
|
cleanMixerBrush(emptyReservoir = false) {
|
|
5493
|
-
this.mixerLoad = emptyReservoir ?
|
|
5522
|
+
this.mixerLoad = emptyReservoir ? _chunkI7NJPHWVcjs.EMPTY_MIXER_LOAD : _chunkI7NJPHWVcjs.cleanMixer.call(void 0, this.mixerLoad);
|
|
5494
5523
|
this.emit([]);
|
|
5495
5524
|
return this.mixerLoad;
|
|
5496
5525
|
}
|
|
@@ -5513,7 +5542,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5513
5542
|
// --- Strokes -------------------------------------------------------------------
|
|
5514
5543
|
strokeBrush(init) {
|
|
5515
5544
|
let brush = init.brushId !== void 0 ? this.requireBrush(init.brushId) : this.brush;
|
|
5516
|
-
if (init.brush) brush =
|
|
5545
|
+
if (init.brush) brush = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { ...init.brush, id: brush.id }, brush);
|
|
5517
5546
|
return brush;
|
|
5518
5547
|
}
|
|
5519
5548
|
/**
|
|
@@ -5529,7 +5558,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5529
5558
|
return symmetryCopies(this.guides.symmetry);
|
|
5530
5559
|
}
|
|
5531
5560
|
sessionFor(doc, init, host) {
|
|
5532
|
-
if (init.paint !== void 0 && !
|
|
5561
|
+
if (init.paint !== void 0 && !_chunkGT77U7QGcjs.isPaintEffectPaint.call(void 0, init.paint)) {
|
|
5533
5562
|
const p = this.readStrokePaint(init.paint);
|
|
5534
5563
|
if (p.type === "color") init = { ...init, color: p.color, paint: void 0 };
|
|
5535
5564
|
else init = { ...init, paint: p };
|
|
@@ -5537,11 +5566,11 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5537
5566
|
let layer = (() => {
|
|
5538
5567
|
const id = _nullishCoalesce(init.layerId, () => ( doc.activeLayerId));
|
|
5539
5568
|
if (!id) throw new PaintEditorError("There is no active layer to paint on; add one with add_layer.");
|
|
5540
|
-
const loc =
|
|
5569
|
+
const loc = _chunkDPYAO5U6cjs.findLayer.call(void 0, doc.layers, id);
|
|
5541
5570
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
5542
5571
|
const l = loc.layer;
|
|
5543
5572
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; paint on a pixel layer inside it.`);
|
|
5544
|
-
if (
|
|
5573
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it (update_layer locks) to paint on it.`);
|
|
5545
5574
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) to paint on it.`);
|
|
5546
5575
|
return l;
|
|
5547
5576
|
})();
|
|
@@ -5550,43 +5579,43 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5550
5579
|
if (brush.light.amount > 0) {
|
|
5551
5580
|
if (brush.engine === "sticker") throw new PaintEditorError(`The ${brush.name} brush sprays stickers, which don't take light yet; paint light with a dab or particle light brush (list_brushes category light), or set light.amount to 0 (set_brush).`);
|
|
5552
5581
|
}
|
|
5553
|
-
if (_optionalChain([doc, 'access',
|
|
5582
|
+
if (_optionalChain([doc, 'access', _330 => _330.liveStrokes, 'optionalAccess', _331 => _331[layer.id]])) {
|
|
5554
5583
|
const why = liveStrokeRefusal(brush);
|
|
5555
5584
|
if (why) throw new PaintEditorError(`Layer "${layer.name}" is a stroke layer. ${why}`);
|
|
5556
5585
|
}
|
|
5557
|
-
if (_optionalChain([doc, 'access',
|
|
5558
|
-
const key =
|
|
5586
|
+
if (_optionalChain([doc, 'access', _332 => _332.liveStrokes, 'optionalAccess', _333 => _333[layer.id]]) && _optionalChain([effect, 'optionalAccess', _334 => _334.source, 'access', _335 => _335.live])) {
|
|
5587
|
+
const key = _chunkGT77U7QGcjs.effectPaintKey.call(void 0, effect.source);
|
|
5559
5588
|
const { sources } = this.liveEffects(doc);
|
|
5560
|
-
if (!sources.some((p) =>
|
|
5589
|
+
if (!sources.some((p) => _chunkGT77U7QGcjs.effectPaintKey.call(void 0, p) === key) && sources.length >= MAX_LIVE_EFFECT_SOURCES) {
|
|
5561
5590
|
throw new PaintEditorError(`The painting already plays ${MAX_LIVE_EFFECT_SOURCES} live effects, the most it can; paint with one of them, or set_effect_paint with live false to bake this one.`);
|
|
5562
5591
|
}
|
|
5563
5592
|
}
|
|
5564
|
-
const stickerLayer = Boolean(_optionalChain([doc, 'access',
|
|
5593
|
+
const stickerLayer = Boolean(_optionalChain([doc, 'access', _336 => _336.stickers, 'optionalAccess', _337 => _337[layer.id], 'optionalAccess', _338 => _338.length]));
|
|
5565
5594
|
if (brush.engine === "sticker") {
|
|
5566
5595
|
if (!stickerLayer && _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface)) throw new PaintEditorError(`Layer "${layer.name}" already has paint; spray stickers onto an empty layer (add_layer) so they stay editable.`);
|
|
5567
5596
|
} else if (stickerLayer) {
|
|
5568
5597
|
throw new PaintEditorError(`Layer "${layer.name}" is a sticker layer (its pixels are drawn from its stickers); paint on another layer (add_layer).`);
|
|
5569
5598
|
}
|
|
5570
5599
|
let wet;
|
|
5571
|
-
if (
|
|
5600
|
+
if (_chunkGT77U7QGcjs.isWetBrush.call(void 0, brush)) {
|
|
5572
5601
|
this.requireWetIdle("painting");
|
|
5573
5602
|
if (layer.offset.x || layer.offset.y) {
|
|
5574
5603
|
const moved = { ...layer, surface: _chunk474IQG74cjs.translateSurface.call(void 0, layer.surface, layer.offset.x, layer.offset.y), offset: { x: 0, y: 0 } };
|
|
5575
|
-
this.doc = { ...this.doc, layers:
|
|
5576
|
-
if (doc !== this.doc) doc = { ...doc, layers:
|
|
5604
|
+
this.doc = { ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => moved) };
|
|
5605
|
+
if (doc !== this.doc) doc = { ...doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, doc.layers, layer.id, () => moved) };
|
|
5577
5606
|
layer = moved;
|
|
5578
5607
|
}
|
|
5579
|
-
if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >=
|
|
5580
|
-
throw new PaintEditorError(`At most ${
|
|
5608
|
+
if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >= _chunkKBYB7OWBcjs.MAX_WET_LANES) {
|
|
5609
|
+
throw new PaintEditorError(`At most ${_chunkKBYB7OWBcjs.MAX_WET_LANES} layers can hold wet paint at once; dry one first (dry_paint).`);
|
|
5581
5610
|
}
|
|
5582
5611
|
this.beginWetOp();
|
|
5583
5612
|
const world = this.wet.ensureLane(layer.id, brush.wet.medium);
|
|
5584
5613
|
const id = layer.id;
|
|
5585
5614
|
const wetColor = init.color === void 0 ? this.color : parseColor(init.color);
|
|
5586
|
-
const [r, g, b] =
|
|
5615
|
+
const [r, g, b] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, wetColor);
|
|
5587
5616
|
const wetGradient = this.strokeGradient(init, brush, wetColor);
|
|
5588
5617
|
const load = _nullishCoalesce(init.load, () => ( brushLoadForStroke(brush, this.mixerLoad, [r / 255, g / 255, b / 255])));
|
|
5589
|
-
const seedW = _nullishCoalesce(init.seed, () => (
|
|
5618
|
+
const seedW = _nullishCoalesce(init.seed, () => ( _chunk3K6HWEXZcjs.mix32.call(void 0, this.seedCounter * 2654435761 >>> 0) & 2147483647));
|
|
5590
5619
|
const copiesW = (_nullishCoalesce(init.copies, () => ( this.strokeCopies()))).filter((m) => m.some((v, i) => v !== IDENTITY_AFFINE[i]));
|
|
5591
5620
|
const driver = new WetStrokeDriver({
|
|
5592
5621
|
world,
|
|
@@ -5596,23 +5625,23 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5596
5625
|
load,
|
|
5597
5626
|
grain: paperGrain(doc.paper),
|
|
5598
5627
|
paperDepth: doc.paper.depth,
|
|
5599
|
-
paperColor:
|
|
5628
|
+
paperColor: _chunkGT77U7QGcjs.hexToRgb8.call(void 0, doc.paper.color),
|
|
5600
5629
|
seed: seedW,
|
|
5601
5630
|
copies: [IDENTITY_AFFINE, ...copiesW].map(affineCopy),
|
|
5602
5631
|
mask: init.maskStencils ? this.stencilSelection(init.maskStencils) : init.stencils !== false ? this.stencilSelection() : null,
|
|
5603
5632
|
paint: effect ? null : wetGradient,
|
|
5604
|
-
effect: _nullishCoalesce(_optionalChain([effect, 'optionalAccess',
|
|
5633
|
+
effect: _nullishCoalesce(_optionalChain([effect, 'optionalAccess', _339 => _339.pixels]), () => ( null))
|
|
5605
5634
|
});
|
|
5606
5635
|
init = { ...init, seed: seedW, load };
|
|
5607
5636
|
wet = { driver, surface: () => world.display(id).surface };
|
|
5608
5637
|
} else if (this.wet.wetLayerIds().includes(layer.id)) {
|
|
5609
5638
|
this.dryLayersFirst([layer.id]);
|
|
5610
|
-
const dried =
|
|
5639
|
+
const dried = _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, layer.id).layer;
|
|
5611
5640
|
layer = dried;
|
|
5612
5641
|
}
|
|
5613
5642
|
let color = init.color === void 0 ? this.color : parseColor(init.color);
|
|
5614
5643
|
const tracing = this.guides.tracing;
|
|
5615
|
-
if (init.color === void 0 && init.start && _optionalChain([tracing, 'optionalAccess',
|
|
5644
|
+
if (init.color === void 0 && init.start && _optionalChain([tracing, 'optionalAccess', _340 => _340.visible]) && tracing.sampleColors) color = _nullishCoalesce(this.sampleTracingColor(init.start.x, init.start.y), () => ( color));
|
|
5616
5645
|
const perspective = this.guides.perspective;
|
|
5617
5646
|
const snapper = init.snapToPerspective && perspective.enabled && perspective.snap ? new PerspectiveSnapper(perspective) : null;
|
|
5618
5647
|
const useStencils = init.stencils !== false;
|
|
@@ -5624,13 +5653,13 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5624
5653
|
const selection = brush.engine === "sticker" ? null : init.maskStencils ? this.stencilSelection(init.maskStencils) : useStencils ? this.stencilSelection() : null;
|
|
5625
5654
|
const inputFilter = snapper || stencilSnapper ? (p) => stencilSnapper ? stencilSnapper.snap(snapper ? snapper.snap(p) : p) : snapper.snap(p) : void 0;
|
|
5626
5655
|
const rgba = rgbaOf(color);
|
|
5627
|
-
const seed = _nullishCoalesce(init.seed, () => (
|
|
5656
|
+
const seed = _nullishCoalesce(init.seed, () => ( _chunk3K6HWEXZcjs.mix32.call(void 0, this.seedCounter++ * 2654435761 >>> 0) & 2147483647));
|
|
5628
5657
|
const copies = (_nullishCoalesce(init.copies, () => ( this.strokeCopies()))).filter((m) => m.some((v, i) => v !== IDENTITY_AFFINE[i]));
|
|
5629
5658
|
const session = new PaintStrokeSession(host, {
|
|
5630
5659
|
layerId: layer.id,
|
|
5631
5660
|
surface: layer.surface,
|
|
5632
5661
|
offset: layer.offset,
|
|
5633
|
-
lockTransparency:
|
|
5662
|
+
lockTransparency: _chunkDPYAO5U6cjs.isLayerLocked.call(void 0, layer, "transparency"),
|
|
5634
5663
|
brush,
|
|
5635
5664
|
color: rgba,
|
|
5636
5665
|
background: rgbaOf(doc.paper.color),
|
|
@@ -5645,10 +5674,10 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5645
5674
|
mixerLoad: _nullishCoalesce(init.load, () => ( brushLoadForStroke(brush, this.mixerLoad, [rgba[0] / 255, rgba[1] / 255, rgba[2] / 255]))),
|
|
5646
5675
|
secondary: rgbaOf(this.secondaryColor),
|
|
5647
5676
|
wet,
|
|
5648
|
-
thick: brush.engine === "impasto" ? { channels: _nullishCoalesce(_optionalChain([doc, 'access',
|
|
5677
|
+
thick: brush.engine === "impasto" ? { channels: _nullishCoalesce(_optionalChain([doc, 'access', _341 => _341.thick, 'optionalAccess', _342 => _342[layer.id]]), () => ( emptyThickChannels())) } : void 0,
|
|
5649
5678
|
// Light paint: a twin of the stroke paints the light channel (laying, dimming, moving light).
|
|
5650
|
-
light: !wet && brush.engine !== "sticker" && (brush.light.amount > 0 || _optionalChain([doc, 'access',
|
|
5651
|
-
sticker: brush.engine === "sticker" ? { nextId: this.nextStickerNumber(doc) } : void 0,
|
|
5679
|
+
light: !wet && brush.engine !== "sticker" && (brush.light.amount > 0 || _optionalChain([doc, 'access', _343 => _343.light, 'optionalAccess', _344 => _344[layer.id]])) ? { surface: _nullishCoalesce(_optionalChain([doc, 'access', _345 => _345.light, 'optionalAccess', _346 => _346[layer.id]]), () => ( emptyLight())) } : null,
|
|
5680
|
+
sticker: brush.engine === "sticker" ? { nextId: this.nextStickerNumber(doc), art: this.stickerArt.get } : void 0,
|
|
5652
5681
|
paint: effect ? null : this.strokeGradient(init, brush, color),
|
|
5653
5682
|
effect
|
|
5654
5683
|
});
|
|
@@ -5661,7 +5690,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5661
5690
|
const stroke = {
|
|
5662
5691
|
id: `s${this.strokeCounter++}`,
|
|
5663
5692
|
layerId: session.layerId,
|
|
5664
|
-
brush:
|
|
5693
|
+
brush: _chunkGT77U7QGcjs.brushToJSON.call(void 0, init.brush),
|
|
5665
5694
|
color: init.colorHex,
|
|
5666
5695
|
points: session.points.map((p) => ({ ...p })),
|
|
5667
5696
|
seed: init.seed
|
|
@@ -5686,12 +5715,12 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5686
5715
|
const before = this.doc;
|
|
5687
5716
|
const host = {
|
|
5688
5717
|
update: (layerId, surface, rects) => {
|
|
5689
|
-
if (_optionalChain([this, 'access',
|
|
5718
|
+
if (_optionalChain([this, 'access', _347 => _347.session, 'optionalAccess', _348 => _348.init, 'access', _349 => _349.wet])) {
|
|
5690
5719
|
this.wet.syncDisplays();
|
|
5691
5720
|
return;
|
|
5692
5721
|
}
|
|
5693
5722
|
this.live = { layerId, surface };
|
|
5694
|
-
const ch = _optionalChain([this, 'access',
|
|
5723
|
+
const ch = _optionalChain([this, 'access', _350 => _350.session, 'optionalAccess', _351 => _351.thickChannels, 'call', _352 => _352()]);
|
|
5695
5724
|
this.liveThick = ch ? { layerId, channels: ch } : null;
|
|
5696
5725
|
this.emit(rects);
|
|
5697
5726
|
},
|
|
@@ -5703,7 +5732,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5703
5732
|
const wetStroke = Boolean(s.init.wet);
|
|
5704
5733
|
if (wetStroke) this.wet.driver = null;
|
|
5705
5734
|
const brush = s.init.brush;
|
|
5706
|
-
if (!cancelled && _optionalChain([s, 'access',
|
|
5735
|
+
if (!cancelled && _optionalChain([s, 'access', _353 => _353.result, 'optionalAccess', _354 => _354.mixerLoad])) this.keepLoad(brush, s.result.mixerLoad);
|
|
5707
5736
|
if (cancelled || !surface) {
|
|
5708
5737
|
if (this.wetOp) {
|
|
5709
5738
|
const snap = this.wetOp.before;
|
|
@@ -5718,7 +5747,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5718
5747
|
}
|
|
5719
5748
|
const stroke = this.record(s);
|
|
5720
5749
|
s.result.strokeId = stroke.id;
|
|
5721
|
-
this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access',
|
|
5750
|
+
this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _355 => _355.result, 'optionalAccess', _356 => _356.bounds]), () => ( null)));
|
|
5722
5751
|
if (wetStroke && this.wet.instantDry) {
|
|
5723
5752
|
this.wet.dry(s.layerId);
|
|
5724
5753
|
this.logWet({ kind: "dry", layerId: s.layerId, at: this.doc.strokes.length + 1 });
|
|
@@ -5729,10 +5758,10 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5729
5758
|
const ch = s.thickChannels();
|
|
5730
5759
|
const thick = ch ? { ..._nullishCoalesce(this.doc.thick, () => ( {})), [l.id]: ch } : this.doc.thick;
|
|
5731
5760
|
const sprayed = s.stickers();
|
|
5732
|
-
const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access',
|
|
5733
|
-
const wetLight = wetStroke && _optionalChain([this, 'access',
|
|
5761
|
+
const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _357 => _357.doc, 'access', _358 => _358.stickers, 'optionalAccess', _359 => _359[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
|
|
5762
|
+
const wetLight = wetStroke && _optionalChain([this, 'access', _360 => _360.wet, 'access', _361 => _361.world, 'optionalAccess', _362 => _362.hasLane, 'call', _363 => _363(l.id)]) ? this.wet.world.lightDisplay(l.id) : null;
|
|
5734
5763
|
const light = withLayerLight(this.doc.light, l.id, _nullishCoalesce(s.lightChannel(), () => ( wetLight)));
|
|
5735
|
-
this.commit(`${brush.name} stroke`, this.withWetEvents(withLiveStroke({ ...this.doc, layers:
|
|
5764
|
+
this.commit(`${brush.name} stroke`, this.withWetEvents(withLiveStroke({ ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke], ...thick ? { thick } : {}, ...stickers ? { stickers } : {}, ...light ? { light } : {} }, stroke)), wetStroke ? before : this.doc);
|
|
5736
5765
|
}
|
|
5737
5766
|
};
|
|
5738
5767
|
let session;
|
|
@@ -5760,18 +5789,18 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5760
5789
|
if (cancelled || !surface) return;
|
|
5761
5790
|
const stroke = this.record(s);
|
|
5762
5791
|
s.result.strokeId = stroke.id;
|
|
5763
|
-
this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access',
|
|
5764
|
-
const l =
|
|
5792
|
+
this.paintedBounds.set(stroke, _nullishCoalesce(_optionalChain([s, 'access', _364 => _364.result, 'optionalAccess', _365 => _365.bounds]), () => ( null)));
|
|
5793
|
+
const l = _chunkDPYAO5U6cjs.findLayer.call(void 0, out.layers, s.layerId).layer;
|
|
5765
5794
|
const offset = s.init.wet ? { x: 0, y: 0 } : l.offset;
|
|
5766
5795
|
const ch = s.thickChannels();
|
|
5767
5796
|
const sprayed = s.stickers();
|
|
5768
|
-
const lit = _nullishCoalesce(s.lightChannel(), () => ( (s.init.wet && _optionalChain([this, 'access',
|
|
5797
|
+
const lit = _nullishCoalesce(s.lightChannel(), () => ( (s.init.wet && _optionalChain([this, 'access', _366 => _366.wet, 'access', _367 => _367.world, 'optionalAccess', _368 => _368.hasLane, 'call', _369 => _369(l.id)]) ? this.wet.world.lightDisplay(l.id) : null)));
|
|
5769
5798
|
out = withLiveStroke({
|
|
5770
5799
|
...out,
|
|
5771
|
-
layers:
|
|
5800
|
+
layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface, offset })),
|
|
5772
5801
|
strokes: [...out.strokes, stroke],
|
|
5773
5802
|
...ch ? { thick: { ..._nullishCoalesce(out.thick, () => ( {})), [l.id]: ch } } : {},
|
|
5774
|
-
...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access',
|
|
5803
|
+
...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _370 => _370.stickers, 'optionalAccess', _371 => _371[l.id]]), () => ( [])), ...sprayed] } } : {},
|
|
5775
5804
|
...lit ? { light: withLayerLight(out.light, l.id, lit) } : {}
|
|
5776
5805
|
}, stroke);
|
|
5777
5806
|
}
|
|
@@ -5784,8 +5813,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5784
5813
|
if (this.wet.instantDry && result.strokeId) {
|
|
5785
5814
|
this.wet.dry(session.layerId);
|
|
5786
5815
|
this.logWet({ kind: "dry", layerId: session.layerId, at: out.strokes.length });
|
|
5787
|
-
const dried =
|
|
5788
|
-
out = { ...out, layers:
|
|
5816
|
+
const dried = _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, session.layerId).layer.surface;
|
|
5817
|
+
out = { ...out, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, out.layers, session.layerId, (l) => ({ ...l, surface: dried })) };
|
|
5789
5818
|
}
|
|
5790
5819
|
result.wet = this.wet.isWet(session.layerId);
|
|
5791
5820
|
}
|
|
@@ -5830,7 +5859,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5830
5859
|
*/
|
|
5831
5860
|
replayStrokes(options) {
|
|
5832
5861
|
this.requireIdle("replaying");
|
|
5833
|
-
if (!_optionalChain([options, 'access',
|
|
5862
|
+
if (!_optionalChain([options, 'access', _372 => _372.strokeIds, 'optionalAccess', _373 => _373.length])) throw new PaintEditorError("strokeIds is empty; pass ids from list_strokes.");
|
|
5834
5863
|
const strokes = options.strokeIds.map((id) => {
|
|
5835
5864
|
const s = this.doc.strokes.find((x) => x.id === id);
|
|
5836
5865
|
if (!s) throw new PaintEditorError(`Unknown stroke "${id}". Call list_strokes for the ids.`);
|
|
@@ -5844,7 +5873,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5844
5873
|
if (options.layerId !== void 0) this.paintTarget(options.layerId, "replay onto");
|
|
5845
5874
|
if (options.color === void 0) {
|
|
5846
5875
|
for (const s of strokes) {
|
|
5847
|
-
if (_optionalChain([s, 'access',
|
|
5876
|
+
if (_optionalChain([s, 'access', _374 => _374.paint, 'optionalAccess', _375 => _375.type]) === "effect" && !this.effectPaintImage(s.paint)) {
|
|
5848
5877
|
throw new PaintEditorError(`Stroke "${s.id}" paints with the effect "${s.paint.effect}"${s.paint.provider ? ` from provider "${s.paint.provider}"` : ""}, which is not rendered in this editor; render it first (prepareStrokeEffects; the replay_strokes tool does this) or recolour the replay with color.`);
|
|
5849
5878
|
}
|
|
5850
5879
|
}
|
|
@@ -5867,13 +5896,13 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5867
5896
|
let brush = v.brush;
|
|
5868
5897
|
if (options.brushId !== void 0) {
|
|
5869
5898
|
const b = this.requireBrush(options.brushId);
|
|
5870
|
-
brush =
|
|
5899
|
+
brush = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
|
|
5871
5900
|
}
|
|
5872
5901
|
const layerId = _nullishCoalesce(options.layerId, () => ( s.layerId));
|
|
5873
|
-
if (!
|
|
5902
|
+
if (!_chunkDPYAO5U6cjs.findLayer.call(void 0, doc.layers, layerId)) throw new PaintEditorError(`Stroke "${s.id}" was painted on layer "${layerId}", which no longer exists; pass layerId to replay it elsewhere.`);
|
|
5874
5903
|
let load = s.load;
|
|
5875
5904
|
if (load && options.color !== void 0 && load.reservoir) {
|
|
5876
|
-
const [r, g, b] =
|
|
5905
|
+
const [r, g, b] = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, options.color);
|
|
5877
5906
|
load = { ...load, reservoir: [r / 255, g / 255, b / 255] };
|
|
5878
5907
|
}
|
|
5879
5908
|
const paint = v.paint && options.color === void 0 ? { paint: v.paint } : {};
|
|
@@ -5902,7 +5931,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5902
5931
|
/** A layer's light paint: whether it has any, where (document pixels), its brightest value 0..255, and its spill. */
|
|
5903
5932
|
lightOf(layerId) {
|
|
5904
5933
|
const l = this.wetLayer(layerId, "read the light of");
|
|
5905
|
-
const info = lightInfo(_optionalChain([this, 'access',
|
|
5934
|
+
const info = lightInfo(_optionalChain([this, 'access', _376 => _376.doc, 'access', _377 => _377.light, 'optionalAccess', _378 => _378[l.id]]));
|
|
5906
5935
|
const bounds = info.bounds ? { ...info.bounds, x: info.bounds.x + l.offset.x, y: info.bounds.y + l.offset.y } : null;
|
|
5907
5936
|
return { layerId: l.id, hasLight: info.peak > 0, bounds, peak: info.peak, spill: { ...this.lightSpillOf(l.id) } };
|
|
5908
5937
|
}
|
|
@@ -5953,7 +5982,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
5953
5982
|
const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
|
|
5954
5983
|
if (!id) return null;
|
|
5955
5984
|
this.requireLayer(id);
|
|
5956
|
-
const ch = _optionalChain([this, 'access',
|
|
5985
|
+
const ch = _optionalChain([this, 'access', _379 => _379.doc, 'access', _380 => _380.thick, 'optionalAccess', _381 => _381[id]]);
|
|
5957
5986
|
if (!ch) return null;
|
|
5958
5987
|
const r = reliefInfo(ch);
|
|
5959
5988
|
return { layerId: id, bounds: r.bounds, maxHeight: r.maxHeight };
|
|
@@ -6008,7 +6037,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6008
6037
|
/** `renderHighRes` as PNG bytes. */
|
|
6009
6038
|
async exportHighResPng(options) {
|
|
6010
6039
|
const img = await this.renderHighRes(options);
|
|
6011
|
-
return
|
|
6040
|
+
return _chunkW5M3J7PVcjs.encodePng.call(void 0, img.width, img.height, img.data);
|
|
6012
6041
|
}
|
|
6013
6042
|
async renderHighRes(options) {
|
|
6014
6043
|
const target = this.createReplayTarget(options.scale);
|
|
@@ -6061,7 +6090,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6061
6090
|
wetState() {
|
|
6062
6091
|
const st = this.getState().wet;
|
|
6063
6092
|
const backend = this.wet.backend();
|
|
6064
|
-
return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess',
|
|
6093
|
+
return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess', _382 => _382.message]), () => ( _chunkKBYB7OWBcjs.wetSupport.call(void 0, ).message)), engine: this.wet.engineInfo() };
|
|
6065
6094
|
}
|
|
6066
6095
|
/**
|
|
6067
6096
|
* Engine B, the WebGPU accelerator for large wet areas: whether it may run, its state (`off`,
|
|
@@ -6130,11 +6159,11 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6130
6159
|
wetPaper(options = {}) {
|
|
6131
6160
|
this.requireIdle("wetting the paper");
|
|
6132
6161
|
const l = this.wetLayer(options.layerId, "wet the paper of");
|
|
6133
|
-
if (
|
|
6162
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it first.`);
|
|
6134
6163
|
const amount = _nullishCoalesce(options.amount, () => ( 1));
|
|
6135
6164
|
if (!(amount > 0 && amount <= 1)) throw new PaintEditorError(`amount ${amount} is out of range; use above 0 up to 1.`);
|
|
6136
6165
|
const rect = _nullishCoalesce(this.checkRect(options.rect), () => ( { x: 0, y: 0, width: this.doc.canvas.width, height: this.doc.canvas.height }));
|
|
6137
|
-
if (!this.wet.wetLayerIds().includes(l.id) && this.wet.wetLayerIds().length >=
|
|
6166
|
+
if (!this.wet.wetLayerIds().includes(l.id) && this.wet.wetLayerIds().length >= _chunkKBYB7OWBcjs.MAX_WET_LANES) throw new PaintEditorError(`At most ${_chunkKBYB7OWBcjs.MAX_WET_LANES} layers can hold wet paint at once; dry one first (dry_paint).`);
|
|
6138
6167
|
const before = this.doc;
|
|
6139
6168
|
this.beginWetOp();
|
|
6140
6169
|
const world = this.wet.ensureLane(l.id);
|
|
@@ -6146,7 +6175,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6146
6175
|
}
|
|
6147
6176
|
/** Records a settings change as a wet event (not an undo step). */
|
|
6148
6177
|
recordWetSetting(e) {
|
|
6149
|
-
this.doc = { ...this.doc, wetEvents: [..._nullishCoalesce(this.doc.wetEvents, () => ( [])), { clock: _nullishCoalesce(_optionalChain([this, 'access',
|
|
6178
|
+
this.doc = { ...this.doc, wetEvents: [..._nullishCoalesce(this.doc.wetEvents, () => ( [])), { clock: _nullishCoalesce(_optionalChain([this, 'access', _383 => _383.wet, 'access', _384 => _384.world, 'optionalAccess', _385 => _385.clock]), () => ( 0)), at: this.doc.strokes.length, ...e }] };
|
|
6150
6179
|
}
|
|
6151
6180
|
/** Changes a layer's wet settings (viscosity, evaporation, granulation…). Editor settings saved with the document, not an undo step. */
|
|
6152
6181
|
setWetParams(layerId, update) {
|
|
@@ -6212,11 +6241,11 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6212
6241
|
/** The layers with the live stroke's surface in place. */
|
|
6213
6242
|
currentLayers() {
|
|
6214
6243
|
const override = this.frameOverride;
|
|
6215
|
-
if (override) return Array.from(override).reduce((ls, [id, surface]) =>
|
|
6244
|
+
if (override) return Array.from(override).reduce((ls, [id, surface]) => _chunkDPYAO5U6cjs.mapLayer.call(void 0, ls, id, (l) => ({ ...l, surface })), this.doc.layers);
|
|
6216
6245
|
const live = this.live;
|
|
6217
6246
|
if (!live) return this.animatedView();
|
|
6218
|
-
if (_optionalChain([this, 'access',
|
|
6219
|
-
const layers =
|
|
6247
|
+
if (_optionalChain([this, 'access', _386 => _386.liveLayers, 'optionalAccess', _387 => _387.key]) === live.surface) return this.liveLayers.layers;
|
|
6248
|
+
const layers = _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
|
|
6220
6249
|
this.liveLayers = { key: live.surface, layers };
|
|
6221
6250
|
return layers;
|
|
6222
6251
|
}
|
|
@@ -6238,7 +6267,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6238
6267
|
tracingNode(t) {
|
|
6239
6268
|
const { width, height } = this.doc.canvas;
|
|
6240
6269
|
const key = this.tracingVersion * 100003 + width * 7 + height;
|
|
6241
|
-
if (_optionalChain([this, 'access',
|
|
6270
|
+
if (_optionalChain([this, 'access', _388 => _388.tracingCache, 'optionalAccess', _389 => _389.key]) === key && this.tracingCache.node.opacity === t.opacity) return this.tracingCache.node;
|
|
6242
6271
|
const src = _nullishCoalesce(this.imagePixels.get(t.src), () => ( this.decodeImage(t.src)));
|
|
6243
6272
|
const image = resampleInto(src, t.rect, width, height);
|
|
6244
6273
|
const node = { type: "image", id: TRACING_NODE_ID, name: "Tracing", visible: true, opacity: t.opacity, blend: "normal", image, version: key + Math.round(t.opacity * 1e3) / 1e4 };
|
|
@@ -6253,7 +6282,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6253
6282
|
let out = layers;
|
|
6254
6283
|
for (const id of ids) {
|
|
6255
6284
|
const baked = this.wet.bakedSurface(id);
|
|
6256
|
-
if (baked &&
|
|
6285
|
+
if (baked && _chunkDPYAO5U6cjs.findLayer.call(void 0, out, id)) out = _chunkDPYAO5U6cjs.mapLayer.call(void 0, out, id, (l) => ({ ...l, surface: baked }));
|
|
6257
6286
|
}
|
|
6258
6287
|
return out;
|
|
6259
6288
|
}
|
|
@@ -6265,13 +6294,13 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6265
6294
|
let out = layers;
|
|
6266
6295
|
const ids = /* @__PURE__ */ new Set([...Object.keys(_nullishCoalesce(thick, () => ( {}))), ...live ? [live.layerId] : []]);
|
|
6267
6296
|
for (const id of ids) {
|
|
6268
|
-
const ch = _optionalChain([live, 'optionalAccess',
|
|
6269
|
-
const l = ch && _optionalChain([
|
|
6297
|
+
const ch = _optionalChain([live, 'optionalAccess', _390 => _390.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _391 => _391[id]]);
|
|
6298
|
+
const l = ch && _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, out, id), 'optionalAccess', _392 => _392.layer]);
|
|
6270
6299
|
if (!ch || !isPixelLayer(l)) continue;
|
|
6271
6300
|
let cache = this.litCaches.get(id);
|
|
6272
6301
|
if (!cache) this.litCaches.set(id, cache = new LitCache());
|
|
6273
6302
|
const lit = cache.lit(l.surface, ch, this.lighting);
|
|
6274
|
-
if (lit !== l.surface) out =
|
|
6303
|
+
if (lit !== l.surface) out = _chunkDPYAO5U6cjs.mapLayer.call(void 0, out, id, () => ({ ...l, surface: lit }));
|
|
6275
6304
|
}
|
|
6276
6305
|
return out;
|
|
6277
6306
|
}
|
|
@@ -6286,13 +6315,13 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6286
6315
|
if (!ids.size) return layers;
|
|
6287
6316
|
let out = layers;
|
|
6288
6317
|
for (const id of ids) {
|
|
6289
|
-
const l = _optionalChain([
|
|
6318
|
+
const l = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, out, id), 'optionalAccess', _393 => _393.layer]);
|
|
6290
6319
|
if (!isPixelLayer(l)) continue;
|
|
6291
6320
|
let cache = this.lightCaches.get(id);
|
|
6292
6321
|
if (!cache) this.lightCaches.set(id, cache = new LightCache());
|
|
6293
|
-
const glowed = cache.glow(l.surface, light[id], _optionalChain([this, 'access',
|
|
6294
|
-
if (glowed !== l.surface) out =
|
|
6295
|
-
const committed = _optionalChain([
|
|
6322
|
+
const glowed = cache.glow(l.surface, light[id], _optionalChain([this, 'access', _394 => _394.liveThick, 'optionalAccess', _395 => _395.layerId]) === id ? this.liveThick.channels : _optionalChain([this, 'access', _396 => _396.doc, 'access', _397 => _397.thick, 'optionalAccess', _398 => _398[id]]));
|
|
6323
|
+
if (glowed !== l.surface) out = _chunkDPYAO5U6cjs.mapLayer.call(void 0, out, id, () => ({ ...l, surface: glowed }));
|
|
6324
|
+
const committed = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _399 => _399.layer]);
|
|
6296
6325
|
const spill = light[id] && isPixelLayer(committed) ? cache.spill(committed.surface, light[id], this.lightSpillOf(id)) : null;
|
|
6297
6326
|
if (spill) out = insertAfter(out, id, { type: "pixel", id: `${id}${SPILL_SUFFIX}`, name: `${l.name} light`, visible: l.visible, opacity: l.opacity, blend: "linear-dodge", surface: spill, offset: { ...l.offset } });
|
|
6298
6327
|
}
|
|
@@ -6304,7 +6333,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6304
6333
|
if (!l.visible) continue;
|
|
6305
6334
|
if (l.type === "group") this.backlitLayers(l.children, committed, opacity * l.opacity, out);
|
|
6306
6335
|
else if (isPixelLayer(l)) {
|
|
6307
|
-
const thick = !committed && _optionalChain([this, 'access',
|
|
6336
|
+
const thick = !committed && _optionalChain([this, 'access', _400 => _400.liveThick, 'optionalAccess', _401 => _401.layerId]) === l.id ? this.liveThick.channels : _optionalChain([this, 'access', _402 => _402.doc, 'access', _403 => _403.thick, 'optionalAccess', _404 => _404[l.id]]);
|
|
6308
6337
|
out.push({ surface: l.surface, offset: l.offset, opacity: opacity * l.opacity, ...thick ? { thick } : {} });
|
|
6309
6338
|
}
|
|
6310
6339
|
}
|
|
@@ -6333,7 +6362,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6333
6362
|
if (backlight) layers = [...layers, backlight];
|
|
6334
6363
|
if (options.layerIds) {
|
|
6335
6364
|
const picked = [];
|
|
6336
|
-
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([
|
|
6365
|
+
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, layers, id), 'optionalAccess', _405 => _405.layer]), () => ( this.requireLayer(id))));
|
|
6337
6366
|
layers = picked.map((l) => ({ ...l, visible: true }));
|
|
6338
6367
|
}
|
|
6339
6368
|
const under = options.paper === false ? [] : [paperNode(this.doc.paper, this.lighting)];
|
|
@@ -6349,7 +6378,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6349
6378
|
*/
|
|
6350
6379
|
compositeTiles(rect, onTile, options = {}) {
|
|
6351
6380
|
const dirty = options.dirty === "all" ? void 0 : options.dirty;
|
|
6352
|
-
this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access',
|
|
6381
|
+
this.viewCompositor.compositeTiles(this.renderLayers({ paper: options.paper }, true), rect, this.sources(), onTile, { dirty, checkpointLayerId: _nullishCoalesce(_optionalChain([this, 'access', _406 => _406.live, 'optionalAccess', _407 => _407.layerId]), () => ( this.doc.activeLayerId)) });
|
|
6353
6382
|
}
|
|
6354
6383
|
/** The canvas as canvas-sized RGBA (paper included by default). */
|
|
6355
6384
|
compositePixels(options = {}) {
|
|
@@ -6377,7 +6406,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6377
6406
|
/** Wet settings saved with the document (`null` when they are all defaults). */
|
|
6378
6407
|
wetJSON() {
|
|
6379
6408
|
const layers = {};
|
|
6380
|
-
for (const [id, set] of this.wet.settings) if (
|
|
6409
|
+
for (const [id, set] of this.wet.settings) if (_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id)) layers[id] = { params: { ...set.params }, flow: { ...set.flow } };
|
|
6381
6410
|
const flat = this.wet.tilt.angle === 0;
|
|
6382
6411
|
if (!Object.keys(layers).length && flat) return void 0;
|
|
6383
6412
|
return { tilt: { ...this.wet.tilt }, layers };
|
|
@@ -6386,7 +6415,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6386
6415
|
this.wet.reset();
|
|
6387
6416
|
if (!raw || typeof raw !== "object") return;
|
|
6388
6417
|
const r = raw;
|
|
6389
|
-
this.wet.setTilt(
|
|
6418
|
+
this.wet.setTilt(_chunkKBYB7OWBcjs.normalizeTilt.call(void 0, _nullishCoalesce(r.tilt, () => ( {}))));
|
|
6390
6419
|
if (r.layers && typeof r.layers === "object") {
|
|
6391
6420
|
for (const [id, v] of Object.entries(r.layers)) {
|
|
6392
6421
|
if (!v || typeof v !== "object") {
|
|
@@ -6394,7 +6423,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6394
6423
|
continue;
|
|
6395
6424
|
}
|
|
6396
6425
|
const x = v;
|
|
6397
|
-
this.wet.settings.set(id, { params:
|
|
6426
|
+
this.wet.settings.set(id, { params: _chunkKBYB7OWBcjs.normalizeWetParams.call(void 0, _nullishCoalesce(x.params, () => ( {}))), flow: _chunkKBYB7OWBcjs.normalizeFlow.call(void 0, _nullishCoalesce(x.flow, () => ( {}))) });
|
|
6398
6427
|
}
|
|
6399
6428
|
}
|
|
6400
6429
|
}
|
|
@@ -6403,32 +6432,32 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6403
6432
|
const ext = { ...this.extensions };
|
|
6404
6433
|
const channels = {};
|
|
6405
6434
|
for (const [id, ch] of Object.entries(_nullishCoalesce(this.doc.thick, () => ( {})))) {
|
|
6406
|
-
if (!
|
|
6435
|
+
if (!_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id)) continue;
|
|
6407
6436
|
const saved = thickToJSON(ch);
|
|
6408
6437
|
if (saved) channels[id] = saved;
|
|
6409
6438
|
}
|
|
6410
6439
|
if (Object.keys(channels).length) ext.layerChannels = channels;
|
|
6411
6440
|
else delete ext.layerChannels;
|
|
6412
6441
|
const stickers = {};
|
|
6413
|
-
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length &&
|
|
6442
|
+
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length && _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id)) stickers[id] = list.map((x) => ({ ...x }));
|
|
6414
6443
|
if (Object.keys(stickers).length) ext.stickers = stickers;
|
|
6415
6444
|
else delete ext.stickers;
|
|
6416
6445
|
const liveStrokes = {};
|
|
6417
|
-
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) if (
|
|
6446
|
+
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) if (_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id)) liveStrokes[id] = list.map((x) => JSON.parse(JSON.stringify(x)));
|
|
6418
6447
|
if (Object.keys(liveStrokes).length) ext.liveStrokes = liveStrokes;
|
|
6419
6448
|
else delete ext.liveStrokes;
|
|
6420
6449
|
const light = {};
|
|
6421
6450
|
for (const [id, t] of Object.entries(_nullishCoalesce(this.doc.light, () => ( {})))) {
|
|
6422
|
-
if (!
|
|
6451
|
+
if (!_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id)) continue;
|
|
6423
6452
|
const saved = lightToJSON(_nullishCoalesce(this.wet.bakedLight(id), () => ( t)));
|
|
6424
6453
|
if (saved) light[id] = saved;
|
|
6425
6454
|
}
|
|
6426
6455
|
if (Object.keys(light).length) ext.light = light;
|
|
6427
6456
|
else delete ext.light;
|
|
6428
|
-
const spills = Object.fromEntries(Object.entries(this.lightSpills).filter(([id]) =>
|
|
6457
|
+
const spills = Object.fromEntries(Object.entries(this.lightSpills).filter(([id]) => _chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id)));
|
|
6429
6458
|
if (Object.keys(spills).length) ext.lightSpill = spills;
|
|
6430
6459
|
else delete ext.lightSpill;
|
|
6431
|
-
const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([
|
|
6460
|
+
const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _408 => _408.layer])));
|
|
6432
6461
|
if (effectLayers) ext.effectLayers = effectLayers;
|
|
6433
6462
|
else delete ext.effectLayers;
|
|
6434
6463
|
if (this.doc.paperEffect) ext.paperEffect = paperEffectToJSON(this.doc.paperEffect);
|
|
@@ -6444,17 +6473,27 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6444
6473
|
if (ext.stickers && typeof ext.stickers === "object") {
|
|
6445
6474
|
const stickers = {};
|
|
6446
6475
|
for (const [id, list] of Object.entries(ext.stickers)) {
|
|
6447
|
-
if (!
|
|
6448
|
-
const ok = list.
|
|
6476
|
+
if (!_chunkDPYAO5U6cjs.findLayer.call(void 0, state.layers, id) || !Array.isArray(list)) continue;
|
|
6477
|
+
const ok = list.flatMap((x) => {
|
|
6478
|
+
if (!x || typeof x.id !== "string" || !Number.isFinite(x.x) || !Number.isFinite(x.y) || !(x.size > 0)) return [];
|
|
6479
|
+
try {
|
|
6480
|
+
const ref2 = _chunk4JNWA3VTcjs.normalizeStickerRef.call(void 0, _nullishCoalesce(x.ref, () => ( x.stamp)));
|
|
6481
|
+
const stamp = _chunk4JNWA3VTcjs.editorStampOf.call(void 0, ref2);
|
|
6482
|
+
const { stamp: _old, ...rest } = x;
|
|
6483
|
+
return [{ ...rest, ref: ref2, ...stamp ? { stamp } : {} }];
|
|
6484
|
+
} catch (e4) {
|
|
6485
|
+
return [];
|
|
6486
|
+
}
|
|
6487
|
+
});
|
|
6449
6488
|
if (ok.length !== list.length) problems.push(`Some stickers of layer "${id}" could not be read; they were dropped.`);
|
|
6450
|
-
stickers[id] = ok
|
|
6489
|
+
stickers[id] = ok;
|
|
6451
6490
|
}
|
|
6452
6491
|
if (Object.keys(stickers).length) state = { ...state, stickers };
|
|
6453
6492
|
}
|
|
6454
6493
|
if (ext.liveStrokes && typeof ext.liveStrokes === "object") {
|
|
6455
6494
|
const liveStrokes = {};
|
|
6456
6495
|
for (const [id, list] of Object.entries(ext.liveStrokes)) {
|
|
6457
|
-
if (!isPixelLayer(_optionalChain([
|
|
6496
|
+
if (!isPixelLayer(_optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _409 => _409.layer])) || !Array.isArray(list)) continue;
|
|
6458
6497
|
const ok = list.map(normalizeBrushStroke).filter((x) => x !== null).map((x) => ({ ...x, layerId: id }));
|
|
6459
6498
|
if (ok.length !== list.length) problems.push(`Some strokes of stroke layer "${id}" could not be read; they were dropped (the layer's pixels are kept until a stroke is edited).`);
|
|
6460
6499
|
liveStrokes[id] = ok;
|
|
@@ -6464,7 +6503,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6464
6503
|
if (ext.effectLayers && typeof ext.effectLayers === "object") {
|
|
6465
6504
|
const effectLayers = {};
|
|
6466
6505
|
for (const [id, v] of Object.entries(ext.effectLayers)) {
|
|
6467
|
-
if (!isPixelLayer(_optionalChain([
|
|
6506
|
+
if (!isPixelLayer(_optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _410 => _410.layer]))) continue;
|
|
6468
6507
|
const source = readPaintEffectSource(v);
|
|
6469
6508
|
if (source) effectLayers[id] = source;
|
|
6470
6509
|
else problems.push(`The effect of layer "${id}" could not be read; it loads as a plain layer.`);
|
|
@@ -6483,8 +6522,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6483
6522
|
if (ext.lightSpill && typeof ext.lightSpill === "object") {
|
|
6484
6523
|
for (const [id, v] of Object.entries(ext.lightSpill)) {
|
|
6485
6524
|
try {
|
|
6486
|
-
if (
|
|
6487
|
-
} catch (
|
|
6525
|
+
if (_chunkDPYAO5U6cjs.findLayer.call(void 0, state.layers, id)) this.lightSpills[id] = normalizeLightSpill(_nullishCoalesce(v, () => ( {})));
|
|
6526
|
+
} catch (e5) {
|
|
6488
6527
|
problems.push(`The light spill of layer "${id}" could not be read; it takes the defaults.`);
|
|
6489
6528
|
}
|
|
6490
6529
|
}
|
|
@@ -6492,7 +6531,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6492
6531
|
if (ext.light && typeof ext.light === "object") {
|
|
6493
6532
|
const light = {};
|
|
6494
6533
|
for (const [id, v] of Object.entries(ext.light)) {
|
|
6495
|
-
if (!isPixelLayer(_optionalChain([
|
|
6534
|
+
if (!isPixelLayer(_optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _411 => _411.layer]))) continue;
|
|
6496
6535
|
try {
|
|
6497
6536
|
light[id] = lightFromJSON(v);
|
|
6498
6537
|
} catch (e) {
|
|
@@ -6505,7 +6544,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6505
6544
|
if (!raw || typeof raw !== "object") return state;
|
|
6506
6545
|
const thick = {};
|
|
6507
6546
|
for (const [id, v] of Object.entries(raw)) {
|
|
6508
|
-
if (!
|
|
6547
|
+
if (!_chunkDPYAO5U6cjs.findLayer.call(void 0, state.layers, id)) continue;
|
|
6509
6548
|
try {
|
|
6510
6549
|
thick[id] = thickFromJSON(v);
|
|
6511
6550
|
} catch (e) {
|
|
@@ -6528,7 +6567,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6528
6567
|
this.readGuides(loaded.guides, loaded.state, loaded.problems);
|
|
6529
6568
|
if (Array.isArray(loaded.swatches)) this.swatches = loaded.swatches.map(readSwatch).filter((x) => x !== null);
|
|
6530
6569
|
for (const s of loaded.state.strokes) {
|
|
6531
|
-
const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access',
|
|
6570
|
+
const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _412 => _412.exec, 'call', _413 => _413(s.id), 'optionalAccess', _414 => _414[1]]), () => ( 0)));
|
|
6532
6571
|
if (n >= this.strokeCounter) this.strokeCounter = n + 1;
|
|
6533
6572
|
}
|
|
6534
6573
|
this.undoStack = [];
|
|
@@ -6536,7 +6575,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6536
6575
|
this.doc = this.readThick(loaded.state, loaded.extensions, loaded.problems);
|
|
6537
6576
|
for (const list of Object.values(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) {
|
|
6538
6577
|
for (const s of list) {
|
|
6539
|
-
const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access',
|
|
6578
|
+
const n = Number(_nullishCoalesce(_optionalChain([/^s(\d+)$/, 'access', _415 => _415.exec, 'call', _416 => _416(s.id), 'optionalAccess', _417 => _417[1]]), () => ( 0)));
|
|
6540
6579
|
if (n >= this.strokeCounter) this.strokeCounter = n + 1;
|
|
6541
6580
|
}
|
|
6542
6581
|
}
|
|
@@ -6551,6 +6590,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6551
6590
|
delete this.extensions.paperEffect;
|
|
6552
6591
|
this.viewCompositor.clear();
|
|
6553
6592
|
this.emit();
|
|
6593
|
+
const refs = Object.values(_nullishCoalesce(this.doc.stickers, () => ( {}))).flatMap((list) => list.map((x) => x.ref));
|
|
6594
|
+
if (refs.some((r) => !_chunk4JNWA3VTcjs.editorStampOf.call(void 0, r))) void this.prepareStickers(refs).catch(() => this.emit([]));
|
|
6554
6595
|
return loaded.problems;
|
|
6555
6596
|
}
|
|
6556
6597
|
/** Opens a saved document (clears the history). Returns what could not be read. */
|
|
@@ -6574,7 +6615,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6574
6615
|
/** The canvas as PNG bytes (paper included by default; `scale` below 1 shrinks it). */
|
|
6575
6616
|
exportPng(options = {}) {
|
|
6576
6617
|
const img = this.scaled(options);
|
|
6577
|
-
return
|
|
6618
|
+
return _chunkW5M3J7PVcjs.encodePng.call(void 0, img.width, img.height, img.data);
|
|
6578
6619
|
}
|
|
6579
6620
|
scaled(options) {
|
|
6580
6621
|
const full2 = this.compositePixels(options);
|
|
@@ -6625,16 +6666,16 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6625
6666
|
const merged = this.compositePixels({ paper: true }).data;
|
|
6626
6667
|
const changed = /* @__PURE__ */ new Map();
|
|
6627
6668
|
const toStandard = (layers2) => layers2.map((l) => {
|
|
6628
|
-
const blend = l.blend === "pass-through" ? l.blend :
|
|
6669
|
+
const blend = l.blend === "pass-through" ? l.blend : _chunk2VX55NFMcjs.standardBlendMode.call(void 0, l.blend);
|
|
6629
6670
|
if (blend !== l.blend) changed.set(l.blend, [..._nullishCoalesce(changed.get(l.blend), () => ( [])), l.name]);
|
|
6630
6671
|
const next = blend === l.blend ? l : { ...l, blend };
|
|
6631
6672
|
return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
|
|
6632
6673
|
});
|
|
6633
6674
|
const layers = toStandard(dried);
|
|
6634
|
-
const result =
|
|
6675
|
+
const result = _chunkM2VKFE5Lcjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
|
|
6635
6676
|
for (const [mode, names] of changed) {
|
|
6636
|
-
const label = _nullishCoalesce(_optionalChain([
|
|
6637
|
-
const std = _nullishCoalesce(_optionalChain([
|
|
6677
|
+
const label = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _418 => _418.find, 'call', _419 => _419((m) => m.id === mode), 'optionalAccess', _420 => _420.label]), () => ( mode));
|
|
6678
|
+
const std = _nullishCoalesce(_optionalChain([_chunk2VX55NFMcjs.BLEND_MODES, 'access', _421 => _421.find, 'call', _422 => _422((m) => m.id === _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _423 => _423.label]), () => ( _chunk2VX55NFMcjs.standardBlendMode.call(void 0, mode)));
|
|
6638
6679
|
const list = names.map((n) => `"${n}"`).join(", ");
|
|
6639
6680
|
const one = names.length === 1;
|
|
6640
6681
|
result.warnings.push(`${label} blending has no PSD equivalent; ${list} ${one ? "was" : "were"} written as ${std}, the nearest Photoshop mode, so ${one ? "it looks" : "they look"} different in Photoshop (the merged image is exact).`);
|
|
@@ -6650,7 +6691,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6650
6691
|
/** `render_preview` as a base64 PNG. */
|
|
6651
6692
|
previewPngBase64(options = {}) {
|
|
6652
6693
|
const img = this.renderPreview(options);
|
|
6653
|
-
return { data:
|
|
6694
|
+
return { data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, _chunkW5M3J7PVcjs.encodePng.call(void 0, img.width, img.height, img.data)), width: img.width, height: img.height };
|
|
6654
6695
|
}
|
|
6655
6696
|
// --- Guides --------------------------------------------------------------------
|
|
6656
6697
|
setGuides(next) {
|
|
@@ -6688,17 +6729,17 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6688
6729
|
pixels = this.decodeImage(input.png.trim().startsWith("data:") ? input.png.trim() : `data:image/png;base64,${input.png.trim()}`, what);
|
|
6689
6730
|
} else throw new PaintEditorError(`${what}: pass png (a PNG as base64 or a data URL) or pixels.`);
|
|
6690
6731
|
if (pixels.width > MAX_IMAGE_SIDE || pixels.height > MAX_IMAGE_SIDE) throw new PaintEditorError(`${what} is ${pixels.width}\xD7${pixels.height}; the limit is ${MAX_IMAGE_SIDE} px per side.`);
|
|
6691
|
-
const src =
|
|
6732
|
+
const src = _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, pixels.width, pixels.height, pixels.data);
|
|
6692
6733
|
this.imagePixels.set(src, pixels);
|
|
6693
6734
|
return { src, pixels };
|
|
6694
6735
|
}
|
|
6695
6736
|
decodeImage(src, what = "Image") {
|
|
6696
6737
|
const cached = this.imagePixels.get(src);
|
|
6697
6738
|
if (cached) return cached;
|
|
6698
|
-
const parsed =
|
|
6739
|
+
const parsed = _chunkW5M3J7PVcjs.parseDataUrl.call(void 0, src);
|
|
6699
6740
|
if (!parsed) throw new PaintEditorError(`${what} is not a data URL or base64 PNG.`);
|
|
6700
6741
|
try {
|
|
6701
|
-
const png =
|
|
6742
|
+
const png = _chunkW5M3J7PVcjs.decodePng.call(void 0, parsed.bytes);
|
|
6702
6743
|
const px = { width: png.width, height: png.height, data: png.data };
|
|
6703
6744
|
this.imagePixels.set(src, px);
|
|
6704
6745
|
return px;
|
|
@@ -6756,7 +6797,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6756
6797
|
const { src, pixels } = this.importImage(options, "The reference image");
|
|
6757
6798
|
const ref2 = {
|
|
6758
6799
|
id: `ref${this.nextReferenceId++}`,
|
|
6759
|
-
name: _optionalChain([options, 'access',
|
|
6800
|
+
name: _optionalChain([options, 'access', _424 => _424.name, 'optionalAccess', _425 => _425.trim, 'call', _426 => _426()]) || `Reference ${this.guides.references.length + 1}`,
|
|
6760
6801
|
src,
|
|
6761
6802
|
width: pixels.width,
|
|
6762
6803
|
height: pixels.height,
|
|
@@ -6835,7 +6876,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6835
6876
|
try {
|
|
6836
6877
|
const px = this.decodeImage(ref2.src, `Reference "${ref2.name}"`);
|
|
6837
6878
|
guides.references.push({ id: ref2.id, name: String(_nullishCoalesce(ref2.name, () => ( ref2.id))), src: ref2.src, width: px.width, height: px.height, x: Number(ref2.x) || 0, y: Number(ref2.y) || 0, displayWidth: Number(ref2.displayWidth) || 240, visible: ref2.visible !== false });
|
|
6838
|
-
const n = Number(_nullishCoalesce(_optionalChain([/^ref(\d+)$/, 'access',
|
|
6879
|
+
const n = Number(_nullishCoalesce(_optionalChain([/^ref(\d+)$/, 'access', _427 => _427.exec, 'call', _428 => _428(ref2.id), 'optionalAccess', _429 => _429[1]]), () => ( 0)));
|
|
6839
6880
|
if (n >= this.nextReferenceId) this.nextReferenceId = n + 1;
|
|
6840
6881
|
} catch (e) {
|
|
6841
6882
|
problems.push(e.message);
|
|
@@ -6846,7 +6887,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6846
6887
|
guides.stencils = [];
|
|
6847
6888
|
r.stencils.forEach((raw2, i) => {
|
|
6848
6889
|
try {
|
|
6849
|
-
const id = typeof _optionalChain([raw2, 'optionalAccess',
|
|
6890
|
+
const id = typeof _optionalChain([raw2, 'optionalAccess', _430 => _430.id]) === "string" && /^stencil\d+$/.test(raw2.id) ? raw2.id : `stencil${this.nextStencilId}`;
|
|
6850
6891
|
guides.stencils.push(normalizeStencil(raw2, id));
|
|
6851
6892
|
const n = Number(id.slice(7));
|
|
6852
6893
|
if (n >= this.nextStencilId) this.nextStencilId = n + 1;
|
|
@@ -6869,45 +6910,96 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6869
6910
|
/** The next free sticker number (ids `st<n>` are unique across the document). */
|
|
6870
6911
|
nextStickerNumber(doc = this.doc) {
|
|
6871
6912
|
let n = 0;
|
|
6872
|
-
for (const list of Object.values(_nullishCoalesce(doc.stickers, () => ( {})))) for (const st of list) n = Math.max(n, Number(_nullishCoalesce(_optionalChain([/^st(\d+)$/, 'access',
|
|
6913
|
+
for (const list of Object.values(_nullishCoalesce(doc.stickers, () => ( {})))) for (const st of list) n = Math.max(n, Number(_nullishCoalesce(_optionalChain([/^st(\d+)$/, 'access', _431 => _431.exec, 'call', _432 => _432(st.id), 'optionalAccess', _433 => _433[1]]), () => ( 0))));
|
|
6873
6914
|
return n + 1;
|
|
6874
6915
|
}
|
|
6875
6916
|
stickerLayer(layerId) {
|
|
6876
6917
|
const l = this.wetLayer(layerId, "edit the stickers of");
|
|
6877
|
-
const stickers = _optionalChain([this, 'access',
|
|
6918
|
+
const stickers = _optionalChain([this, 'access', _434 => _434.doc, 'access', _435 => _435.stickers, 'optionalAccess', _436 => _436[l.id]]);
|
|
6878
6919
|
if (!stickers) throw new PaintEditorError(`Layer "${l.name}" has no stickers; spray some with a sticker brush (list_brushes category sticker).`);
|
|
6879
6920
|
return { layer: l, stickers };
|
|
6880
6921
|
}
|
|
6922
|
+
// --- The sticker library ---------------------------------------------------------
|
|
6923
|
+
/** The sticker library: the editor's own stamps unless a host set its own. */
|
|
6924
|
+
get stickersProvider() {
|
|
6925
|
+
return this.stickers.provider;
|
|
6926
|
+
}
|
|
6927
|
+
/**
|
|
6928
|
+
* Sets the sticker library (`null` goes back to the editor's own stamps, `editorStickers()`);
|
|
6929
|
+
* to offer both, pass `combineStickerProviders([editorStickers(), yours])`. Loaded art is
|
|
6930
|
+
* forgotten. Not an edit: no undo step.
|
|
6931
|
+
*/
|
|
6932
|
+
setStickersProvider(provider) {
|
|
6933
|
+
if ((_nullishCoalesce(provider, () => ( this.stickers.fallback))) === this.stickers.provider) return;
|
|
6934
|
+
this.stickers.set(provider);
|
|
6935
|
+
this.stickerArt.clear();
|
|
6936
|
+
this.emit([]);
|
|
6937
|
+
}
|
|
6938
|
+
/**
|
|
6939
|
+
* Loads the art of `refs` (provider stickers; editor stamps need none) so sprays and placements
|
|
6940
|
+
* can draw them. Rejects with a `PaintEditorError` naming an unknown ref and the closest known
|
|
6941
|
+
* ones, or a sticker whose art failed. Emits when art arrives, so views redraw.
|
|
6942
|
+
*/
|
|
6943
|
+
async prepareStickers(refs) {
|
|
6944
|
+
const list = [...new Set(refs.map((r) => this.readStickerRef(r)))].filter((r) => !_chunk4JNWA3VTcjs.editorStampOf.call(void 0, r));
|
|
6945
|
+
try {
|
|
6946
|
+
await Promise.all(list.map((r) => this.stickerArt.ensure(this.stickers.provider, r, this.rasterizeSticker)));
|
|
6947
|
+
} catch (e) {
|
|
6948
|
+
throw new PaintEditorError(e instanceof Error ? e.message : String(e));
|
|
6949
|
+
} finally {
|
|
6950
|
+
if (list.length) this.emit([]);
|
|
6951
|
+
}
|
|
6952
|
+
}
|
|
6953
|
+
/** Whether a sticker's art is ready to draw: `ready` (always for editor stamps), `loading`, `failed` (with why) or `none`. */
|
|
6954
|
+
stickerArtStatus(ref2) {
|
|
6955
|
+
return this.stickerArt.status(this.readStickerRef(ref2));
|
|
6956
|
+
}
|
|
6957
|
+
readStickerRef(ref2) {
|
|
6958
|
+
try {
|
|
6959
|
+
return _chunk4JNWA3VTcjs.normalizeStickerRef.call(void 0, ref2);
|
|
6960
|
+
} catch (e) {
|
|
6961
|
+
throw new PaintEditorError(e.message);
|
|
6962
|
+
}
|
|
6963
|
+
}
|
|
6964
|
+
/** Refuses to redraw stickers whose art has not loaded (they would vanish), naming them and what to call. */
|
|
6965
|
+
requireStickerArt(stickers) {
|
|
6966
|
+
const missing = [...new Set(stickers.filter((s) => !_chunkGT77U7QGcjs.stickerStamp.call(void 0, s) && !this.stickerArt.get(s.ref)).map((s) => s.ref))];
|
|
6967
|
+
if (missing.length) {
|
|
6968
|
+
for (const r of missing) void this.stickerArt.ensure(this.stickers.provider, r, this.rasterizeSticker).then(() => this.emit([]), () => this.emit([]));
|
|
6969
|
+
throw new PaintEditorError(`The art for ${missing.map((r) => `"${r}"`).join(", ")} has not loaded yet; it is loading now (prepareStickers), so try again when it has.`);
|
|
6970
|
+
}
|
|
6971
|
+
}
|
|
6881
6972
|
/** A layer's stickers, bottom first. */
|
|
6882
6973
|
listStickers(layerId) {
|
|
6883
6974
|
const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
|
|
6884
6975
|
if (!id) return [];
|
|
6885
6976
|
this.requireLayer(id);
|
|
6886
|
-
return (_nullishCoalesce(_optionalChain([this, 'access',
|
|
6977
|
+
return (_nullishCoalesce(_optionalChain([this, 'access', _437 => _437.doc, 'access', _438 => _438.stickers, 'optionalAccess', _439 => _439[id]]), () => ( []))).map((s) => ({ ...s }));
|
|
6887
6978
|
}
|
|
6888
6979
|
/**
|
|
6889
6980
|
* Replaces a layer's stickers and redraws its pixels from them (one undo step). With `dirty`,
|
|
6890
6981
|
* only the tiles under those rects are redrawn.
|
|
6891
6982
|
*/
|
|
6892
6983
|
commitStickers(label, layer, stickers, dirty) {
|
|
6893
|
-
if (
|
|
6984
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it first.`);
|
|
6985
|
+
this.requireStickerArt(stickers);
|
|
6894
6986
|
const before = _nullishCoalesce(this.previewBase(), () => ( this.doc));
|
|
6895
6987
|
this.stickerPreview = null;
|
|
6896
6988
|
const surface = this.redrawStickers(layer, stickers, dirty);
|
|
6897
|
-
const doc = { ...this.doc, layers:
|
|
6989
|
+
const doc = { ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => ({ ...layer, surface, offset: { x: 0, y: 0 } })), stickers: { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [layer.id]: stickers } };
|
|
6898
6990
|
this.commit(label, this.withPaintEvent(doc, { kind: "stickers", layerId: layer.id, data: { stickers: stickers.map((s) => ({ ...s })) } }), before);
|
|
6899
6991
|
}
|
|
6900
6992
|
redrawStickers(layer, stickers, dirty) {
|
|
6901
6993
|
const partial = dirty && !layer.offset.x && !layer.offset.y;
|
|
6902
|
-
return partial ?
|
|
6994
|
+
return partial ? _chunkGT77U7QGcjs.stickerSurface.call(void 0, stickers, layer.surface, dirty, this.stickerArt.get) : _chunkGT77U7QGcjs.stickerSurface.call(void 0, stickers, void 0, void 0, this.stickerArt.get);
|
|
6903
6995
|
}
|
|
6904
6996
|
/** The document from before the sticker preview on screen, or `null` when none is (anything else changed the document since). */
|
|
6905
6997
|
previewBase() {
|
|
6906
|
-
return _optionalChain([this, 'access',
|
|
6998
|
+
return _optionalChain([this, 'access', _440 => _440.stickerPreview, 'optionalAccess', _441 => _441.shown]) === this.doc ? this.stickerPreview.base : null;
|
|
6907
6999
|
}
|
|
6908
7000
|
readStickerUpdate(update) {
|
|
6909
7001
|
try {
|
|
6910
|
-
return
|
|
7002
|
+
return _chunkGT77U7QGcjs.normalizeStickerUpdate.call(void 0, update);
|
|
6911
7003
|
} catch (e) {
|
|
6912
7004
|
throw new PaintEditorError(e.message);
|
|
6913
7005
|
}
|
|
@@ -6918,7 +7010,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6918
7010
|
const id = _nullishCoalesce(layerId, () => ( this.doc.activeLayerId));
|
|
6919
7011
|
if (!id) return null;
|
|
6920
7012
|
this.requireLayer(id);
|
|
6921
|
-
const hit =
|
|
7013
|
+
const hit = _chunkGT77U7QGcjs.stickerAt.call(void 0, _nullishCoalesce(_optionalChain([this, 'access', _442 => _442.doc, 'access', _443 => _443.stickers, 'optionalAccess', _444 => _444[id]]), () => ( [])), x, y, this.stickerArt.get);
|
|
6922
7014
|
return hit ? { ...hit } : null;
|
|
6923
7015
|
}
|
|
6924
7016
|
/** Picks a sticker for the panel and canvas (`null` for none). Editor state, not an undo step. */
|
|
@@ -6934,15 +7026,15 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6934
7026
|
*/
|
|
6935
7027
|
previewSticker(layerId, id, update) {
|
|
6936
7028
|
const { layer, stickers } = this.stickerLayer(layerId);
|
|
6937
|
-
if (
|
|
7029
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it first.`);
|
|
6938
7030
|
const i = stickers.findIndex((s) => s.id === id);
|
|
6939
7031
|
if (i < 0) throw new PaintEditorError(`Layer "${layer.name}" has no sticker "${id}". Call list_stickers for the ids.`);
|
|
6940
7032
|
const next = { ...stickers[i], ...this.readStickerUpdate(update) };
|
|
6941
7033
|
const list = stickers.map((s, j) => j === i ? next : s);
|
|
6942
|
-
const dirty = [
|
|
7034
|
+
const dirty = [_chunkGT77U7QGcjs.stickerRect.call(void 0, stickers[i]), _chunkGT77U7QGcjs.stickerRect.call(void 0, next)];
|
|
6943
7035
|
const base = _nullishCoalesce(this.previewBase(), () => ( this.doc));
|
|
6944
7036
|
const surface = this.redrawStickers(layer, list, dirty);
|
|
6945
|
-
this.doc = { ...this.doc, layers:
|
|
7037
|
+
this.doc = { ...this.doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => ({ ...layer, surface, offset: { x: 0, y: 0 } })), stickers: { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [layer.id]: list } };
|
|
6946
7038
|
this.stickerPreview = { base, shown: this.doc };
|
|
6947
7039
|
this.emit(dirty);
|
|
6948
7040
|
return { ...next };
|
|
@@ -6962,7 +7054,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6962
7054
|
if (i < 0) throw new PaintEditorError(`Layer "${layer.name}" has no sticker "${id}". Call list_stickers for the ids.`);
|
|
6963
7055
|
const u = this.readStickerUpdate(update);
|
|
6964
7056
|
const next = { ...stickers[i], ...u };
|
|
6965
|
-
this.commitStickers("Edit sticker", layer, stickers.map((s, j) => j === i ? next : s), [
|
|
7057
|
+
this.commitStickers("Edit sticker", layer, stickers.map((s, j) => j === i ? next : s), [_chunkGT77U7QGcjs.stickerRect.call(void 0, stickers[i]), _chunkGT77U7QGcjs.stickerRect.call(void 0, next)]);
|
|
6966
7058
|
return { ...next };
|
|
6967
7059
|
}
|
|
6968
7060
|
/**
|
|
@@ -6972,15 +7064,16 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6972
7064
|
*/
|
|
6973
7065
|
addStickers(layerId, input) {
|
|
6974
7066
|
const layer = this.wetLayer(layerId, "add stickers to");
|
|
6975
|
-
if (!input.length) throw new PaintEditorError("Pass at least one sticker (
|
|
7067
|
+
if (!input.length) throw new PaintEditorError("Pass at least one sticker (ref, x, y).");
|
|
6976
7068
|
if (input.length > MAX_ADD_STICKERS) throw new PaintEditorError(`At most ${MAX_ADD_STICKERS} stickers per call; split them over several calls.`);
|
|
6977
|
-
const existing = _optionalChain([this, 'access',
|
|
6978
|
-
if (!_optionalChain([existing, 'optionalAccess',
|
|
7069
|
+
const existing = _optionalChain([this, 'access', _445 => _445.doc, 'access', _446 => _446.stickers, 'optionalAccess', _447 => _447[layer.id]]);
|
|
7070
|
+
if (!_optionalChain([existing, 'optionalAccess', _448 => _448.length])) {
|
|
6979
7071
|
if (this.wet.wetLayerIds().includes(layer.id) || _chunk474IQG74cjs.contentBounds.call(void 0, layer.surface)) throw new PaintEditorError(`Layer "${layer.name}" already has paint; add stickers to an empty layer (add_layer) or a sticker layer so they stay editable.`);
|
|
6980
7072
|
}
|
|
6981
7073
|
let n = this.nextStickerNumber();
|
|
6982
7074
|
const added = input.map((raw, i) => {
|
|
6983
|
-
|
|
7075
|
+
if (raw.ref === void 0 && raw.stamp === void 0) throw new PaintEditorError(`Sticker ${i} needs ref (a sticker ref from find_stickers, e.g. "editor:star").`);
|
|
7076
|
+
for (const k of ["x", "y"]) if (raw[k] === void 0) throw new PaintEditorError(`Sticker ${i} needs ${k}.`);
|
|
6984
7077
|
let u;
|
|
6985
7078
|
try {
|
|
6986
7079
|
u = this.readStickerUpdate(raw);
|
|
@@ -6989,9 +7082,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
6989
7082
|
}
|
|
6990
7083
|
if (raw.seed !== void 0 && !Number.isInteger(raw.seed)) throw new PaintEditorError(`Sticker ${i}: seed must be a whole number.`);
|
|
6991
7084
|
const id = n++;
|
|
6992
|
-
return { id: `st${id}`, size: 48, rotation: 0, color: this.color, opacity: 1, seed: _nullishCoalesce(raw.seed, () => (
|
|
7085
|
+
return { id: `st${id}`, size: 48, rotation: 0, color: this.color, opacity: 1, seed: _nullishCoalesce(raw.seed, () => ( _chunk3K6HWEXZcjs.mix32.call(void 0, id * 2654435761 >>> 0) & 2147483647)), ...u };
|
|
6993
7086
|
});
|
|
6994
|
-
this.commitStickers("Add stickers", layer, [..._nullishCoalesce(existing, () => ( [])), ...added], _optionalChain([existing, 'optionalAccess',
|
|
7087
|
+
this.commitStickers("Add stickers", layer, [..._nullishCoalesce(existing, () => ( [])), ...added], _optionalChain([existing, 'optionalAccess', _449 => _449.length]) ? added.map(_chunkGT77U7QGcjs.stickerRect) : void 0);
|
|
6995
7088
|
return added.map((s) => ({ ...s }));
|
|
6996
7089
|
}
|
|
6997
7090
|
/** Brings stickers to the top (`front`) or bottom of their layer (one undo step). */
|
|
@@ -7001,7 +7094,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7001
7094
|
const picked = stickers.filter((s) => ids.includes(s.id));
|
|
7002
7095
|
const rest = stickers.filter((s) => !ids.includes(s.id));
|
|
7003
7096
|
const next = to === "front" ? [...rest, ...picked] : [...picked, ...rest];
|
|
7004
|
-
this.commitStickers("Arrange stickers", layer, next, picked.map(
|
|
7097
|
+
this.commitStickers("Arrange stickers", layer, next, picked.map(_chunkGT77U7QGcjs.stickerRect));
|
|
7005
7098
|
return next.map((s) => s.id);
|
|
7006
7099
|
}
|
|
7007
7100
|
/** Deletes stickers (`ids`, or all of them on the layer) (one undo step). Returns the ids removed. */
|
|
@@ -7011,7 +7104,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7011
7104
|
for (const id of ids) if (!stickers.some((s) => s.id === id)) throw new PaintEditorError(`Layer "${layer.name}" has no sticker "${id}". Call list_stickers for the ids.`);
|
|
7012
7105
|
}
|
|
7013
7106
|
const removed = ids ? [...ids] : stickers.map((s) => s.id);
|
|
7014
|
-
this.commitStickers("Remove stickers", layer, stickers.filter((s) => !removed.includes(s.id)), ids ? stickers.filter((s) => removed.includes(s.id)).map(
|
|
7107
|
+
this.commitStickers("Remove stickers", layer, stickers.filter((s) => !removed.includes(s.id)), ids ? stickers.filter((s) => removed.includes(s.id)).map(_chunkGT77U7QGcjs.stickerRect) : void 0);
|
|
7015
7108
|
return removed;
|
|
7016
7109
|
}
|
|
7017
7110
|
/** Sets a layer's stickers (replays). */
|
|
@@ -7030,20 +7123,20 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7030
7123
|
}
|
|
7031
7124
|
liveStrokeLayer(layerId, what) {
|
|
7032
7125
|
const l = this.wetLayer(layerId, what);
|
|
7033
|
-
const strokes = _optionalChain([this, 'access',
|
|
7126
|
+
const strokes = _optionalChain([this, 'access', _450 => _450.doc, 'access', _451 => _451.liveStrokes, 'optionalAccess', _452 => _452[l.id]]);
|
|
7034
7127
|
if (!strokes) throw new PaintEditorError(`Layer "${l.name}" is not a stroke layer; add one with add_layer {type: "strokes"} (or convert_to_stroke_layer on an empty layer), then paint on it.`);
|
|
7035
7128
|
return { layer: l, strokes };
|
|
7036
7129
|
}
|
|
7037
7130
|
/** Whether a layer is a live stroke layer. */
|
|
7038
7131
|
isLiveStrokeLayer(layerId) {
|
|
7039
|
-
return Boolean(_optionalChain([this, 'access',
|
|
7132
|
+
return Boolean(_optionalChain([this, 'access', _453 => _453.doc, 'access', _454 => _454.liveStrokes, 'optionalAccess', _455 => _455[layerId]]));
|
|
7040
7133
|
}
|
|
7041
7134
|
/** Makes an empty pixel layer a live stroke layer (one undo step). */
|
|
7042
7135
|
convertToLiveStrokes(layerId) {
|
|
7043
7136
|
this.requireIdle("converting a layer");
|
|
7044
7137
|
const l = this.paintTarget(layerId, "convert");
|
|
7045
|
-
if (_optionalChain([this, 'access',
|
|
7046
|
-
if (_optionalChain([this, 'access',
|
|
7138
|
+
if (_optionalChain([this, 'access', _456 => _456.doc, 'access', _457 => _457.liveStrokes, 'optionalAccess', _458 => _458[l.id]])) return this.describeLayer(l);
|
|
7139
|
+
if (_optionalChain([this, 'access', _459 => _459.doc, 'access', _460 => _460.stickers, 'optionalAccess', _461 => _461[l.id], 'optionalAccess', _462 => _462.length])) throw new PaintEditorError(`Layer "${l.name}" is a sticker layer; add a stroke layer instead (add_layer {type: "strokes"}).`);
|
|
7047
7140
|
if (_chunk474IQG74cjs.contentBounds.call(void 0, l.surface) || this.wet.wetLayerIds().includes(l.id)) throw new PaintEditorError(`Layer "${l.name}" already has paint, which isn't kept as strokes; convert an empty layer or add a stroke layer (add_layer {type: "strokes"}).`);
|
|
7048
7141
|
this.commit("Convert to stroke layer", { ...this.doc, liveStrokes: { ..._nullishCoalesce(this.doc.liveStrokes, () => ( {})), [l.id]: [] } });
|
|
7049
7142
|
return this.describeLayer(this.getLayer(l.id));
|
|
@@ -7056,7 +7149,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7056
7149
|
findLiveStroke(id) {
|
|
7057
7150
|
for (const [layerId, strokes] of Object.entries(_nullishCoalesce(this.doc.liveStrokes, () => ( {})))) {
|
|
7058
7151
|
const index = strokes.findIndex((x) => x.id === id);
|
|
7059
|
-
const layer = _optionalChain([
|
|
7152
|
+
const layer = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, this.doc.layers, layerId), 'optionalAccess', _463 => _463.layer]);
|
|
7060
7153
|
if (index >= 0 && isPixelLayer(layer)) return { layer, strokes, index };
|
|
7061
7154
|
}
|
|
7062
7155
|
const baked = this.doc.strokes.some((x) => x.id === id);
|
|
@@ -7076,15 +7169,15 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7076
7169
|
let brush = was.brush;
|
|
7077
7170
|
if (update.brushId !== void 0) {
|
|
7078
7171
|
const b = this.requireBrush(update.brushId);
|
|
7079
|
-
brush =
|
|
7172
|
+
brush = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: was.brush.tip.size } }, b);
|
|
7080
7173
|
}
|
|
7081
7174
|
if (update.brush !== void 0) {
|
|
7082
7175
|
if (!update.brush || typeof update.brush !== "object") throw new PaintEditorError("brush must be an object of brush settings (as set_brush takes).");
|
|
7083
|
-
brush =
|
|
7176
|
+
brush = _chunkGT77U7QGcjs.normalizePaintBrush.call(void 0, { ...update.brush, id: brush.id }, brush);
|
|
7084
7177
|
}
|
|
7085
7178
|
const why = liveStrokeRefusal(brush);
|
|
7086
7179
|
if (why) throw new PaintEditorError(why);
|
|
7087
|
-
const next = { ...was, brush:
|
|
7180
|
+
const next = { ...was, brush: _chunkGT77U7QGcjs.brushToJSON.call(void 0, brush) };
|
|
7088
7181
|
if (update.seed !== void 0) {
|
|
7089
7182
|
if (!Number.isInteger(update.seed) || update.seed < 0) throw new PaintEditorError(`seed ${update.seed} must be a whole number of 0 or more.`);
|
|
7090
7183
|
next.seed = update.seed;
|
|
@@ -7095,7 +7188,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7095
7188
|
}
|
|
7096
7189
|
if (update.paint !== void 0) {
|
|
7097
7190
|
if (update.paint === null) delete next.paint;
|
|
7098
|
-
else if (
|
|
7191
|
+
else if (_chunkGT77U7QGcjs.isPaintEffectPaint.call(void 0, update.paint)) {
|
|
7099
7192
|
if (!this.effectPaintImage(update.paint)) throw new PaintEditorError(`The effect "${update.paint.effect}" is not rendered yet; render it first (prepareEffectPaints; the update_stroke tool does this).`);
|
|
7100
7193
|
next.paint = JSON.parse(JSON.stringify(update.paint));
|
|
7101
7194
|
} else {
|
|
@@ -7106,8 +7199,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7106
7199
|
} else next.paint = JSON.parse(JSON.stringify(p));
|
|
7107
7200
|
}
|
|
7108
7201
|
}
|
|
7109
|
-
const rgb =
|
|
7110
|
-
const load = brushLoadForStroke(brush,
|
|
7202
|
+
const rgb = _chunkGT77U7QGcjs.hexToRgb8.call(void 0, next.color).map((v) => v / 255);
|
|
7203
|
+
const load = brushLoadForStroke(brush, _chunkI7NJPHWVcjs.EMPTY_MIXER_LOAD, rgb);
|
|
7111
7204
|
if (load.reservoir || load.pickup) next.load = load;
|
|
7112
7205
|
else delete next.load;
|
|
7113
7206
|
const list = strokes.map((x, i) => i === index ? next : x);
|
|
@@ -7151,9 +7244,9 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7151
7244
|
const layers = /* @__PURE__ */ new Map();
|
|
7152
7245
|
for (const f of found) layers.set(f.layer.id, f.layer);
|
|
7153
7246
|
for (const [layerId, layer] of layers) {
|
|
7154
|
-
const gone = (_nullishCoalesce(_optionalChain([doc, 'access',
|
|
7247
|
+
const gone = (_nullishCoalesce(_optionalChain([doc, 'access', _464 => _464.liveStrokes, 'optionalAccess', _465 => _465[layerId]]), () => ( []))).filter((x) => ids.includes(x.id));
|
|
7155
7248
|
for (const x of gone) bounds = unionRect(bounds, this.strokeArea(x));
|
|
7156
|
-
doc = this.withLiveStrokes(doc, layer, (_nullishCoalesce(_optionalChain([doc, 'access',
|
|
7249
|
+
doc = this.withLiveStrokes(doc, layer, (_nullishCoalesce(_optionalChain([doc, 'access', _466 => _466.liveStrokes, 'optionalAccess', _467 => _467[layerId]]), () => ( []))).filter((x) => !ids.includes(x.id)), this.strokeAreas(gone));
|
|
7157
7250
|
}
|
|
7158
7251
|
this.commit(ids.length === 1 ? "Remove stroke" : "Remove strokes", doc);
|
|
7159
7252
|
return { removed: [...ids], bounds };
|
|
@@ -7220,10 +7313,10 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7220
7313
|
this.commit(label, this.withLiveStrokes(this.doc, layer, list, dirty));
|
|
7221
7314
|
}
|
|
7222
7315
|
withLiveStrokes(doc, layer, list, dirty) {
|
|
7223
|
-
if (
|
|
7224
|
-
const current = _optionalChain([
|
|
7316
|
+
if (_chunkDPYAO5U6cjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it (update_layer locks) first.`);
|
|
7317
|
+
const current = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, doc.layers, layer.id), 'optionalAccess', _468 => _468.layer]);
|
|
7225
7318
|
const surface = this.drawLiveStrokes(_nullishCoalesce(current, () => ( layer)), list, dirty);
|
|
7226
|
-
const next = { ...doc, layers:
|
|
7319
|
+
const next = { ...doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, doc.layers, layer.id, (l) => ({ ...l, surface, offset: { x: 0, y: 0 } })), liveStrokes: { ..._nullishCoalesce(doc.liveStrokes, () => ( {})), [layer.id]: [...list] } };
|
|
7227
7320
|
return this.withPaintEvent(next, { kind: "live-strokes", layerId: layer.id, data: { strokes: list.map((x) => JSON.parse(JSON.stringify(x))) } });
|
|
7228
7321
|
}
|
|
7229
7322
|
/** Where a stroke painted (document pixels): as learnt when it was painted or drawn, else an estimate from its points and brush. */
|
|
@@ -7252,7 +7345,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7252
7345
|
};
|
|
7253
7346
|
const paint = st.paint && this.liveEffectAt !== null && isLiveEffect(st) ? framePaint(st.paint, this.liveEffectAt) : st.paint;
|
|
7254
7347
|
const init = { layerId: plain.id, color: st.color, brush: st.brush, seed: st.seed, copies: _nullishCoalesce(st.copies, () => ( [])), ...st.load ? { load: st.load } : {}, ...paint ? { paint } : {}, snapToPerspective: false, stencils: false, maskStencils: _nullishCoalesce(st.stencils, () => ( [])) };
|
|
7255
|
-
const session = this.sessionFor({ ...doc, layers:
|
|
7348
|
+
const session = this.sessionFor({ ...doc, layers: _chunkDPYAO5U6cjs.mapLayer.call(void 0, doc.layers, plain.id, () => ({ ...plain, surface })) }, init, host);
|
|
7256
7349
|
session.push(st.points);
|
|
7257
7350
|
const result = session.end();
|
|
7258
7351
|
const had = this.paintedBounds.get(st);
|
|
@@ -7299,8 +7392,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7299
7392
|
if (!this.animatedLayers.size) return this.doc.layers;
|
|
7300
7393
|
let layers = this.doc.layers;
|
|
7301
7394
|
for (const [id, a] of this.animatedLayers) {
|
|
7302
|
-
const l = _optionalChain([
|
|
7303
|
-
if (isPixelLayer(l) && l.surface === a.base) layers =
|
|
7395
|
+
const l = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, layers, id), 'optionalAccess', _469 => _469.layer]);
|
|
7396
|
+
if (isPixelLayer(l) && l.surface === a.base) layers = _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, id, () => ({ ...l, surface: a.surface }));
|
|
7304
7397
|
}
|
|
7305
7398
|
return layers;
|
|
7306
7399
|
}
|
|
@@ -7309,11 +7402,11 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7309
7402
|
const layers = [];
|
|
7310
7403
|
const sources = /* @__PURE__ */ new Map();
|
|
7311
7404
|
for (const [id, strokes] of Object.entries(_nullishCoalesce(doc.liveStrokes, () => ( {})))) {
|
|
7312
|
-
const layer = _optionalChain([
|
|
7405
|
+
const layer = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, doc.layers, id), 'optionalAccess', _470 => _470.layer]);
|
|
7313
7406
|
const live = strokes.filter(isLiveEffect);
|
|
7314
7407
|
if (!isPixelLayer(layer) || !live.length) continue;
|
|
7315
7408
|
layers.push({ layer, strokes });
|
|
7316
|
-
for (const st of live) sources.set(
|
|
7409
|
+
for (const st of live) sources.set(_chunkGT77U7QGcjs.effectPaintKey.call(void 0, st.paint), st.paint);
|
|
7317
7410
|
}
|
|
7318
7411
|
return { layers, sources: [...sources.values()] };
|
|
7319
7412
|
}
|
|
@@ -7434,13 +7527,13 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7434
7527
|
return this.withEffectTime(time, () => this.compositePixels(options));
|
|
7435
7528
|
}
|
|
7436
7529
|
// --- Stencils --------------------------------------------------------------------
|
|
7437
|
-
|
|
7438
|
-
|
|
7530
|
+
__init137() {this.stencilCache = null}
|
|
7531
|
+
__init138() {this.nextStencilId = 1}
|
|
7439
7532
|
/** The mask stencils' coverage over the canvas (cached), or `null` when none masks. */
|
|
7440
7533
|
stencilSelection(stencils = this.guides.stencils) {
|
|
7441
7534
|
const { width, height } = this.doc.canvas;
|
|
7442
7535
|
const size = `${width}x${height}`;
|
|
7443
|
-
if (_optionalChain([this, 'access',
|
|
7536
|
+
if (_optionalChain([this, 'access', _471 => _471.stencilCache, 'optionalAccess', _472 => _472.key]) === stencils && this.stencilCache.size === size) return this.stencilCache.mask;
|
|
7444
7537
|
const mask = stencilMask(stencils, width, height);
|
|
7445
7538
|
this.stencilCache = { key: stencils, size, mask };
|
|
7446
7539
|
return mask;
|
|
@@ -7501,8 +7594,8 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7501
7594
|
}
|
|
7502
7595
|
makeSwatch(color, name) {
|
|
7503
7596
|
const p = typeof color === "string" ? { type: "color", color: parseColor(color) } : this.readStrokePaint(color);
|
|
7504
|
-
const out = { color:
|
|
7505
|
-
if (_optionalChain([name, 'optionalAccess',
|
|
7597
|
+
const out = { color: _chunkI7NJPHWVcjs.paintSourceColor.call(void 0, p, { paint: this.color, secondary: this.secondaryColor }) };
|
|
7598
|
+
if (_optionalChain([name, 'optionalAccess', _473 => _473.trim, 'call', _474 => _474()])) out.name = name.trim();
|
|
7506
7599
|
if (p.type === "gradient") out.paint = p;
|
|
7507
7600
|
return out;
|
|
7508
7601
|
}
|
|
@@ -7554,7 +7647,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7554
7647
|
* mix becomes the paint colour. Returns the mixed colour and the pile's bounds.
|
|
7555
7648
|
*/
|
|
7556
7649
|
mixOnPad(paints, options = {}) {
|
|
7557
|
-
const parsed = (_nullishCoalesce(paints, () => ( []))).map((p, i) => ({ color: parseColor(_optionalChain([p, 'optionalAccess',
|
|
7650
|
+
const parsed = (_nullishCoalesce(paints, () => ( []))).map((p, i) => ({ color: parseColor(_optionalChain([p, 'optionalAccess', _475 => _475.color]), `paints[${i}].color`), parts: _optionalChain([p, 'optionalAccess', _476 => _476.parts]) }));
|
|
7558
7651
|
let r;
|
|
7559
7652
|
try {
|
|
7560
7653
|
r = this.pad.mix(parsed, options);
|
|
@@ -7643,7 +7736,7 @@ var PaintEditorController = (_class12 = class _PaintEditorController {
|
|
|
7643
7736
|
}
|
|
7644
7737
|
/** A layer's tile surface (live while stroking), for thumbnails. */
|
|
7645
7738
|
layerSurface(id) {
|
|
7646
|
-
const l = _optionalChain([
|
|
7739
|
+
const l = _optionalChain([_chunkDPYAO5U6cjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _477 => _477.layer]);
|
|
7647
7740
|
return isPixelLayer(l) ? l.surface : null;
|
|
7648
7741
|
}
|
|
7649
7742
|
}, _class12.__initStatic(), _class12);
|
|
@@ -7665,7 +7758,7 @@ function insertAfter(layers, id, node) {
|
|
|
7665
7758
|
return layers.map((l) => l.type === "group" ? { ...l, children: insertAfter(l.children, id, node) } : l);
|
|
7666
7759
|
}
|
|
7667
7760
|
function isLiveEffect(s) {
|
|
7668
|
-
return _optionalChain([s, 'access',
|
|
7761
|
+
return _optionalChain([s, 'access', _478 => _478.paint, 'optionalAccess', _479 => _479.type]) === "effect" && s.paint.live === true;
|
|
7669
7762
|
}
|
|
7670
7763
|
function framePaint(p, t) {
|
|
7671
7764
|
return { ...p, time: p.time + t };
|
|
@@ -7690,13 +7783,13 @@ function clipRect(r, width, height) {
|
|
|
7690
7783
|
return x1 > x0 && y1 > y0 ? { x: x0, y: y0, width: x1 - x0, height: y1 - y0 } : null;
|
|
7691
7784
|
}
|
|
7692
7785
|
function withLiveStroke(doc, stroke) {
|
|
7693
|
-
const list = _optionalChain([doc, 'access',
|
|
7786
|
+
const list = _optionalChain([doc, 'access', _480 => _480.liveStrokes, 'optionalAccess', _481 => _481[stroke.layerId]]);
|
|
7694
7787
|
return list ? { ...doc, liveStrokes: { ...doc.liveStrokes, [stroke.layerId]: [...list, stroke] } } : doc;
|
|
7695
7788
|
}
|
|
7696
7789
|
function shiftDocument(doc, dx, dy) {
|
|
7697
7790
|
if (!dx && !dy) return doc;
|
|
7698
7791
|
let layers = doc.layers;
|
|
7699
|
-
for (const l of
|
|
7792
|
+
for (const l of _chunkDPYAO5U6cjs.flattenLayers.call(void 0, doc.layers)) if (l.type === "pixel") layers = _chunkDPYAO5U6cjs.mapLayer.call(void 0, layers, l.id, () => ({ ...l, offset: movePoint(l.offset, dx, dy) }));
|
|
7700
7793
|
const m = [1, 0, 0, 1, dx, dy];
|
|
7701
7794
|
const moveStickers = (list) => list.map((s) => ({ ...s, x: Math.round((s.x + dx) * 100) / 100, y: Math.round((s.y + dy) * 100) / 100 }));
|
|
7702
7795
|
const out = {
|
|
@@ -7717,9 +7810,9 @@ function shiftDocument(doc, dx, dy) {
|
|
|
7717
7810
|
if (doc.liveStrokes) out.liveStrokes = Object.fromEntries(Object.entries(doc.liveStrokes).map(([id, list]) => [id, list.map(moveStroke)]));
|
|
7718
7811
|
if (doc.paintEvents) {
|
|
7719
7812
|
out.paintEvents = doc.paintEvents.map((e) => {
|
|
7720
|
-
const list = e.kind === "stickers" ? _optionalChain([e, 'access',
|
|
7813
|
+
const list = e.kind === "stickers" ? _optionalChain([e, 'access', _482 => _482.data, 'optionalAccess', _483 => _483.stickers]) : void 0;
|
|
7721
7814
|
if (list) return { ...e, data: { ...e.data, stickers: moveStickers(list) } };
|
|
7722
|
-
const strokes = e.kind === "live-strokes" ? _optionalChain([e, 'access',
|
|
7815
|
+
const strokes = e.kind === "live-strokes" ? _optionalChain([e, 'access', _484 => _484.data, 'optionalAccess', _485 => _485.strokes]) : void 0;
|
|
7723
7816
|
return strokes ? { ...e, data: { ...e.data, strokes: strokes.map(moveStroke) } } : e;
|
|
7724
7817
|
});
|
|
7725
7818
|
}
|
|
@@ -7801,8 +7894,8 @@ function strokeSchedule(points) {
|
|
|
7801
7894
|
return total > 0 ? acc.map((d) => d / total) : points.map(() => 1);
|
|
7802
7895
|
}
|
|
7803
7896
|
function strokeDuration(points, max = 1800) {
|
|
7804
|
-
const t0 = _optionalChain([points, 'access',
|
|
7805
|
-
const t1 = _optionalChain([points, 'access',
|
|
7897
|
+
const t0 = _optionalChain([points, 'access', _486 => _486[0], 'optionalAccess', _487 => _487.t]);
|
|
7898
|
+
const t1 = _optionalChain([points, 'access', _488 => _488[points.length - 1], 'optionalAccess', _489 => _489.t]);
|
|
7806
7899
|
let ms;
|
|
7807
7900
|
if (points.every((p) => Number.isFinite(p.t)) && t1 > t0) ms = t1 - t0;
|
|
7808
7901
|
else {
|
|
@@ -7856,7 +7949,7 @@ var PaintDirector = class {
|
|
|
7856
7949
|
}
|
|
7857
7950
|
where(id) {
|
|
7858
7951
|
const a = this.presence.get(id);
|
|
7859
|
-
return { x: _nullishCoalesce(_optionalChain([a, 'optionalAccess',
|
|
7952
|
+
return { x: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _490 => _490.x]), () => ( 0)), y: _nullishCoalesce(_optionalChain([a, 'optionalAccess', _491 => _491.y]), () => ( 0)) };
|
|
7860
7953
|
}
|
|
7861
7954
|
/** Glides to `to`; an actor that just appeared starts there instead of the corner. */
|
|
7862
7955
|
async glide(id, to, ms = 380) {
|
|
@@ -7903,8 +7996,8 @@ var PaintDirector = class {
|
|
|
7903
7996
|
}
|
|
7904
7997
|
case "replay": {
|
|
7905
7998
|
await this.say(id, command.note, 500);
|
|
7906
|
-
const source = c.getStrokes().filter((s) => _optionalChain([command, 'access',
|
|
7907
|
-
const first = _optionalChain([source, 'access',
|
|
7999
|
+
const source = c.getStrokes().filter((s) => _optionalChain([command, 'access', _492 => _492.replay, 'access', _493 => _493.strokeIds, 'optionalAccess', _494 => _494.includes, 'call', _495 => _495(s.id)]));
|
|
8000
|
+
const first = _optionalChain([source, 'access', _496 => _496[0], 'optionalAccess', _497 => _497.points, 'access', _498 => _498[0]]);
|
|
7908
8001
|
if (first) await this.glide(id, first);
|
|
7909
8002
|
const result = c.replayStrokes(command.replay);
|
|
7910
8003
|
if (result.bounds) await this.glide(id, centre(result.bounds), 520);
|
|
@@ -8045,7 +8138,7 @@ function createPaintStickerTools(c) {
|
|
|
8045
8138
|
{
|
|
8046
8139
|
name: "list_stickers",
|
|
8047
8140
|
title: "List stickers",
|
|
8048
|
-
description: "Lists a layer\u2019s stickers bottom first: id, stamp, x, y (centre, document pixels), size (diameter px), rotation (degrees clockwise), color, opacity. Empty for a layer without stickers. Changes nothing.",
|
|
8141
|
+
description: "Lists a layer\u2019s stickers bottom first: id, ref (provider:id; stamp too for the editor\u2019s own), x, y (centre, document pixels), size (diameter px), rotation (degrees clockwise), color, opacity. Empty for a layer without stickers. Changes nothing.",
|
|
8049
8142
|
inputSchema: { type: "object", properties: { layerId: LAYER_ID }, additionalProperties: false },
|
|
8050
8143
|
annotations: { title: "List stickers", ...READ },
|
|
8051
8144
|
coordinates: { out: ["stickers[]"] },
|
|
@@ -8072,7 +8165,7 @@ function createPaintStickerTools(c) {
|
|
|
8072
8165
|
{
|
|
8073
8166
|
name: "add_stickers",
|
|
8074
8167
|
title: "Place stickers",
|
|
8075
|
-
description: "Places stickers exactly where you say, on top of a sticker layer or onto an empty layer (which becomes a sticker layer). Use it for deliberate placement; spray with paint_stroke and a sticker brush for a random scatter. One undo step. Returns the new stickers with their ids, for update_sticker, arrange_stickers and remove_stickers.",
|
|
8168
|
+
description: "Places stickers exactly where you say, on top of a sticker layer or onto an empty layer (which becomes a sticker layer): any sticker from the sticker library by ref (find_stickers), its art loaded first; tintable ones take color. Use it for deliberate placement; spray with paint_stroke and a sticker brush for a random scatter. An unknown ref is refused with the closest ones. One undo step. Returns the new stickers with their ids, for update_sticker, arrange_stickers and remove_stickers.",
|
|
8076
8169
|
inputSchema: {
|
|
8077
8170
|
type: "object",
|
|
8078
8171
|
properties: {
|
|
@@ -8085,7 +8178,8 @@ function createPaintStickerTools(c) {
|
|
|
8085
8178
|
items: {
|
|
8086
8179
|
type: "object",
|
|
8087
8180
|
properties: {
|
|
8088
|
-
|
|
8181
|
+
ref: { type: "string", minLength: 1, description: "The sticker: a ref provider:id from find_stickers (e.g. editor:star). Give ref or stamp." },
|
|
8182
|
+
stamp: { type: "string", enum: [..._chunk4JNWA3VTcjs.STAMP_KINDS], description: "Older form: an editor stamp (same as ref editor:<stamp>)." },
|
|
8089
8183
|
x: { type: "number", description: "Centre x in document pixels." },
|
|
8090
8184
|
y: { type: "number", description: "Centre y in document pixels." },
|
|
8091
8185
|
size: { type: "number", minimum: 2, maximum: 2048, description: "Diameter in pixels (default 48)." },
|
|
@@ -8094,7 +8188,7 @@ function createPaintStickerTools(c) {
|
|
|
8094
8188
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Opacity 0..1 (default 1)." },
|
|
8095
8189
|
seed: { type: "integer", minimum: 0, description: "Texture seed (default from the new id); splat and confetti shapes vary with it." }
|
|
8096
8190
|
},
|
|
8097
|
-
required: ["
|
|
8191
|
+
required: ["x", "y"],
|
|
8098
8192
|
additionalProperties: false
|
|
8099
8193
|
}
|
|
8100
8194
|
}
|
|
@@ -8104,7 +8198,14 @@ function createPaintStickerTools(c) {
|
|
|
8104
8198
|
},
|
|
8105
8199
|
annotations: { title: "Place stickers", ...WRITE },
|
|
8106
8200
|
coordinates: { in: ["stickers[]"], out: ["stickers[]"] },
|
|
8107
|
-
handler: ({ layerId, stickers }) =>
|
|
8201
|
+
handler: async ({ layerId, stickers }) => {
|
|
8202
|
+
const list = stickers;
|
|
8203
|
+
list.forEach((x, i) => {
|
|
8204
|
+
if (x.ref === void 0 && x.stamp === void 0) throw new Error(`Sticker ${i} needs ref (a sticker ref from find_stickers, e.g. "editor:star").`);
|
|
8205
|
+
});
|
|
8206
|
+
await c.prepareStickers(list.map((x) => _nullishCoalesce(x.ref, () => ( `editor:${x.stamp}`))));
|
|
8207
|
+
return { layerId: _nullishCoalesce(layerId, () => ( c.document.activeLayerId)), stickers: c.addStickers(layerId, list) };
|
|
8208
|
+
}
|
|
8108
8209
|
},
|
|
8109
8210
|
{
|
|
8110
8211
|
name: "update_sticker",
|
|
@@ -8115,7 +8216,8 @@ function createPaintStickerTools(c) {
|
|
|
8115
8216
|
properties: {
|
|
8116
8217
|
layerId: LAYER_ID,
|
|
8117
8218
|
id: { type: "string", description: "Sticker id from list_stickers." },
|
|
8118
|
-
|
|
8219
|
+
ref: { type: "string", minLength: 1, description: "Another sticker: a ref provider:id from find_stickers." },
|
|
8220
|
+
stamp: { type: "string", enum: [..._chunk4JNWA3VTcjs.STAMP_KINDS], description: "Older form: another editor stamp (same as ref editor:<stamp>)." },
|
|
8119
8221
|
x: { type: "number", description: "Centre x in document pixels." },
|
|
8120
8222
|
y: { type: "number", description: "Centre y in document pixels." },
|
|
8121
8223
|
size: { type: "number", minimum: 2, maximum: 2048, description: "Diameter in pixels." },
|
|
@@ -8128,7 +8230,11 @@ function createPaintStickerTools(c) {
|
|
|
8128
8230
|
},
|
|
8129
8231
|
annotations: { title: "Change a sticker", ...WRITE },
|
|
8130
8232
|
coordinates: { in: [""], out: [""] },
|
|
8131
|
-
handler: ({ layerId, id, ...update }) =>
|
|
8233
|
+
handler: async ({ layerId, id, ...update }) => {
|
|
8234
|
+
const refs = c.listStickers(layerId).map((s) => s.ref);
|
|
8235
|
+
await c.prepareStickers(update.ref ? [...refs, update.ref] : refs);
|
|
8236
|
+
return c.updateSticker(layerId, id, update);
|
|
8237
|
+
}
|
|
8132
8238
|
},
|
|
8133
8239
|
{
|
|
8134
8240
|
name: "arrange_stickers",
|
|
@@ -8145,7 +8251,10 @@ function createPaintStickerTools(c) {
|
|
|
8145
8251
|
additionalProperties: false
|
|
8146
8252
|
},
|
|
8147
8253
|
annotations: { title: "Bring stickers forward or back", ...WRITE },
|
|
8148
|
-
handler: ({ layerId, ids, to }) =>
|
|
8254
|
+
handler: async ({ layerId, ids, to }) => {
|
|
8255
|
+
await c.prepareStickers(c.listStickers(layerId).map((s) => s.ref));
|
|
8256
|
+
return { order: c.arrangeStickers(layerId, ids, to) };
|
|
8257
|
+
}
|
|
8149
8258
|
},
|
|
8150
8259
|
{
|
|
8151
8260
|
name: "remove_stickers",
|
|
@@ -8153,7 +8262,10 @@ function createPaintStickerTools(c) {
|
|
|
8153
8262
|
description: "Deletes stickers by id, or every sticker on the layer when ids is missing. One undo step. Returns the ids removed.",
|
|
8154
8263
|
inputSchema: { type: "object", properties: { layerId: LAYER_ID, ids: { type: "array", items: { type: "string", description: "Sticker id." }, description: "Sticker ids (default all)." } }, additionalProperties: false },
|
|
8155
8264
|
annotations: { title: "Delete stickers", ...DESTRUCTIVE },
|
|
8156
|
-
handler: ({ layerId, ids }) =>
|
|
8265
|
+
handler: async ({ layerId, ids }) => {
|
|
8266
|
+
await c.prepareStickers(c.listStickers(layerId).map((s) => s.ref));
|
|
8267
|
+
return { removed: c.removeStickers(layerId, ids) };
|
|
8268
|
+
}
|
|
8157
8269
|
}
|
|
8158
8270
|
];
|
|
8159
8271
|
}
|
|
@@ -8419,7 +8531,7 @@ function createPaintGuideTools(c) {
|
|
|
8419
8531
|
type: "object",
|
|
8420
8532
|
properties: {
|
|
8421
8533
|
color: { ...COLOR2, description: "A colour #rrggbb." },
|
|
8422
|
-
paint: { ...
|
|
8534
|
+
paint: { ..._chunkI7NJPHWVcjs.PAINT_SOURCE_JSON_SCHEMA, description: "Gradient paint (or a colour) for the swatch, instead of color." },
|
|
8423
8535
|
name: { type: "string", minLength: 1, description: "Optional name." }
|
|
8424
8536
|
},
|
|
8425
8537
|
additionalProperties: false
|
|
@@ -8573,7 +8685,7 @@ function createPaintGuideTools(c) {
|
|
|
8573
8685
|
const pad = c.mixingPad;
|
|
8574
8686
|
return {
|
|
8575
8687
|
content: [
|
|
8576
|
-
{ type: "image", data:
|
|
8688
|
+
{ type: "image", data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, _chunkW5M3J7PVcjs.encodePng.call(void 0, pad.width, pad.height, pad.pixels())), mimeType: "image/png" },
|
|
8577
8689
|
{ type: "text", text: `Mixing pad ${pad.width}\xD7${pad.height}` }
|
|
8578
8690
|
]
|
|
8579
8691
|
};
|
|
@@ -8715,7 +8827,7 @@ function createPaintWetTools(c) {
|
|
|
8715
8827
|
type: "object",
|
|
8716
8828
|
properties: {
|
|
8717
8829
|
layerId: LAYER_ID2,
|
|
8718
|
-
kind: { type: "string", enum: [...
|
|
8830
|
+
kind: { type: "string", enum: [..._chunkKBYB7OWBcjs.WET_FLOW_KINDS], description: "none, linear, swirl, radial or turbulent." },
|
|
8719
8831
|
strength: UNIT("How hard it pushes, 0..1 (1 is about a 25\xB0 tilt; default 0.5)."),
|
|
8720
8832
|
angle: { type: "number", minimum: -360, maximum: 360, description: "linear: direction in degrees clockwise from canvas down (default 0)." },
|
|
8721
8833
|
center: {
|
|
@@ -8914,7 +9026,7 @@ function createPaintReplayTools(c) {
|
|
|
8914
9026
|
await c.wetIdle();
|
|
8915
9027
|
const tl = await c.timeLapse({ frames: a.frames, fps: a.fps, maxSide: a.maxSide, wetStepsPerFrame: a.wetStepsPerFrame, holdMs: a.holdMs });
|
|
8916
9028
|
const pick = [0, Math.floor(tl.frames.length / 3), Math.floor(2 * tl.frames.length / 3), tl.frames.length - 1].filter((v, i, arr) => arr.indexOf(v) === i);
|
|
8917
|
-
const sheet = contactSheet(pick.map((i) =>
|
|
9029
|
+
const sheet = contactSheet(pick.map((i) => _chunkW5M3J7PVcjs.decodePng.call(void 0, tl.frames[i])), pick.length, 160);
|
|
8918
9030
|
const info = {
|
|
8919
9031
|
frames: tl.frames.length,
|
|
8920
9032
|
fps: tl.fps,
|
|
@@ -8923,9 +9035,9 @@ function createPaintReplayTools(c) {
|
|
|
8923
9035
|
durationMs: tl.durationMs,
|
|
8924
9036
|
ffmpeg: tl.ffmpeg.command,
|
|
8925
9037
|
video: tl.video,
|
|
8926
|
-
...a.includeFrames ? { framesPng: tl.frames.map((f) =>
|
|
9038
|
+
...a.includeFrames ? { framesPng: tl.frames.map((f) => _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, f)) } : {}
|
|
8927
9039
|
};
|
|
8928
|
-
return { content: [{ type: "image", data:
|
|
9040
|
+
return { content: [{ type: "image", data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, _chunkW5M3J7PVcjs.encodePng.call(void 0, sheet.width, sheet.height, sheet.data)), mimeType: "image/png" }, { type: "text", text: JSON.stringify(info) }] };
|
|
8929
9041
|
}
|
|
8930
9042
|
},
|
|
8931
9043
|
{
|
|
@@ -8945,8 +9057,8 @@ function createPaintReplayTools(c) {
|
|
|
8945
9057
|
handler: async ({ scale, paper }) => {
|
|
8946
9058
|
await c.wetIdle();
|
|
8947
9059
|
const img = await c.renderHighRes({ scale, paper });
|
|
8948
|
-
const bytes =
|
|
8949
|
-
return { mimeType: "image/png", width: img.width, height: img.height, bytes: bytes.length, data:
|
|
9060
|
+
const bytes = _chunkW5M3J7PVcjs.encodePng.call(void 0, img.width, img.height, img.data);
|
|
9061
|
+
return { mimeType: "image/png", width: img.width, height: img.height, bytes: bytes.length, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, bytes) };
|
|
8950
9062
|
}
|
|
8951
9063
|
}
|
|
8952
9064
|
];
|
|
@@ -8964,7 +9076,7 @@ var TIP = {
|
|
|
8964
9076
|
type: "object",
|
|
8965
9077
|
description: "The tip (the shared brush engine). Missing fields keep their current values.",
|
|
8966
9078
|
properties: {
|
|
8967
|
-
size: { type: "number", minimum: 1, maximum:
|
|
9079
|
+
size: { type: "number", minimum: 1, maximum: _chunkI7NJPHWVcjs.MAX_BRUSH_SIZE, description: "Diameter in pixels." },
|
|
8968
9080
|
hardness: { type: "number", minimum: 0, maximum: 1, description: "Edge hardness, 0 (soft) .. 1 (hard)." },
|
|
8969
9081
|
spacing: { type: "number", minimum: 0.01, maximum: 10, description: "Dab spacing as a fraction of the diameter (0.05 is smooth, 1 is dotted)." },
|
|
8970
9082
|
angle: { type: "number", minimum: -360, maximum: 360, description: "Tip angle in degrees, counter-clockwise; with rotation stroke or barrel it is added to the stroke direction or pen rotation." },
|
|
@@ -8976,7 +9088,7 @@ var TIP = {
|
|
|
8976
9088
|
pressureOpacity: { type: "boolean", description: "Pressure scales the opacity." },
|
|
8977
9089
|
blend: {
|
|
8978
9090
|
type: "string",
|
|
8979
|
-
enum:
|
|
9091
|
+
enum: _chunk2VX55NFMcjs.BLEND_MODES.map((m) => m.id),
|
|
8980
9092
|
description: "How paint combines with the layer. pigment mixes it in like real paint (blue into yellow gives green); multiply darkens like marker ink; watercolor glazes like a transparent wash; tint, highlight and shadow recolour, light and shade (see list_blend_modes)."
|
|
8981
9093
|
}
|
|
8982
9094
|
},
|
|
@@ -9009,11 +9121,11 @@ var MIXER = {
|
|
|
9009
9121
|
mix: { type: "number", minimum: 0, maximum: 1, description: "Mix ratio: how far each dab's paint moves from the reservoir towards the picked-up colour." },
|
|
9010
9122
|
loadEachStroke: { type: "boolean", description: "Refill the reservoir with the colour before each stroke." },
|
|
9011
9123
|
cleanEachStroke: { type: "boolean", description: "Empty the pickup well after each stroke." },
|
|
9012
|
-
mixing: { type: "string", enum: [...
|
|
9124
|
+
mixing: { type: "string", enum: [..._chunkI7NJPHWVcjs.MIXING_MODELS], description: "rgb: RGB averages. pigment: mixes like paint (Kubelka-Munk)." }
|
|
9013
9125
|
},
|
|
9014
9126
|
additionalProperties: false
|
|
9015
9127
|
};
|
|
9016
|
-
var MIXING = { type: "string", enum: [...
|
|
9128
|
+
var MIXING = { type: "string", enum: [..._chunkI7NJPHWVcjs.MIXING_MODELS], description: "pigment: mixes like paint (Kubelka-Munk, blue and yellow make green); rgb: straight RGB averages." };
|
|
9017
9129
|
var BEHAVIOR = {
|
|
9018
9130
|
type: "object",
|
|
9019
9131
|
description: "How the brush handles paint on the canvas (dab and mixer engines; on a mixer brush pickup, mix, dirty and mixing are its mixer wet, mix, !cleanEachStroke and mixing). Missing fields keep their current values.",
|
|
@@ -9026,7 +9138,7 @@ var BEHAVIOR = {
|
|
|
9026
9138
|
type: "object",
|
|
9027
9139
|
description: "Multi-coloured brush (the older form of paint, the brush's own gradient: tip is across-tip, dab is distance in dabs or random). Read back from paint when it has a multi-colour equivalent. Missing fields keep their current values.",
|
|
9028
9140
|
properties: {
|
|
9029
|
-
mode: { type: "string", enum: [...
|
|
9141
|
+
mode: { type: "string", enum: [..._chunkGT77U7QGcjs.MULTI_COLOR_MODES], description: "off; tip: the colours lie side by side across the tip (stripes along the stroke, like a brush loaded with several paints); dab: the colour changes along the stroke." },
|
|
9030
9142
|
colors: { type: "array", maxItems: 8, items: { ...COLOR3 }, description: "2..8 colours #rrggbb; fewer than 2 uses the paint colour and the secondary colour." },
|
|
9031
9143
|
order: { type: "string", enum: ["sequence", "random"], description: "dab mode: sequence runs through the colours in order, blending between them; random picks one per run of dabs (seeded)." },
|
|
9032
9144
|
length: { type: "integer", minimum: 1, maximum: 500, description: "dab mode: dabs per colour (default 12)." },
|
|
@@ -9039,7 +9151,7 @@ var BEHAVIOR = {
|
|
|
9039
9151
|
};
|
|
9040
9152
|
var BRUSH_PAINT = {
|
|
9041
9153
|
description: `The brush's own gradient paint, used instead of the editor's paint (null: the editor's paint). It is what the multi-colour settings became; stops may be "paint" / "secondary" for the editor's two colours.`,
|
|
9042
|
-
anyOf: [
|
|
9154
|
+
anyOf: [_chunkI7NJPHWVcjs.PAINT_GRADIENT_JSON_SCHEMA, { type: "null", description: "No gradient of its own: the editor's paint." }]
|
|
9043
9155
|
};
|
|
9044
9156
|
var BLENDER = {
|
|
9045
9157
|
type: "object",
|
|
@@ -9067,10 +9179,10 @@ var WET_BRUSH = {
|
|
|
9067
9179
|
properties: {
|
|
9068
9180
|
tool: {
|
|
9069
9181
|
type: "string",
|
|
9070
|
-
enum: [...
|
|
9182
|
+
enum: [..._chunkGT77U7QGcjs.WET_TOOLS],
|
|
9071
9183
|
description: "paint: water and pigment (picks up and mixes wet paint by behavior.pickup / mix); water: clear water (with rewet it lifts dried paint); dry: a hair dryer, takes water; blow: pushes the water along the stroke; blend: evens out wet pigment; smudge: drags wet paint; blot: a tissue, takes wet paint up (erase wet)."
|
|
9072
9184
|
},
|
|
9073
|
-
medium: { type: "string", enum: [...
|
|
9185
|
+
medium: { type: "string", enum: [..._chunkGT77U7QGcjs.WET_MEDIA], description: "The medium: watercolor, gouache or oil. A layer takes the medium's wet settings the first time it holds wet paint (oil: thick, barely flows, stays wet long and blends into the wet paint it meets)." },
|
|
9074
9186
|
load: { type: "number", minimum: 0, maximum: 1, description: "Paint loading: 1 never runs out; lower, the brush runs dry along a long stroke (each stroke reloads)." },
|
|
9075
9187
|
thinner: { type: "number", minimum: 0, maximum: 1, description: "Thinner (water or solvent): more transparent, runnier paint." },
|
|
9076
9188
|
water: { type: "number", minimum: 0, maximum: 1, description: "Wetness: water laid per stroke, 0.2 a damp brush .. 1 a dripping one." },
|
|
@@ -9087,7 +9199,7 @@ var IMPASTO_BRUSH = {
|
|
|
9087
9199
|
properties: {
|
|
9088
9200
|
tool: {
|
|
9089
9201
|
type: "string",
|
|
9090
|
-
enum: [...
|
|
9202
|
+
enum: [..._chunkGT77U7QGcjs.IMPASTO_TOOLS],
|
|
9091
9203
|
description: "brush: thick paint with bristle ridges along the stroke; tube: blobs squeezed from the tube; knife: a palette knife that scrapes the relief flat and smears the paint; roller: a flat stippled band; gloop: a thick, glossy, rounded bead."
|
|
9092
9204
|
},
|
|
9093
9205
|
thickness: { type: "number", minimum: 0, maximum: 1, description: "How far the paint stands up." },
|
|
@@ -9116,12 +9228,12 @@ var PARTICLE_BRUSH = {
|
|
|
9116
9228
|
properties: {
|
|
9117
9229
|
kind: {
|
|
9118
9230
|
type: "string",
|
|
9119
|
-
enum: [...
|
|
9231
|
+
enum: [..._chunkGT77U7QGcjs.PARTICLE_KINDS],
|
|
9120
9232
|
description: "string: strands of masses on springs dragged behind the pen (hair, fur, wet string); spring: particles on springs to the pen, overshooting and wobbling; orbit: particles circling the pen (curls); flow: particles thrown off the pen into a swirling flow until they fade; elastic: strands whose links keep a rest length, stretching when the pen is fast and snapping back; fuzzy: winding strings, each strand waving out of step with the others (always waves by at least 0.12 of the tip size)."
|
|
9121
9233
|
},
|
|
9122
9234
|
render: {
|
|
9123
9235
|
type: "string",
|
|
9124
|
-
enum: [...
|
|
9236
|
+
enum: [..._chunkGT77U7QGcjs.PARTICLE_RENDERS],
|
|
9125
9237
|
description: "dot: a mark at each step (round, or dotTextures); line: each particle draws a continuous line; sequence: beads spaced along each path (round, or dotTextures); ribbon: the band between neighbouring particles' paths filled (ribbonFill), with the paths drawn as its edges at the mark size (flame, silk, smoke)."
|
|
9126
9238
|
},
|
|
9127
9239
|
count: { type: "integer", minimum: 1, maximum: 64, description: "Particles (flow: how many are thrown per tip of travel)." },
|
|
@@ -9134,19 +9246,19 @@ var PARTICLE_BRUSH = {
|
|
|
9134
9246
|
life: { type: "number", minimum: 0, maximum: 1, description: "Flow particles: how long they live." },
|
|
9135
9247
|
interval: { type: "number", minimum: 0, maximum: 1, description: "Sequence: spacing of the beads." },
|
|
9136
9248
|
ribbonFill: { type: "number", minimum: 0, maximum: 1, description: "Ribbon: opacity of the fill between the paths, relative to their edges (default 0.5; 0 draws only the edges)." },
|
|
9137
|
-
ribbonPairs: { type: "string", enum: [...
|
|
9249
|
+
ribbonPairs: { type: "string", enum: [..._chunkGT77U7QGcjs.RIBBON_PAIRS], description: "Ribbon: adjacent (default) joins each particle to its neighbour around the pen; first-last makes one band between the outermost two." },
|
|
9138
9250
|
waveAmplitude: { type: "number", minimum: 0, maximum: 1, description: "Wave: how far each particle's drawn place swings sideways to the stroke, as a fraction of the tip size (default 0: no wave). Works with every kind and render." },
|
|
9139
9251
|
waveLength: { type: "number", minimum: 4, maximum: 2e3, description: "Wave: wavelength in px of pen travel (default 60)." },
|
|
9140
9252
|
waveSpeed: { type: "number", minimum: 0, maximum: 1, description: "Wave: how fast the waves run, by stroke time (0 default: they stand still on the path; 1: about four a second, so slow strokes wave more). Strokes without times run at a nominal 0.5 px/ms." },
|
|
9141
9253
|
wavePhaseJitter: { type: "number", minimum: 0, maximum: 1, description: "Wave: how far out of step the particles' waves are (default 0: all in step, a wavy band; 1: random phases, tangled strands)." },
|
|
9142
9254
|
dotTextures: {
|
|
9143
9255
|
type: "array",
|
|
9144
|
-
maxItems:
|
|
9145
|
-
items: { type: "string", enum: [...
|
|
9146
|
-
description: `Dot and sequence renders: up to ${
|
|
9256
|
+
maxItems: _chunkGT77U7QGcjs.MAX_DOT_TEXTURES,
|
|
9257
|
+
items: { type: "string", enum: [..._chunk4JNWA3VTcjs.STAMP_KINDS], description: "A stamp." },
|
|
9258
|
+
description: `Dot and sequence renders: up to ${_chunkGT77U7QGcjs.MAX_DOT_TEXTURES} sticker stamps (list_stickers) drawn instead of round marks; repeats are allowed (they weight the order). Empty (default): round marks.`
|
|
9147
9259
|
},
|
|
9148
|
-
dotTextureOrder: { type: "string", enum: [...
|
|
9149
|
-
dotRotation: { type: "string", enum: [...
|
|
9260
|
+
dotTextureOrder: { type: "string", enum: [..._chunkGT77U7QGcjs.DOT_TEXTURE_ORDERS], description: "Textured dots: sequence (default) uses the stamps in turn; random picks one per dot (seeded, so replays are exact)." },
|
|
9261
|
+
dotRotation: { type: "string", enum: [..._chunkGT77U7QGcjs.DOT_ROTATIONS], description: "Textured dots: follow turns each with its particle's motion; random (default) turns each at random; fixed uses the tip angle." }
|
|
9150
9262
|
},
|
|
9151
9263
|
additionalProperties: false
|
|
9152
9264
|
};
|
|
@@ -9167,7 +9279,13 @@ var STICKER_BRUSH = {
|
|
|
9167
9279
|
type: "object",
|
|
9168
9280
|
description: "Sticker engine settings: stamps sprayed along the stroke as editable stickers. Missing fields keep their current values.",
|
|
9169
9281
|
properties: {
|
|
9170
|
-
stamps: {
|
|
9282
|
+
stamps: {
|
|
9283
|
+
type: "array",
|
|
9284
|
+
minItems: 1,
|
|
9285
|
+
maxItems: _chunkGT77U7QGcjs.MAX_STICKER_STAMPS,
|
|
9286
|
+
items: { type: "string", minLength: 1, description: "A sticker ref provider:id from find_stickers (e.g. editor:star); a bare editor stamp (star) means editor:star." },
|
|
9287
|
+
description: `The stickers to spray, one picked at random per sticker: refs from find_stickers (the editor's own: ${_chunk4JNWA3VTcjs.STAMP_KINDS.map((k) => `editor:${k}`).join(", ")}). Each is checked against the sticker library and an unknown ref is refused with the closest ones. A provider's sticker is drawn from its art (tinted to the paint colour when tintable), loaded before the stroke.`
|
|
9288
|
+
},
|
|
9171
9289
|
density: { type: "number", minimum: 0, maximum: 1, description: "How closely stickers follow each other: about density \xD7 4 stickers per tip diameter of travel (0.25 \u2248 one per diameter, 1 \u2248 four). Default 0.4." },
|
|
9172
9290
|
sizeJitter: { type: "number", minimum: 0, maximum: 1, description: "Random size change." },
|
|
9173
9291
|
rotationJitter: { type: "number", minimum: 0, maximum: 1, description: "Random turn as a fraction of \xB1180\xB0." },
|
|
@@ -9178,16 +9296,16 @@ var STICKER_BRUSH = {
|
|
|
9178
9296
|
};
|
|
9179
9297
|
var BRUSH_FIELDS = {
|
|
9180
9298
|
name: { type: "string", minLength: 1, maxLength: 80, description: "Display name." },
|
|
9181
|
-
category: { type: "string", enum: [...
|
|
9299
|
+
category: { type: "string", enum: [..._chunkGT77U7QGcjs.PAINT_BRUSH_CATEGORIES], description: "Library category." },
|
|
9182
9300
|
engine: {
|
|
9183
9301
|
type: "string",
|
|
9184
|
-
enum: [...
|
|
9302
|
+
enum: [..._chunkGT77U7QGcjs.PAINT_BRUSH_ENGINES],
|
|
9185
9303
|
description: "dab: paints dabs (with behavior.pickup or gradient paint it paints dab by dab, lifting and mixing paint); eraser: removes paint; mixer: the Mixer Brush (a reservoir plus picked-up paint); blender: mixes the colours under and near the tip; smudge: drags paint along the stroke; wet: watercolour, gouache, oil and the wet tools on a simulated wet layer (see wet); impasto: thick paint with relief (see impasto); particle: procedural particle brushes (see particle); bristle: a tuft of bristles that bend and splay (see bristle); sticker: sprays editable sticker stamps (see sticker)."
|
|
9186
9304
|
},
|
|
9187
9305
|
tip: TIP,
|
|
9188
9306
|
grain: { type: "number", minimum: 0, maximum: 1, description: "Paper grain response: 0 ignores the grain, 1 catches only its peaks at light pressure (pencil, pastel, charcoal). Multiplied by the paper depth." },
|
|
9189
9307
|
pressureSmoothing: { type: "number", minimum: 0, maximum: 0.95, description: "Pressure smoothing, separate from the tip position smoothing." },
|
|
9190
|
-
rotation: { type: "string", enum: [...
|
|
9308
|
+
rotation: { type: "string", enum: [..._chunkGT77U7QGcjs.BRUSH_ROTATIONS], description: "What turns the tip: fixed (tip.angle), stroke (follows the direction of travel) or barrel (the pen barrel rotation, twist)." },
|
|
9191
9309
|
dynamics: DYNAMICS,
|
|
9192
9310
|
mixer: MIXER,
|
|
9193
9311
|
loadsColor: { type: "boolean", description: "Mixer engine: load the colour each stroke (false for a mixer that only moves paint)." },
|
|
@@ -9239,7 +9357,7 @@ function brushSummary(b) {
|
|
|
9239
9357
|
size: b.tip.size,
|
|
9240
9358
|
grain: b.grain,
|
|
9241
9359
|
rotation: b.rotation,
|
|
9242
|
-
wetCapable:
|
|
9360
|
+
wetCapable: _chunkGT77U7QGcjs.isWetCapable.call(void 0, b),
|
|
9243
9361
|
pickup: b.behavior.pickup,
|
|
9244
9362
|
dirty: b.behavior.dirty,
|
|
9245
9363
|
multicolor: b.behavior.multicolor.mode,
|
|
@@ -9286,7 +9404,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9286
9404
|
strokes: d.strokes.length,
|
|
9287
9405
|
undo: s.undoLabel,
|
|
9288
9406
|
redo: s.redoLabel,
|
|
9289
|
-
blendModes:
|
|
9407
|
+
blendModes: _chunk2VX55NFMcjs.BLEND_MODES.map((m) => m.id),
|
|
9290
9408
|
wet: s.wet.wet,
|
|
9291
9409
|
lighting: c.getLighting()
|
|
9292
9410
|
};
|
|
@@ -9348,9 +9466,9 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9348
9466
|
inputSchema: EMPTY3,
|
|
9349
9467
|
annotations: { title: "List papers", ...READ6 },
|
|
9350
9468
|
handler: () => ({
|
|
9351
|
-
papers:
|
|
9352
|
-
families: [...
|
|
9353
|
-
patterns: [...
|
|
9469
|
+
papers: _chunkGT77U7QGcjs.PAPER_LIBRARY.map((p) => ({ id: p.preset, name: p.name, family: p.family, pattern: p.pattern, color: p.color, depth: p.depth, absorption: p.absorption, permeability: p.permeability, roughness: p.roughness })),
|
|
9470
|
+
families: [..._chunkGT77U7QGcjs.PAPER_FAMILIES],
|
|
9471
|
+
patterns: [..._chunkI7NJPHWVcjs.GRAIN_PATTERNS]
|
|
9354
9472
|
})
|
|
9355
9473
|
});
|
|
9356
9474
|
add({
|
|
@@ -9381,7 +9499,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9381
9499
|
depth: { type: "number", minimum: 0, maximum: 1, description: "Grain depth 0..1 (0: brushes ignore the grain)." },
|
|
9382
9500
|
scale: { type: "number", minimum: 0.25, maximum: 8, description: "Grain scale: 1 natural, 2 twice as coarse." },
|
|
9383
9501
|
seed: { type: "integer", minimum: 0, description: "Grain seed: another sheet of the same paper." },
|
|
9384
|
-
pattern: { type: "string", enum: [...
|
|
9502
|
+
pattern: { type: "string", enum: [..._chunkI7NJPHWVcjs.GRAIN_PATTERNS], description: "Grain pattern." },
|
|
9385
9503
|
tiling: { type: "string", enum: ["repeat", "mirror"], description: "How the grain tile repeats (mirror hides seams)." },
|
|
9386
9504
|
shading: { type: "number", minimum: 0, maximum: 1, description: "How much the grain shades the paper colour." },
|
|
9387
9505
|
dry: { ...tuning, description: "Height map tuning for dry media." },
|
|
@@ -9439,7 +9557,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9439
9557
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0..1." },
|
|
9440
9558
|
blend: {
|
|
9441
9559
|
type: "string",
|
|
9442
|
-
enum: [...
|
|
9560
|
+
enum: [..._chunk2VX55NFMcjs.BLEND_MODES.map((m) => m.id), "pass-through"],
|
|
9443
9561
|
description: "Blend mode (pass-through for groups only). Painterly modes: watercolor (the layer glazes like a transparent wash), tint (recolours keeping lightness), highlight (adds soft coloured light), shadow (shades with ambient fill); see list_blend_modes."
|
|
9444
9562
|
},
|
|
9445
9563
|
clipped: { type: "boolean", description: "Clip to the layer below (paint only shows where it has paint)." },
|
|
@@ -9469,12 +9587,12 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9469
9587
|
inputSchema: EMPTY3,
|
|
9470
9588
|
annotations: { title: "List blend modes", ...READ6 },
|
|
9471
9589
|
handler: () => ({
|
|
9472
|
-
modes:
|
|
9590
|
+
modes: _chunk2VX55NFMcjs.BLEND_MODES.map((m) => ({
|
|
9473
9591
|
id: m.id,
|
|
9474
9592
|
label: m.label,
|
|
9475
9593
|
group: m.painterly ? "painterly" : m.id === "pigment" ? "pigment" : "standard",
|
|
9476
9594
|
...m.description ? { description: m.description } : {},
|
|
9477
|
-
psd:
|
|
9595
|
+
psd: _chunk2VX55NFMcjs.standardBlendMode.call(void 0, m.id)
|
|
9478
9596
|
}))
|
|
9479
9597
|
})
|
|
9480
9598
|
});
|
|
@@ -9546,7 +9664,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9546
9664
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Opacity 0..1 (default 1)." },
|
|
9547
9665
|
grain: { type: "number", minimum: 0, maximum: 1, description: "Paper grain response 0..1 (default 0: flat)." },
|
|
9548
9666
|
pressure: { type: "number", minimum: 0, maximum: 1, description: "With grain: how far into the valleys, 0..1 (default 0.5)." },
|
|
9549
|
-
blend: { type: "string", enum:
|
|
9667
|
+
blend: { type: "string", enum: _chunk2VX55NFMcjs.BLEND_MODES.map((m) => m.id), description: "Blend mode (default normal; pigment mixes like paint, watercolor glazes; see list_blend_modes)." }
|
|
9550
9668
|
},
|
|
9551
9669
|
additionalProperties: false
|
|
9552
9670
|
},
|
|
@@ -9571,7 +9689,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9571
9689
|
annotations: { title: "List brushes", ...READ6 },
|
|
9572
9690
|
handler: () => {
|
|
9573
9691
|
const s = c.getState();
|
|
9574
|
-
return { activeBrushId: s.brush.id, activeEdited: !s.brush.builtin && Boolean(_optionalChain([c, 'access',
|
|
9692
|
+
return { activeBrushId: s.brush.id, activeEdited: !s.brush.builtin && Boolean(_optionalChain([c, 'access', _499 => _499.getBrush, 'call', _500 => _500(s.brush.id), 'optionalAccess', _501 => _501.builtin])), brushes: s.brushes.map(brushSummary) };
|
|
9575
9693
|
}
|
|
9576
9694
|
});
|
|
9577
9695
|
add({
|
|
@@ -9582,10 +9700,10 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9582
9700
|
annotations: { title: "Get a brush", ...READ6 },
|
|
9583
9701
|
handler: ({ id }) => {
|
|
9584
9702
|
const st = c.getState();
|
|
9585
|
-
if (id === void 0) return { ...
|
|
9703
|
+
if (id === void 0) return { ..._chunkGT77U7QGcjs.brushToJSON.call(void 0, st.brush), strokePaint: _nullishCoalesce(st.brush.paint, () => ( st.paint)) };
|
|
9586
9704
|
const b = c.getBrush(id);
|
|
9587
9705
|
if (!b) throw new Error(`Unknown brush "${id}". Call list_brushes for the ids.`);
|
|
9588
|
-
return { ...
|
|
9706
|
+
return { ..._chunkGT77U7QGcjs.brushToJSON.call(void 0, b), builtin: Boolean(b.builtin), strokePaint: _nullishCoalesce(b.paint, () => ( st.paint)) };
|
|
9589
9707
|
}
|
|
9590
9708
|
});
|
|
9591
9709
|
add({
|
|
@@ -9594,7 +9712,11 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9594
9712
|
description: "Chooses the active brush (id) and / or changes its settings; strokes without a brush use it. Editor state, not an undo step. Changes stay on the active brush until save_brush stores them. Returns the active brush.",
|
|
9595
9713
|
inputSchema: { type: "object", properties: { id: { type: "string", description: "Brush id from list_brushes to start from." }, ...BRUSH_FIELDS }, additionalProperties: false },
|
|
9596
9714
|
annotations: { title: "Set the brush", ...SET4 },
|
|
9597
|
-
handler: (a) =>
|
|
9715
|
+
handler: async (a) => {
|
|
9716
|
+
const stamps = _optionalChain([a, 'access', _502 => _502.sticker, 'optionalAccess', _503 => _503.stamps]);
|
|
9717
|
+
if (stamps) await c.prepareStickers(stamps);
|
|
9718
|
+
return _chunkGT77U7QGcjs.brushToJSON.call(void 0, c.setBrush(a));
|
|
9719
|
+
}
|
|
9598
9720
|
});
|
|
9599
9721
|
add({
|
|
9600
9722
|
name: "save_brush",
|
|
@@ -9610,7 +9732,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9610
9732
|
additionalProperties: false
|
|
9611
9733
|
},
|
|
9612
9734
|
annotations: { title: "Save a brush", ...SET4 },
|
|
9613
|
-
handler: ({ id, name }) =>
|
|
9735
|
+
handler: ({ id, name }) => _chunkGT77U7QGcjs.brushToJSON.call(void 0, c.saveBrush({ id, name }))
|
|
9614
9736
|
});
|
|
9615
9737
|
add({
|
|
9616
9738
|
name: "remove_brush",
|
|
@@ -9670,7 +9792,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9670
9792
|
const t = c.brushThumbnail(_nullishCoalesce(id, () => ( c.getState().brush.id)), { width, height, color });
|
|
9671
9793
|
return {
|
|
9672
9794
|
content: [
|
|
9673
|
-
{ type: "image", data:
|
|
9795
|
+
{ type: "image", data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, _chunkW5M3J7PVcjs.encodePng.call(void 0, t.width, t.height, t.data)), mimeType: "image/png" },
|
|
9674
9796
|
{ type: "text", text: `Brush ${_nullishCoalesce(id, () => ( c.getState().brush.id))} ${t.width}\xD7${t.height}` }
|
|
9675
9797
|
]
|
|
9676
9798
|
};
|
|
@@ -9697,7 +9819,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9697
9819
|
name: "set_paint",
|
|
9698
9820
|
title: "Set the paint (colour or gradient)",
|
|
9699
9821
|
description: 'Sets what strokes paint with: one colour, or gradient paint that changes colour as the stroke goes. Gradient paint: 2..16 stops sorted by offset (#rrggbb, or "paint" / "secondary" for the two editor colours), space pigment (default: mixes like paint) / oklab / srgb, and map: distance (default: the colour changes as the stroke is dragged out, 300 px then mirrored back), pressure, tilt, velocity, direction, time, across-tip or random. Every stroking brush samples it per dab (dab, mixer, watercolour and gouache, oil and impasto, particle, bristle, sticker); erasers, blenders and smudges ignore it, and a brush with its own gradient (get_brush paint) paints that instead. It also ends effect paint (set_effect_paint); set_color goes back to one colour. Editor state, not an undo step. Returns paint, color and secondaryColor.',
|
|
9700
|
-
inputSchema: { type: "object", properties: { paint:
|
|
9822
|
+
inputSchema: { type: "object", properties: { paint: _chunkI7NJPHWVcjs.PAINT_SOURCE_JSON_SCHEMA }, required: ["paint"], additionalProperties: false },
|
|
9701
9823
|
annotations: { title: "Set the paint (colour or gradient)", ...SET4 },
|
|
9702
9824
|
handler: ({ paint }) => {
|
|
9703
9825
|
const p = c.setPaint(paint);
|
|
@@ -9759,7 +9881,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9759
9881
|
brushId: { type: "string", description: "Brush id from list_brushes (default the active brush)." },
|
|
9760
9882
|
brush: { type: "object", description: "Brush changes for this stroke only.", properties: BRUSH_FIELDS, additionalProperties: false },
|
|
9761
9883
|
color: { ...COLOR3, description: "Paint colour #rrggbb (default the paint colour)." },
|
|
9762
|
-
paint: { ...
|
|
9884
|
+
paint: { ..._chunkI7NJPHWVcjs.PAINT_SOURCE_JSON_SCHEMA, description: "What this stroke paints with instead of the editor's paint: a colour, or gradient paint that changes colour as the stroke goes (by distance, pressure, tilt, speed, direction, time, across the tip or at random). Wins over the brush's own gradient." },
|
|
9763
9885
|
seed: { type: "integer", minimum: 0, description: "Jitter seed (default a new one); the same seed and points give the same marks." },
|
|
9764
9886
|
snapToPerspective: { type: "boolean", description: "Snap the points to the perspective guide, as a pen stroke would (default false)." }
|
|
9765
9887
|
},
|
|
@@ -9770,6 +9892,9 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9770
9892
|
coordinates: { in: ["points[]"], out: ["bounds"] },
|
|
9771
9893
|
handler: async (a) => {
|
|
9772
9894
|
await c.wetIdle();
|
|
9895
|
+
const base = a.brushId ? c.getBrush(a.brushId) : c.getState().brush;
|
|
9896
|
+
const over = a.brush;
|
|
9897
|
+
if ((_nullishCoalesce(_optionalChain([over, 'optionalAccess', _504 => _504.engine]), () => ( _optionalChain([base, 'optionalAccess', _505 => _505.engine])))) === "sticker") await c.prepareStickers(_nullishCoalesce(_nullishCoalesce(_optionalChain([over, 'optionalAccess', _506 => _506.sticker, 'optionalAccess', _507 => _507.stamps]), () => ( _optionalChain([base, 'optionalAccess', _508 => _508.sticker, 'access', _509 => _509.stamps]))), () => ( [])));
|
|
9773
9898
|
const stroke = { points: a.points, layerId: a.layerId, brushId: a.brushId, brush: a.brush, color: a.color, paint: a.paint, seed: a.seed, snapToPerspective: a.snapToPerspective };
|
|
9774
9899
|
const r = await act({ kind: "stroke", stroke }, () => c.paintStroke(stroke));
|
|
9775
9900
|
return r.mixerLoad ? { ...r, mixerLoad: loadResult(r.mixerLoad) } : r;
|
|
@@ -9801,7 +9926,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9801
9926
|
if (ids) {
|
|
9802
9927
|
for (const id of ids) if (!all.some((s) => s.id === id)) throw new Error(`Unknown stroke "${id}". Call list_strokes without ids for the ids.`);
|
|
9803
9928
|
}
|
|
9804
|
-
return { total: all.length, strokes: picked.map((s) => strokeSummary(s, Boolean(ids), live ? true : liveIds.has(s.id) && _optionalChain([c, 'access',
|
|
9929
|
+
return { total: all.length, strokes: picked.map((s) => strokeSummary(s, Boolean(ids), live ? true : liveIds.has(s.id) && _optionalChain([c, 'access', _510 => _510.document, 'access', _511 => _511.liveStrokes, 'optionalAccess', _512 => _512[s.layerId], 'optionalAccess', _513 => _513.includes, 'call', _514 => _514(s)]) === true)) };
|
|
9805
9930
|
}
|
|
9806
9931
|
});
|
|
9807
9932
|
add({
|
|
@@ -9836,7 +9961,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
9836
9961
|
brushId: { type: "string", description: "Brush preset id from list_brushes; the stroke keeps its size." },
|
|
9837
9962
|
brush: { type: "object", properties: BRUSH_FIELDS, additionalProperties: false, description: "Brush settings to change on top of brushId or the stroke\u2019s brush; missing fields keep their values." },
|
|
9838
9963
|
color: { type: "string", pattern: "^#[0-9a-fA-F]{6}$", description: "New colour #rrggbb (replaces gradient paint)." },
|
|
9839
|
-
paint: { anyOf: [
|
|
9964
|
+
paint: { anyOf: [_chunkI7NJPHWVcjs.PAINT_SOURCE_JSON_SCHEMA, { type: "null", description: "Back to the stroke\u2019s plain colour." }], description: "A colour or gradient paint for the stroke; null drops its gradient." },
|
|
9840
9965
|
seed: { type: "integer", minimum: 0, description: "Another jitter seed: particles, scatter and texture fall differently." }
|
|
9841
9966
|
},
|
|
9842
9967
|
required: ["id"],
|
|
@@ -10058,7 +10183,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
10058
10183
|
handler: async ({ format, quality, scale, paper, time }) => {
|
|
10059
10184
|
const run = () => c.exportImage({ format, quality, scale, paper });
|
|
10060
10185
|
const bytes = time === void 0 ? await run() : await c.withEffectTime(time, run);
|
|
10061
|
-
return { mimeType: _nullishCoalesce(format, () => ( "image/png")), bytes: bytes.length, data:
|
|
10186
|
+
return { mimeType: _nullishCoalesce(format, () => ( "image/png")), bytes: bytes.length, data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, bytes) };
|
|
10062
10187
|
}
|
|
10063
10188
|
});
|
|
10064
10189
|
add({
|
|
@@ -10069,7 +10194,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
10069
10194
|
annotations: { title: "Export as PSD", ...READ6 },
|
|
10070
10195
|
handler: async ({ time }) => {
|
|
10071
10196
|
const r = time === void 0 ? c.exportPsd() : await c.withEffectTime(time, () => c.exportPsd());
|
|
10072
|
-
return { data:
|
|
10197
|
+
return { data: _chunkW5M3J7PVcjs.bytesToBase64.call(void 0, r.bytes), bytes: r.bytes.length, psb: r.psb, warnings: r.warnings };
|
|
10073
10198
|
}
|
|
10074
10199
|
});
|
|
10075
10200
|
tools.push(...createPaintGuideTools(c));
|
|
@@ -10077,9 +10202,10 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
10077
10202
|
tools.push(...createPaintThickTools(c));
|
|
10078
10203
|
tools.push(...createPaintReplayTools(c));
|
|
10079
10204
|
tools.push(...createPaintStickerTools(c));
|
|
10080
|
-
tools.push(...
|
|
10205
|
+
tools.push(..._chunkKBYB7OWBcjs.createPigmentTools.call(void 0, ));
|
|
10206
|
+
tools.push(..._chunk4JNWA3VTcjs.createStickerTools.call(void 0, { provider: () => c.stickersProvider }));
|
|
10081
10207
|
tools.push(
|
|
10082
|
-
...
|
|
10208
|
+
..._chunkM2VKFE5Lcjs.createLayerEffectTools.call(void 0,
|
|
10083
10209
|
{
|
|
10084
10210
|
requireLayer: (id) => void c.getLayerEffects(id),
|
|
10085
10211
|
getLayerEffects: (id) => c.getLayerEffects(id),
|
|
@@ -10104,16 +10230,16 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
10104
10230
|
}
|
|
10105
10231
|
function hostTool({ coordinates, ...tool }, { origin, onChange }) {
|
|
10106
10232
|
if (!origin && !onChange) return tool;
|
|
10107
|
-
const write = !_optionalChain([tool, 'access',
|
|
10233
|
+
const write = !_optionalChain([tool, 'access', _515 => _515.annotations, 'optionalAccess', _516 => _516.readOnlyHint]);
|
|
10108
10234
|
const done = (result) => {
|
|
10109
|
-
if (write) _optionalChain([onChange, 'optionalCall',
|
|
10110
|
-
return origin && _optionalChain([coordinates, 'optionalAccess',
|
|
10235
|
+
if (write) _optionalChain([onChange, 'optionalCall', _517 => _517({ tool: tool.name })]);
|
|
10236
|
+
return origin && _optionalChain([coordinates, 'optionalAccess', _518 => _518.out]) ? fromDocument(result, coordinates.out, origin) : result;
|
|
10111
10237
|
};
|
|
10112
10238
|
return {
|
|
10113
10239
|
...tool,
|
|
10114
10240
|
...origin ? { description: hostedText(_nullishCoalesce(tool.description, () => ( ""))), inputSchema: hostedSchema(tool.inputSchema) } : {},
|
|
10115
10241
|
handler: (args, context) => {
|
|
10116
|
-
const r = tool.handler(origin && _optionalChain([coordinates, 'optionalAccess',
|
|
10242
|
+
const r = tool.handler(origin && _optionalChain([coordinates, 'optionalAccess', _519 => _519.in]) ? toDocument(args, coordinates.in, origin) : args, context);
|
|
10117
10243
|
return r instanceof Promise ? r.then(done) : done(r);
|
|
10118
10244
|
}
|
|
10119
10245
|
};
|
|
@@ -10130,7 +10256,7 @@ function strokeSummary(s, withPoints, live) {
|
|
|
10130
10256
|
color: s.color,
|
|
10131
10257
|
points: withPoints ? s.points : s.points.length,
|
|
10132
10258
|
seed: s.seed,
|
|
10133
|
-
copies: _nullishCoalesce(_optionalChain([s, 'access',
|
|
10259
|
+
copies: _nullishCoalesce(_optionalChain([s, 'access', _520 => _520.copies, 'optionalAccess', _521 => _521.length]), () => ( 0)),
|
|
10134
10260
|
live,
|
|
10135
10261
|
bounds: { x: Math.floor(Math.min(...xs) - pad), y: Math.floor(Math.min(...ys) - pad), width: Math.ceil(Math.max(...xs) - Math.min(...xs) + 2 * pad), height: Math.ceil(Math.max(...ys) - Math.min(...ys) + 2 * pad) }
|
|
10136
10262
|
};
|
|
@@ -10146,20 +10272,20 @@ var PAINT_TOOLS = [
|
|
|
10146
10272
|
{ id: "rotate", label: "Rotate view", key: "r" }
|
|
10147
10273
|
];
|
|
10148
10274
|
var PaintGesture = (_class13 = class {
|
|
10149
|
-
constructor(controller, box) {;_class13.prototype.
|
|
10275
|
+
constructor(controller, box) {;_class13.prototype.__init139.call(this);_class13.prototype.__init140.call(this);_class13.prototype.__init141.call(this);_class13.prototype.__init142.call(this);_class13.prototype.__init143.call(this);_class13.prototype.__init144.call(this);
|
|
10150
10276
|
this.controller = controller;
|
|
10151
10277
|
this.box = box;
|
|
10152
10278
|
}
|
|
10153
10279
|
|
|
10154
10280
|
|
|
10155
|
-
|
|
10281
|
+
__init139() {this.tool = "brush"}
|
|
10156
10282
|
/** The last refusal (a hidden or locked layer), for the editor to show. */
|
|
10157
|
-
|
|
10283
|
+
__init140() {this.error = null}
|
|
10158
10284
|
/** The predicted tail of the current stroke in document pixels (draw it as a thin preview). */
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10285
|
+
__init141() {this.predicted = []}
|
|
10286
|
+
__init142() {this.mode = null}
|
|
10287
|
+
__init143() {this.penAt = null}
|
|
10288
|
+
__init144() {this.penDown = false}
|
|
10163
10289
|
doc(e) {
|
|
10164
10290
|
const b = this.box();
|
|
10165
10291
|
const s = this.controller.getState();
|
|
@@ -10215,13 +10341,13 @@ var PaintGesture = (_class13 = class {
|
|
|
10215
10341
|
const p = this.doc(e);
|
|
10216
10342
|
const s = this.controller.getState();
|
|
10217
10343
|
const layerId = s.document.activeLayerId;
|
|
10218
|
-
if (!layerId || !_optionalChain([s, 'access',
|
|
10344
|
+
if (!layerId || !_optionalChain([s, 'access', _522 => _522.document, 'access', _523 => _523.liveStrokes, 'optionalAccess', _524 => _524[layerId]])) {
|
|
10219
10345
|
this.error = "Pick a stroke layer in the Layers panel (or add one) to select its strokes.";
|
|
10220
10346
|
return false;
|
|
10221
10347
|
}
|
|
10222
10348
|
try {
|
|
10223
10349
|
const hit = this.controller.liveStrokeAt(layerId, p.x, p.y);
|
|
10224
|
-
this.controller.selectStroke(_nullishCoalesce(_optionalChain([hit, 'optionalAccess',
|
|
10350
|
+
this.controller.selectStroke(_nullishCoalesce(_optionalChain([hit, 'optionalAccess', _525 => _525.id]), () => ( null)));
|
|
10225
10351
|
if (!hit) return false;
|
|
10226
10352
|
this.mode = { kind: "move-stroke", pointerId: e.pointerId, id: hit.id, from: p, to: p };
|
|
10227
10353
|
return true;
|
|
@@ -10233,7 +10359,7 @@ var PaintGesture = (_class13 = class {
|
|
|
10233
10359
|
/** While a stroke is dragged: how far it has moved (document pixels), to draw its outline there. */
|
|
10234
10360
|
get strokeDrag() {
|
|
10235
10361
|
const m = this.mode;
|
|
10236
|
-
return _optionalChain([m, 'optionalAccess',
|
|
10362
|
+
return _optionalChain([m, 'optionalAccess', _526 => _526.kind]) === "move-stroke" ? { id: m.id, dx: m.to.x - m.from.x, dy: m.to.y - m.from.y } : null;
|
|
10237
10363
|
}
|
|
10238
10364
|
/**
|
|
10239
10365
|
* The Stickers tool: pressing a sticker picks it and dragging moves it (one undo step at the
|
|
@@ -10251,7 +10377,7 @@ var PaintGesture = (_class13 = class {
|
|
|
10251
10377
|
}
|
|
10252
10378
|
const brush = this.controller.getState().brush;
|
|
10253
10379
|
const size = Math.min(2048, Math.max(2, Math.round(brush.tip.size)));
|
|
10254
|
-
const [added] = this.controller.addStickers(void 0, [{
|
|
10380
|
+
const [added] = this.controller.addStickers(void 0, [{ ref: _nullishCoalesce(brush.sticker.stamps[0], () => ( "editor:star")), x: round2(p.x), y: round2(p.y), size }]);
|
|
10255
10381
|
this.controller.selectSticker(added.id);
|
|
10256
10382
|
} catch (err) {
|
|
10257
10383
|
this.error = err instanceof Error ? err.message : String(err);
|
|
@@ -10307,7 +10433,7 @@ var PaintGesture = (_class13 = class {
|
|
|
10307
10433
|
if (!m || m.pointerId !== e.pointerId) return;
|
|
10308
10434
|
this.mode = null;
|
|
10309
10435
|
this.predicted = [];
|
|
10310
|
-
if (m.kind === "stroke") _optionalChain([this, 'access',
|
|
10436
|
+
if (m.kind === "stroke") _optionalChain([this, 'access', _527 => _527.controller, 'access', _528 => _528.activeStroke, 'optionalAccess', _529 => _529.end, 'call', _530 => _530()]);
|
|
10311
10437
|
if (m.kind === "move-stroke") {
|
|
10312
10438
|
const dx = Math.round((this.doc(e).x - m.from.x) * 100) / 100;
|
|
10313
10439
|
const dy = Math.round((this.doc(e).y - m.from.y) * 100) / 100;
|
|
@@ -10331,8 +10457,8 @@ var PaintGesture = (_class13 = class {
|
|
|
10331
10457
|
cancel() {
|
|
10332
10458
|
this.penDown = false;
|
|
10333
10459
|
this.predicted = [];
|
|
10334
|
-
if (_optionalChain([this, 'access',
|
|
10335
|
-
if (_optionalChain([this, 'access',
|
|
10460
|
+
if (_optionalChain([this, 'access', _531 => _531.mode, 'optionalAccess', _532 => _532.kind]) === "stroke") _optionalChain([this, 'access', _533 => _533.controller, 'access', _534 => _534.activeStroke, 'optionalAccess', _535 => _535.cancel, 'call', _536 => _536()]);
|
|
10461
|
+
if (_optionalChain([this, 'access', _537 => _537.mode, 'optionalAccess', _538 => _538.kind]) === "sticker") this.controller.cancelStickerPreview();
|
|
10336
10462
|
this.mode = null;
|
|
10337
10463
|
}
|
|
10338
10464
|
get active() {
|
|
@@ -10394,13 +10520,13 @@ function handlePaintShortcut(controller, gesture, e) {
|
|
|
10394
10520
|
return false;
|
|
10395
10521
|
}
|
|
10396
10522
|
var PaintCanvasPresenter = (_class14 = class {
|
|
10397
|
-
constructor(controller) {;_class14.prototype.
|
|
10523
|
+
constructor(controller) {;_class14.prototype.__init145.call(this);_class14.prototype.__init146.call(this);_class14.prototype.__init147.call(this);
|
|
10398
10524
|
this.controller = controller;
|
|
10399
10525
|
}
|
|
10400
10526
|
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10527
|
+
__init145() {this.uploaded = /* @__PURE__ */ new Map()}
|
|
10528
|
+
__init146() {this.scratch = null}
|
|
10529
|
+
__init147() {this.size = ""}
|
|
10404
10530
|
/** Draws what changed into `ctx` (a canvas the size of the document); returns the tiles drawn. */
|
|
10405
10531
|
render(ctx) {
|
|
10406
10532
|
const { width, height } = this.controller.document.canvas;
|
|
@@ -10432,7 +10558,7 @@ function guideOverlay(controller, drag) {
|
|
|
10432
10558
|
const size = s.document.canvas;
|
|
10433
10559
|
const out = [];
|
|
10434
10560
|
const layerId = s.document.activeLayerId;
|
|
10435
|
-
const strokePicked = layerId && s.selectedStroke ? _optionalChain([s, 'access',
|
|
10561
|
+
const strokePicked = layerId && s.selectedStroke ? _optionalChain([s, 'access', _539 => _539.document, 'access', _540 => _540.liveStrokes, 'optionalAccess', _541 => _541[layerId], 'optionalAccess', _542 => _542.some, 'call', _543 => _543((x) => x.id === s.selectedStroke)]) : false;
|
|
10436
10562
|
const area = strokePicked ? controller.liveStrokeArea(s.selectedStroke) : null;
|
|
10437
10563
|
if (area) {
|
|
10438
10564
|
const dx = drag && drag.id === s.selectedStroke ? drag.dx : 0;
|
|
@@ -10445,7 +10571,7 @@ function guideOverlay(controller, drag) {
|
|
|
10445
10571
|
];
|
|
10446
10572
|
for (let i = 0; i < 4; i++) out.push({ from: box[i], to: box[(i + 1) % 4], kind: "stroke" });
|
|
10447
10573
|
}
|
|
10448
|
-
const picked = layerId && s.selectedSticker ? _optionalChain([s, 'access',
|
|
10574
|
+
const picked = layerId && s.selectedSticker ? _optionalChain([s, 'access', _544 => _544.document, 'access', _545 => _545.stickers, 'optionalAccess', _546 => _546[layerId], 'optionalAccess', _547 => _547.find, 'call', _548 => _548((x) => x.id === s.selectedSticker)]) : void 0;
|
|
10449
10575
|
if (picked) {
|
|
10450
10576
|
const r = picked.size / 2 + 2;
|
|
10451
10577
|
const a = picked.rotation * Math.PI / 180;
|
|
@@ -10490,7 +10616,7 @@ var PAPER_SLIDERS = [
|
|
|
10490
10616
|
];
|
|
10491
10617
|
function readPath(obj, path) {
|
|
10492
10618
|
let v = obj;
|
|
10493
|
-
for (const k of path.split(".")) v = _optionalChain([v, 'optionalAccess',
|
|
10619
|
+
for (const k of path.split(".")) v = _optionalChain([v, 'optionalAccess', _549 => _549[k]]);
|
|
10494
10620
|
return typeof v === "number" ? v : 0;
|
|
10495
10621
|
}
|
|
10496
10622
|
function patchPath(obj, path, value) {
|
|
@@ -10532,8 +10658,8 @@ function wheelPick(dx, dy, wheel, color) {
|
|
|
10532
10658
|
return rgbToHexColor(nr, ng, nb);
|
|
10533
10659
|
}
|
|
10534
10660
|
var BLEND_MENU_GROUPS = [
|
|
10535
|
-
{ label: "Standard", modes:
|
|
10536
|
-
{ label: "Paint", modes:
|
|
10661
|
+
{ label: "Standard", modes: _chunk2VX55NFMcjs.BLEND_MODES.filter((m) => !m.painterly && m.id !== "pigment") },
|
|
10662
|
+
{ label: "Paint", modes: _chunk2VX55NFMcjs.BLEND_MODES.filter((m) => m.painterly || m.id === "pigment") }
|
|
10537
10663
|
];
|
|
10538
10664
|
var LIGHT_SLIDER = { path: "light.amount", label: "Light", min: 0, max: 1, step: 0.01 };
|
|
10539
10665
|
var PICKUP_SLIDERS = [
|
|
@@ -10542,7 +10668,7 @@ var PICKUP_SLIDERS = [
|
|
|
10542
10668
|
];
|
|
10543
10669
|
function brushEngineControls(brush) {
|
|
10544
10670
|
const c = engineControls(brush);
|
|
10545
|
-
const wetPaint = brush.engine === "wet" && _optionalChain([brush, 'access',
|
|
10671
|
+
const wetPaint = brush.engine === "wet" && _optionalChain([brush, 'access', _550 => _550.wet, 'optionalAccess', _551 => _551.tool]) === "paint";
|
|
10546
10672
|
if (!c || !(wetPaint || ["dab", "mixer", "particle", "bristle", "impasto"].includes(brush.engine))) return c;
|
|
10547
10673
|
const extra = brush.engine === "impasto" ? [{ path: "impasto.rim", label: "Rim", min: 0, max: 1, step: 0.01 }, { path: "impasto.clarity", label: "Clarity", min: 0, max: 1, step: 0.01 }] : [];
|
|
10548
10674
|
return { ...c, sliders: [...c.sliders, LIGHT_SLIDER, ...extra], light: true };
|
|
@@ -10625,7 +10751,7 @@ function engineControls(brush) {
|
|
|
10625
10751
|
impastoTool: true
|
|
10626
10752
|
};
|
|
10627
10753
|
case "wet": {
|
|
10628
|
-
const tool = _nullishCoalesce(_optionalChain([brush, 'access',
|
|
10754
|
+
const tool = _nullishCoalesce(_optionalChain([brush, 'access', _552 => _552.wet, 'optionalAccess', _553 => _553.tool]), () => ( "paint"));
|
|
10629
10755
|
const sliders = tool === "paint" ? [
|
|
10630
10756
|
{ path: "wet.water", label: "Water", min: 0, max: 1, step: 0.01 },
|
|
10631
10757
|
{ path: "wet.pigment", label: "Pigment", min: 0, max: 1, step: 0.01 },
|
|
@@ -10758,7 +10884,7 @@ function startWetClock(controller, frame, cancel) {
|
|
|
10758
10884
|
id = raf(loop);
|
|
10759
10885
|
return () => {
|
|
10760
10886
|
stopped = true;
|
|
10761
|
-
_optionalChain([caf, 'optionalCall',
|
|
10887
|
+
_optionalChain([caf, 'optionalCall', _554 => _554(id)]);
|
|
10762
10888
|
};
|
|
10763
10889
|
}
|
|
10764
10890
|
function drawWaterOverlay(controller, ctx) {
|
|
@@ -10787,13 +10913,22 @@ var RIBBON_PAIR_LABELS = { adjacent: "Neighbours", "first-last": "Outermost" };
|
|
|
10787
10913
|
var DOT_TEXTURE_ORDER_LABELS = { sequence: "In turn", random: "Random" };
|
|
10788
10914
|
var DOT_ROTATION_LABELS = { follow: "Follow motion", random: "Random", fixed: "Tip angle" };
|
|
10789
10915
|
var STAMP_LABELS = { dot: "Dot", star: "Star", heart: "Heart", leaf: "Leaf", flower: "Flower", confetti: "Confetti", splat: "Splat", sparkle: "Sparkle", ring: "Ring" };
|
|
10916
|
+
function toggleStickerRef(refs, ref2) {
|
|
10917
|
+
if (refs.includes(ref2)) return refs.length > 1 ? refs.filter((r) => r !== ref2) : [...refs];
|
|
10918
|
+
return refs.length < _chunkGT77U7QGcjs.MAX_STICKER_STAMPS ? [...refs, ref2] : [...refs];
|
|
10919
|
+
}
|
|
10920
|
+
function stickerRefLabel(ref2) {
|
|
10921
|
+
const stamp = ref2.startsWith("editor:") ? ref2.slice(7) : null;
|
|
10922
|
+
if (stamp && STAMP_LABELS[stamp]) return STAMP_LABELS[stamp];
|
|
10923
|
+
return ref2.slice(ref2.indexOf(":") + 1);
|
|
10924
|
+
}
|
|
10790
10925
|
function toggleStamp(stamps, stamp) {
|
|
10791
10926
|
const next = stamps.includes(stamp) ? stamps.filter((s) => s !== stamp) : [...stamps, stamp];
|
|
10792
10927
|
return next.length ? next : [stamp];
|
|
10793
10928
|
}
|
|
10794
10929
|
function toggleDotTexture(textures, stamp) {
|
|
10795
10930
|
if (textures.includes(stamp)) return textures.filter((s) => s !== stamp);
|
|
10796
|
-
return textures.length <
|
|
10931
|
+
return textures.length < _chunkGT77U7QGcjs.MAX_DOT_TEXTURES ? [...textures, stamp] : [...textures];
|
|
10797
10932
|
}
|
|
10798
10933
|
var STROKE_SLIDERS = [
|
|
10799
10934
|
{ path: "tip.size", label: "Size", min: 1, max: 400, step: 1 },
|
|
@@ -10864,7 +10999,7 @@ function createPaintEffectsToolProvider(controller, options = {}) {
|
|
|
10864
10999
|
if (changes.enabled !== void 0) throw new Error("enabled does not apply here: hide an effect layer with update_layer visible false, or remove the effect paper.");
|
|
10865
11000
|
};
|
|
10866
11001
|
const values = (v) => v;
|
|
10867
|
-
return withPaintPlayback(
|
|
11002
|
+
return withPaintPlayback(_chunkISIO63Q5cjs.createEffectToolProvider.call(void 0, {
|
|
10868
11003
|
id: _nullishCoalesce(options.id, () => ( "paint-effects")),
|
|
10869
11004
|
namespace: options.namespace,
|
|
10870
11005
|
title: "Paint effects",
|
|
@@ -11018,7 +11153,7 @@ function createPaintEffectsToolProvider(controller, options = {}) {
|
|
|
11018
11153
|
name: { type: "string", minLength: 1, description: "The layer name (default: the effect's name)." },
|
|
11019
11154
|
aboveId: { type: "string", minLength: 1, description: "Put it directly above this layer (default: above the active layer, else on top)." },
|
|
11020
11155
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0\u20131 (default 1)." },
|
|
11021
|
-
blend: { type: "string", enum:
|
|
11156
|
+
blend: { type: "string", enum: _chunk2VX55NFMcjs.BLEND_MODES.map((m) => m.id), description: "Layer blend mode (default normal); screen or linear-dodge for light, multiply for textures." },
|
|
11022
11157
|
time: { type: "number", minimum: 0, description: "Which moment of an animated effect to draw, in ms (default 0)." }
|
|
11023
11158
|
},
|
|
11024
11159
|
required: ["effect"],
|
|
@@ -11425,4 +11560,13 @@ function createPaintEditorDocument(controller, options = {}) {
|
|
|
11425
11560
|
|
|
11426
11561
|
|
|
11427
11562
|
|
|
11428
|
-
exports.BACKLIGHT_SPILL = BACKLIGHT_SPILL; exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkOLNIPTB3cjs.BLEND_MODES; exports.BRUSH_ID = _chunk6G6ZDDDBcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunk6G6ZDDDBcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunk6G6ZDDDBcjs.BUILTIN_BRUSHES; exports.BristleStroke = _chunk6G6ZDDDBcjs.BristleStroke; exports.DEFAULT_BACKLIGHT_COLOR = DEFAULT_BACKLIGHT_COLOR; exports.DEFAULT_BEHAVIOR = _chunk6G6ZDDDBcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunk6G6ZDDDBcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunk6G6ZDDDBcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunk6G6ZDDDBcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkVMROIWLLcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunk6G6ZDDDBcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHT = _chunk6G6ZDDDBcjs.DEFAULT_LIGHT; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunk6G6ZDDDBcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkPQ3H2AANcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkPQ3H2AANcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunk6G6ZDDDBcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunk6G6ZDDDBcjs.DEFAULT_PARTICLE; exports.DEFAULT_STICKER = _chunk6G6ZDDDBcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunk6G6ZDDDBcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkVMROIWLLcjs.DEFAULT_WET_PARAMS; exports.DOT_ROTATIONS = _chunk6G6ZDDDBcjs.DOT_ROTATIONS; exports.DOT_ROTATION_LABELS = DOT_ROTATION_LABELS; exports.DOT_TEXTURE_ORDERS = _chunk6G6ZDDDBcjs.DOT_TEXTURE_ORDERS; exports.DOT_TEXTURE_ORDER_LABELS = DOT_TEXTURE_ORDER_LABELS; exports.DryStroke = _chunk6G6ZDDDBcjs.DryStroke; exports.EFFECT_MAP_REPEATS = _chunk6G6ZDDDBcjs.EFFECT_MAP_REPEATS; exports.EFFECT_STRIP_HEIGHT = _chunk6G6ZDDDBcjs.EFFECT_STRIP_HEIGHT; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkPQ3H2AANcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkPQ3H2AANcjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunk7PT4RJL5cjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunk6G6ZDDDBcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunk6G6ZDDDBcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LIVE_STROKE_ENGINES = LIVE_STROKE_ENGINES; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkPQ3H2AANcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_DOT_TEXTURES = _chunk6G6ZDDDBcjs.MAX_DOT_TEXTURES; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_LIVE_EFFECT_SOURCES = MAX_LIVE_EFFECT_SOURCES; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunk6G6ZDDDBcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkOLNIPTB3cjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunk6G6ZDDDBcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunk6G6ZDDDBcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkPQ3H2AANcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkPQ3H2AANcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkPQ3H2AANcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkPQ3H2AANcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkPQ3H2AANcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TARGET = PAINT_TARGET; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunk6G6ZDDDBcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunk6G6ZDDDBcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunk6G6ZDDDBcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunk6G6ZDDDBcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkPQ3H2AANcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkPQ3H2AANcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkPQ3H2AANcjs.PaperGrain; exports.ParticleStroke = _chunk6G6ZDDDBcjs.ParticleStroke; exports.PenDabWalker = _chunk6G6ZDDDBcjs.PenDabWalker; exports.PenSmoother = _chunk6G6ZDDDBcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.RIBBON_PAIRS = _chunk6G6ZDDDBcjs.RIBBON_PAIRS; exports.RIBBON_PAIR_LABELS = RIBBON_PAIR_LABELS; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunk6G6ZDDDBcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.STROKE_SLIDERS = STROKE_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerSpray = _chunk6G6ZDDDBcjs.StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunkPQ3H2AANcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkVMROIWLLcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunk6G6ZDDDBcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkVMROIWLLcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunk6G6ZDDDBcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkPQ3H2AANcjs.addPaintGradientStop; exports.addPolygonArea = _chunk6G6ZDDDBcjs.addPolygonArea; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.backlightOf = backlightOf; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunk6G6ZDDDBcjs.brushTakesPaint; exports.brushToJSON = _chunk6G6ZDDDBcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunk6G6ZDDDBcjs.clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = _chunk6G6ZDDDBcjs.drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectDabField = _chunk6G6ZDDDBcjs.effectDabField; exports.effectLayersToJSON = effectLayersToJSON; exports.effectPaintKey = _chunk6G6ZDDDBcjs.effectPaintKey; exports.effectPaintSize = _chunk6G6ZDDDBcjs.effectPaintSize; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkPQ3H2AANcjs.grainCatch; exports.grainHeights = _chunkPQ3H2AANcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunkPQ3H2AANcjs.hash2; exports.hexToPaintRgb = _chunkPQ3H2AANcjs.hexToPaintRgb; exports.hexToRgb8 = _chunk6G6ZDDDBcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunk7PT4RJL5cjs.hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkOLNIPTB3cjs.isBlendMode; exports.isGradientPaint = _chunkPQ3H2AANcjs.isGradientPaint; exports.isPaintEffectPaint = _chunk6G6ZDDDBcjs.isPaintEffectPaint; exports.isPainterlyBlendMode = _chunkOLNIPTB3cjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunk6G6ZDDDBcjs.isWetBrush; exports.isWetCapable = _chunk6G6ZDDDBcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.liveStrokeBounds = liveStrokeBounds; exports.liveStrokeRefusal = liveStrokeRefusal; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunkPQ3H2AANcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunk6G6ZDDDBcjs.mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.multiColorToPaint = _chunk6G6ZDDDBcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunk6G6ZDDDBcjs.normalizeBehavior; exports.normalizeBristle = _chunk6G6ZDDDBcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunk6G6ZDDDBcjs.normalizeDynamics; exports.normalizeFlow = _chunkVMROIWLLcjs.normalizeFlow; exports.normalizeHexColor = _chunkPQ3H2AANcjs.normalizeHexColor; exports.normalizeImpasto = _chunk6G6ZDDDBcjs.normalizeImpasto; exports.normalizeLight = _chunk6G6ZDDDBcjs.normalizeLight; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunk6G6ZDDDBcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunk6G6ZDDDBcjs.normalizePaintBrush; exports.normalizePaper = _chunk6G6ZDDDBcjs.normalizePaper; exports.normalizeParticle = _chunk6G6ZDDDBcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunk6G6ZDDDBcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = _chunk6G6ZDDDBcjs.normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunk6G6ZDDDBcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkVMROIWLLcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintGradientMappingFor = _chunkPQ3H2AANcjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintSourceColor = _chunkPQ3H2AANcjs.paintSourceColor; exports.paintSourceCss = _chunkPQ3H2AANcjs.paintSourceCss; exports.paintToMultiColor = _chunk6G6ZDDDBcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunk6G6ZDDDBcjs.paperPreset; exports.parseBrushLibrary = _chunk6G6ZDDDBcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkPQ3H2AANcjs.parsePaintSource; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunk6G6ZDDDBcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunkPQ3H2AANcjs.rand01; exports.randSigned = _chunkPQ3H2AANcjs.randSigned; exports.readEffectStrokeMap = _chunk6G6ZDDDBcjs.readEffectStrokeMap; exports.readPaintEffectPaint = _chunk6G6ZDDDBcjs.readPaintEffectPaint; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkPQ3H2AANcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkPQ3H2AANcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunk6G6ZDDDBcjs.renderPaper; exports.renderStickers = _chunk6G6ZDDDBcjs.renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkPQ3H2AANcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkPQ3H2AANcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.sampleEffectAt = _chunk6G6ZDDDBcjs.sampleEffectAt; exports.sampleEffectField = _chunk6G6ZDDDBcjs.sampleEffectField; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkPQ3H2AANcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunkPQ3H2AANcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkPQ3H2AANcjs.solidPaint; exports.stampCoverage = _chunk6G6ZDDDBcjs.stampCoverage; exports.standardBlendMode = _chunkOLNIPTB3cjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerAt = _chunk6G6ZDDDBcjs.stickerAt; exports.stickerRect = _chunk6G6ZDDDBcjs.stickerRect; exports.stickerSurface = _chunk6G6ZDDDBcjs.stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = _chunk6G6ZDDDBcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunk6G6ZDDDBcjs.toStrokePoint; exports.toggleDotTexture = toggleDotTexture; exports.toggleStamp = toggleStamp; exports.translateStencil = translateStencil; exports.updatePaintGradientStop = _chunkPQ3H2AANcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunk6G6ZDDDBcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = wetPaperInput; exports.wetPigmentOf = wetPigmentOf; exports.wetSupport = _chunkVMROIWLLcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunk7PT4RJL5cjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback;
|
|
11563
|
+
|
|
11564
|
+
|
|
11565
|
+
|
|
11566
|
+
|
|
11567
|
+
|
|
11568
|
+
|
|
11569
|
+
|
|
11570
|
+
|
|
11571
|
+
|
|
11572
|
+
exports.BACKLIGHT_SPILL = BACKLIGHT_SPILL; exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunk2VX55NFMcjs.BLEND_MODES; exports.BRUSH_ID = _chunkGT77U7QGcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkGT77U7QGcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkGT77U7QGcjs.BUILTIN_BRUSHES; exports.BristleStroke = _chunkGT77U7QGcjs.BristleStroke; exports.DEFAULT_BACKLIGHT_COLOR = DEFAULT_BACKLIGHT_COLOR; exports.DEFAULT_BEHAVIOR = _chunkGT77U7QGcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkGT77U7QGcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkGT77U7QGcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkGT77U7QGcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkKBYB7OWBcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkGT77U7QGcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHT = _chunkGT77U7QGcjs.DEFAULT_LIGHT; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkGT77U7QGcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkI7NJPHWVcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkI7NJPHWVcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunkGT77U7QGcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkGT77U7QGcjs.DEFAULT_PARTICLE; exports.DEFAULT_STICKER = _chunkGT77U7QGcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkGT77U7QGcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkKBYB7OWBcjs.DEFAULT_WET_PARAMS; exports.DOT_ROTATIONS = _chunkGT77U7QGcjs.DOT_ROTATIONS; exports.DOT_ROTATION_LABELS = DOT_ROTATION_LABELS; exports.DOT_TEXTURE_ORDERS = _chunkGT77U7QGcjs.DOT_TEXTURE_ORDERS; exports.DOT_TEXTURE_ORDER_LABELS = DOT_TEXTURE_ORDER_LABELS; exports.DryStroke = _chunkGT77U7QGcjs.DryStroke; exports.EFFECT_MAP_REPEATS = _chunkGT77U7QGcjs.EFFECT_MAP_REPEATS; exports.EFFECT_STRIP_HEIGHT = _chunkGT77U7QGcjs.EFFECT_STRIP_HEIGHT; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkI7NJPHWVcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkI7NJPHWVcjs.GRAIN_TILE; exports.HARMONY_KINDS = _chunk7PT4RJL5cjs.HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunkGT77U7QGcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkGT77U7QGcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LIVE_STROKE_ENGINES = LIVE_STROKE_ENGINES; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkI7NJPHWVcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_DOT_TEXTURES = _chunkGT77U7QGcjs.MAX_DOT_TEXTURES; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; exports.MAX_LIVE_EFFECT_SOURCES = MAX_LIVE_EFFECT_SOURCES; exports.MAX_STICKER_STAMPS = _chunkGT77U7QGcjs.MAX_STICKER_STAMPS; exports.MAX_ZOOM = MAX_ZOOM; exports.MIN_CANVAS_SIDE = MIN_CANVAS_SIDE; exports.MIN_ZOOM = MIN_ZOOM; exports.MIXING_PAD_HEIGHT = MIXING_PAD_HEIGHT; exports.MIXING_PAD_WIDTH = MIXING_PAD_WIDTH; exports.MULTI_COLOR_MODES = _chunkGT77U7QGcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunk2VX55NFMcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkGT77U7QGcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkGT77U7QGcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkI7NJPHWVcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkI7NJPHWVcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkI7NJPHWVcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkI7NJPHWVcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkI7NJPHWVcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkI7NJPHWVcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkI7NJPHWVcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkI7NJPHWVcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkI7NJPHWVcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkI7NJPHWVcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkI7NJPHWVcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkI7NJPHWVcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TARGET = PAINT_TARGET; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunkGT77U7QGcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunkGT77U7QGcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkGT77U7QGcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkGT77U7QGcjs.PARTICLE_RENDERS; exports.PARTICLE_RENDER_LABELS = PARTICLE_RENDER_LABELS; exports.PaintCanvasPresenter = PaintCanvasPresenter; exports.PaintDabStroke = PaintDabStroke; exports.PaintDirector = PaintDirector; exports.PaintDocumentError = PaintDocumentError; exports.PaintEditorController = PaintEditorController; exports.PaintEditorError = PaintEditorError; exports.PaintEffectsRenderer = PaintEffectsRenderer; exports.PaintGesture = PaintGesture; exports.PaintGradientSampler = _chunkI7NJPHWVcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkI7NJPHWVcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkI7NJPHWVcjs.PaperGrain; exports.ParticleStroke = _chunkGT77U7QGcjs.ParticleStroke; exports.PenDabWalker = _chunkGT77U7QGcjs.PenDabWalker; exports.PenSmoother = _chunkGT77U7QGcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.RIBBON_PAIRS = _chunkGT77U7QGcjs.RIBBON_PAIRS; exports.RIBBON_PAIR_LABELS = RIBBON_PAIR_LABELS; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunk4JNWA3VTcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_ART_SIZE = _chunkGT77U7QGcjs.STICKER_ART_SIZE; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.STROKE_SLIDERS = STROKE_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerArtCache = _chunkGT77U7QGcjs.StickerArtCache; exports.StickerBrowser = _chunkATK6ABN3cjs.StickerBrowser; exports.StickerSpray = _chunkGT77U7QGcjs.StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunk3K6HWEXZcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkKBYB7OWBcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkGT77U7QGcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkKBYB7OWBcjs.WET_PARAM_KEYS; exports.WET_PARAM_SCHEMA = WET_PARAM_SCHEMA; exports.WET_PARAM_SLIDERS = WET_PARAM_SLIDERS; exports.WET_SPEED_SLIDER = WET_SPEED_SLIDER; exports.WET_TILT_SLIDERS = WET_TILT_SLIDERS; exports.WET_TOOLS = _chunkGT77U7QGcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkI7NJPHWVcjs.addPaintGradientStop; exports.addPolygonArea = _chunkGT77U7QGcjs.addPolygonArea; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.backlightOf = backlightOf; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkGT77U7QGcjs.brushTakesPaint; exports.brushToJSON = _chunkGT77U7QGcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunkGT77U7QGcjs.clonePaper; exports.colorHarmony = colorHarmony2; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; exports.createPaintEditorDocument = createPaintEditorDocument; exports.createPaintEditorToolProvider = createPaintEditorToolProvider; exports.createPaintEffectsToolProvider = createPaintEffectsToolProvider; exports.createPaintLayer = createPaintLayer; exports.createPaintReplayTools = createPaintReplayTools; exports.createPaintStickerTools = createPaintStickerTools; exports.createPaintThickTools = createPaintThickTools; exports.createPaintWetTools = createPaintWetTools; exports.decodeImageBlob = decodeImageBlob; exports.defaultGuides = defaultGuides; exports.defaultImageEncoder = defaultImageEncoder; exports.defaultStickerRasterizer = _chunkGT77U7QGcjs.defaultStickerRasterizer; exports.deserializePaintDocument = deserializePaintDocument; exports.deserializePaintDocumentAsync = deserializePaintDocumentAsync; exports.documentExtensions = documentExtensions; exports.documentToScreen = documentToScreen; exports.downloadBytes = downloadBytes; exports.downsampleRgba = downsampleRgba; exports.drawSticker = _chunkGT77U7QGcjs.drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectDabField = _chunkGT77U7QGcjs.effectDabField; exports.effectLayersToJSON = effectLayersToJSON; exports.effectPaintKey = _chunkGT77U7QGcjs.effectPaintKey; exports.effectPaintSize = _chunkGT77U7QGcjs.effectPaintSize; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkI7NJPHWVcjs.grainCatch; exports.grainHeights = _chunkI7NJPHWVcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunk3K6HWEXZcjs.hash2; exports.hexToPaintRgb = _chunkI7NJPHWVcjs.hexToPaintRgb; exports.hexToRgb8 = _chunkGT77U7QGcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = _chunk7PT4RJL5cjs.hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunk2VX55NFMcjs.isBlendMode; exports.isGradientPaint = _chunkI7NJPHWVcjs.isGradientPaint; exports.isPaintEffectPaint = _chunkGT77U7QGcjs.isPaintEffectPaint; exports.isPainterlyBlendMode = _chunk2VX55NFMcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkGT77U7QGcjs.isWetBrush; exports.isWetCapable = _chunkGT77U7QGcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.liveStrokeBounds = liveStrokeBounds; exports.liveStrokeRefusal = liveStrokeRefusal; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunk3K6HWEXZcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunkGT77U7QGcjs.mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.multiColorToPaint = _chunkGT77U7QGcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkGT77U7QGcjs.normalizeBehavior; exports.normalizeBristle = _chunkGT77U7QGcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkGT77U7QGcjs.normalizeDynamics; exports.normalizeFlow = _chunkKBYB7OWBcjs.normalizeFlow; exports.normalizeHexColor = _chunkI7NJPHWVcjs.normalizeHexColor; exports.normalizeImpasto = _chunkGT77U7QGcjs.normalizeImpasto; exports.normalizeLight = _chunkGT77U7QGcjs.normalizeLight; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkGT77U7QGcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkGT77U7QGcjs.normalizePaintBrush; exports.normalizePaper = _chunkGT77U7QGcjs.normalizePaper; exports.normalizeParticle = _chunkGT77U7QGcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkGT77U7QGcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = _chunkGT77U7QGcjs.normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkGT77U7QGcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkKBYB7OWBcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintGradientMappingFor = _chunkI7NJPHWVcjs.paintGradientMappingFor; exports.paintPlaybackPanel = paintPlaybackPanel; exports.paintSourceColor = _chunkI7NJPHWVcjs.paintSourceColor; exports.paintSourceCss = _chunkI7NJPHWVcjs.paintSourceCss; exports.paintToMultiColor = _chunkGT77U7QGcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunkGT77U7QGcjs.paperPreset; exports.parseBrushLibrary = _chunkGT77U7QGcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkI7NJPHWVcjs.parsePaintSource; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunkGT77U7QGcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.planPaintToolPlayback = planPaintToolPlayback; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunk3K6HWEXZcjs.rand01; exports.randSigned = _chunk3K6HWEXZcjs.randSigned; exports.readEffectStrokeMap = _chunkGT77U7QGcjs.readEffectStrokeMap; exports.readPaintEffectPaint = _chunkGT77U7QGcjs.readPaintEffectPaint; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkI7NJPHWVcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkI7NJPHWVcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunkGT77U7QGcjs.renderPaper; exports.renderStickers = _chunkGT77U7QGcjs.renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkI7NJPHWVcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkI7NJPHWVcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.sampleArt = _chunkGT77U7QGcjs.sampleArt; exports.sampleEffectAt = _chunkGT77U7QGcjs.sampleEffectAt; exports.sampleEffectField = _chunkGT77U7QGcjs.sampleEffectField; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkI7NJPHWVcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunk3K6HWEXZcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkI7NJPHWVcjs.solidPaint; exports.stampCoverage = _chunk4JNWA3VTcjs.stampCoverage; exports.standardBlendMode = _chunk2VX55NFMcjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerAt = _chunkGT77U7QGcjs.stickerAt; exports.stickerRect = _chunkGT77U7QGcjs.stickerRect; exports.stickerRefLabel = stickerRefLabel; exports.stickerStamp = _chunkGT77U7QGcjs.stickerStamp; exports.stickerSurface = _chunkGT77U7QGcjs.stickerSurface; exports.strokeBounds = strokeBounds; exports.strokeDuration = strokeDuration; exports.strokeSchedule = strokeSchedule; exports.sweepPath = sweepPath; exports.symmetryAxisAngles = symmetryAxisAngles; exports.symmetryAxisSegments = symmetryAxisSegments; exports.symmetryCopies = symmetryCopies; exports.thickFromJSON = thickFromJSON; exports.thickToJSON = thickToJSON; exports.thumbnailStroke = thumbnailStroke; exports.tiltToOrientation = _chunkGT77U7QGcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunkGT77U7QGcjs.toStrokePoint; exports.toggleDotTexture = toggleDotTexture; exports.toggleStamp = toggleStamp; exports.toggleStickerRef = toggleStickerRef; exports.translateStencil = translateStencil; exports.updatePaintGradientStop = _chunkI7NJPHWVcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkGT77U7QGcjs.usesPaintExchange; exports.variationAffine = variationAffine; exports.varyStroke = varyStroke; exports.viewCssTransform = viewCssTransform; exports.viewMatrix = viewMatrix; exports.viewPenToDocument = viewPenToDocument; exports.wetEngineSummary = wetEngineSummary; exports.wetPaperInput = wetPaperInput; exports.wetPigmentOf = wetPigmentOf; exports.wetSupport = _chunkKBYB7OWBcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = _chunk7PT4RJL5cjs.wheelToHue; exports.withPaintPlayback = withPaintPlayback;
|