@pixerate/editor 0.136.0 → 0.137.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +60 -55
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +4 -4
- package/dist/animation-editor/index.d.ts +4 -4
- package/dist/animation-editor/index.js +7 -2
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/{bezier-CdccFsF8.d.cts → bezier-CZ2AhjID.d.cts} +1 -1
- package/dist/{bezier-DG9qNZQV.d.ts → bezier-Dywv3Bw8.d.ts} +1 -1
- package/dist/blending-D7jCmjO6.d.cts +1026 -0
- package/dist/blending-NgF3qo3d.d.ts +1026 -0
- package/dist/brushes-CnvZSYYU.d.cts +744 -0
- package/dist/brushes-DJmUbIgz.d.ts +744 -0
- package/dist/{brushstrokeRender-SII6MG4R.js → brushstrokeRender-2FAXA3XC.js} +13 -16
- package/dist/{brushstrokeRender-SII6MG4R.js.map → brushstrokeRender-2FAXA3XC.js.map} +1 -1
- package/dist/{brushstrokeRender-JNHVEUFG.cjs → brushstrokeRender-IMFY3FF6.cjs} +16 -19
- package/dist/brushstrokeRender-IMFY3FF6.cjs.map +1 -0
- package/dist/canvas/index.cjs +10 -10
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +7 -7
- package/dist/canvas/index.d.ts +7 -7
- package/dist/canvas/index.js +4 -4
- package/dist/{chunk-W4LNKTHT.cjs → chunk-2XS6LTUP.cjs} +63 -63
- package/dist/{chunk-W4LNKTHT.cjs.map → chunk-2XS6LTUP.cjs.map} +1 -1
- package/dist/{chunk-MAHQC3SK.js → chunk-3D77LOBM.js} +222 -135
- package/dist/chunk-3D77LOBM.js.map +1 -0
- package/dist/{chunk-BR7EKQUP.js → chunk-3G6J7UFV.js} +322 -2
- package/dist/chunk-3G6J7UFV.js.map +1 -0
- package/dist/{chunk-62XUO5LB.js → chunk-3X6IAJUQ.js} +2 -2
- package/dist/{chunk-EM3FMJWE.js → chunk-5FSRTP6E.js} +320 -3
- package/dist/chunk-5FSRTP6E.js.map +1 -0
- package/dist/{chunk-2R3UW57U.cjs → chunk-5OOIUXNJ.cjs} +333 -246
- package/dist/chunk-5OOIUXNJ.cjs.map +1 -0
- package/dist/{chunk-KZXLZCQ7.js → chunk-6S6362D2.js} +2 -2
- package/dist/{chunk-24ATT2PE.cjs → chunk-AEAAN4AD.cjs} +120 -120
- package/dist/{chunk-24ATT2PE.cjs.map → chunk-AEAAN4AD.cjs.map} +1 -1
- package/dist/{chunk-SVYE5HIM.js → chunk-EQQMGO42.js} +2 -2
- package/dist/{chunk-FHPVDTI2.cjs → chunk-F2Y4E4GU.cjs} +22 -22
- package/dist/{chunk-FHPVDTI2.cjs.map → chunk-F2Y4E4GU.cjs.map} +1 -1
- package/dist/{chunk-UYQUPUR6.js → chunk-HUO3TI4C.js} +3 -3
- package/dist/{chunk-DDSO4HS7.cjs → chunk-KEENUAFN.cjs} +2 -2
- package/dist/{chunk-DDSO4HS7.cjs.map → chunk-KEENUAFN.cjs.map} +1 -1
- package/dist/{chunk-2HC4DRF4.js → chunk-LLFHCSU2.js} +2 -2
- package/dist/{chunk-J5BA3BQ6.cjs → chunk-O7LUD7MH.cjs} +323 -3
- package/dist/chunk-O7LUD7MH.cjs.map +1 -0
- package/dist/{chunk-ILYFOJUN.js → chunk-OIBIRXRG.js} +3 -3
- package/dist/{chunk-B2CUCM7Y.cjs → chunk-PRSRYHQD.cjs} +36 -36
- package/dist/{chunk-B2CUCM7Y.cjs.map → chunk-PRSRYHQD.cjs.map} +1 -1
- package/dist/{chunk-6GFRKLLS.cjs → chunk-QBWEH3IM.cjs} +429 -112
- package/dist/chunk-QBWEH3IM.cjs.map +1 -0
- package/dist/{chunk-6QQR4LKE.js → chunk-SYT2TLQF.js} +35 -37
- package/dist/{chunk-6QQR4LKE.js.map → chunk-SYT2TLQF.js.map} +1 -1
- package/dist/{chunk-YT3JL7YM.cjs → chunk-TLCTTQFF.cjs} +53 -53
- package/dist/{chunk-YT3JL7YM.cjs.map → chunk-TLCTTQFF.cjs.map} +1 -1
- package/dist/{chunk-JLGNZMUV.cjs → chunk-XN2NBLV5.cjs} +313 -315
- package/dist/chunk-XN2NBLV5.cjs.map +1 -0
- package/dist/effects/index.d.cts +4 -4
- package/dist/effects/index.d.ts +4 -4
- package/dist/{export-Ds7zgGD8.d.ts → export-41rL6Cne.d.ts} +1 -1
- package/dist/{export-BOheWw2R.d.cts → export-CyJdfP_Z.d.cts} +5 -4
- package/dist/{export-CEYeRQXH.d.cts → export-D9mXp05Q.d.cts} +1 -1
- package/dist/{export-ByKKIA2S.d.ts → export-DwnZ_hvQ.d.ts} +5 -4
- package/dist/{helpers--ns3W2D7.d.ts → helpers-C-RgeyvH.d.ts} +18 -7
- package/dist/{helpers-BVkU4oUi.d.cts → helpers-v6GMazzg.d.cts} +18 -7
- package/dist/image-editor/index.cjs +984 -987
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +12 -11
- package/dist/image-editor/index.d.ts +12 -11
- package/dist/image-editor/index.js +92 -95
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{opentype-yi-Kz4ND.d.cts → opentype-KR_jj6b_.d.cts} +1 -1
- package/dist/{opentype-DfoVYgmG.d.ts → opentype-a1KAW-qs.d.ts} +1 -1
- package/dist/paint/index.cjs +5 -8
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +4 -2
- package/dist/paint/index.d.ts +4 -2
- package/dist/paint/index.js +15 -18
- package/dist/paint-editor/index.cjs +403 -404
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +12 -748
- package/dist/paint-editor/index.d.ts +12 -748
- package/dist/paint-editor/index.js +77 -78
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/{pathfinder-7JkMwYvC.d.cts → pathfinder-BHS4vQNm.d.cts} +1 -1
- package/dist/{pathfinder-GM3UWdBZ.d.ts → pathfinder-BVvTIBMo.d.ts} +1 -1
- package/dist/{pool-CkTxlLMC.d.ts → pool-CZQOrSXZ.d.ts} +1 -1
- package/dist/{pool-04qp8iW4.d.cts → pool-FjZZmZ80.d.cts} +1 -1
- package/dist/rand-8xbUb6ur.d.ts +1118 -0
- package/dist/rand-Cw9VLrVC.d.cts +1118 -0
- package/dist/raster/index.cjs +17 -19
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.js +9 -11
- package/dist/raster/index.js.map +1 -1
- package/dist/{svg-rV6_HPmn.d.ts → svg-CSz3mzkw.d.ts} +2 -2
- package/dist/{svg-BDDKvWWY.d.cts → svg-DTb40ICU.d.cts} +2 -2
- package/dist/{tools-DPYerqeR.d.ts → tools-B0wXP5cF.d.ts} +1 -1
- package/dist/{tools-BAjSbTdY.d.cts → tools-Ca0kI1qo.d.cts} +1 -1
- package/dist/vector/index.cjs +1459 -1259
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +87 -11
- package/dist/vector/index.d.ts +87 -11
- package/dist/vector/index.js +213 -13
- package/dist/vector/index.js.map +1 -1
- package/dist/video-editor/index.d.cts +4 -4
- package/dist/video-editor/index.d.ts +4 -4
- package/dist/{warp-DQh9R7Ie.d.cts → warp-DTOp0lON.d.cts} +1 -1
- package/dist/{warp-XVL6SpSh.d.ts → warp-pd7hrH4T.d.ts} +1 -1
- package/package.json +1 -1
- package/skills/pixerate-vector/SKILL.md +8 -0
- package/dist/brushstrokeRender-JNHVEUFG.cjs.map +0 -1
- package/dist/chunk-2R3UW57U.cjs.map +0 -1
- package/dist/chunk-64PYNEHJ.js +0 -340
- package/dist/chunk-64PYNEHJ.js.map +0 -1
- package/dist/chunk-6GFRKLLS.cjs.map +0 -1
- package/dist/chunk-7QN76ESJ.js +0 -323
- package/dist/chunk-7QN76ESJ.js.map +0 -1
- package/dist/chunk-BR7EKQUP.js.map +0 -1
- package/dist/chunk-DCLJNVZS.cjs +0 -323
- package/dist/chunk-DCLJNVZS.cjs.map +0 -1
- package/dist/chunk-EM3FMJWE.js.map +0 -1
- package/dist/chunk-J5BA3BQ6.cjs.map +0 -1
- package/dist/chunk-JLGNZMUV.cjs.map +0 -1
- package/dist/chunk-MAHQC3SK.js.map +0 -1
- package/dist/chunk-Z6OUCS2K.cjs +0 -340
- package/dist/chunk-Z6OUCS2K.cjs.map +0 -1
- package/dist/rand-BszBST4s.d.ts +0 -2140
- package/dist/rand-DOH_aMvm.d.cts +0 -2140
- /package/dist/{chunk-62XUO5LB.js.map → chunk-3X6IAJUQ.js.map} +0 -0
- /package/dist/{chunk-KZXLZCQ7.js.map → chunk-6S6362D2.js.map} +0 -0
- /package/dist/{chunk-SVYE5HIM.js.map → chunk-EQQMGO42.js.map} +0 -0
- /package/dist/{chunk-UYQUPUR6.js.map → chunk-HUO3TI4C.js.map} +0 -0
- /package/dist/{chunk-2HC4DRF4.js.map → chunk-LLFHCSU2.js.map} +0 -0
- /package/dist/{chunk-ILYFOJUN.js.map → chunk-OIBIRXRG.js.map} +0 -0
|
@@ -1,13 +1,17 @@
|
|
|
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;
|
|
2
2
|
|
|
3
|
+
var _chunkSFCPGMCTcjs = require('../chunk-SFCPGMCT.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
10
|
+
var _chunkXN2NBLV5cjs = require('../chunk-XN2NBLV5.cjs');
|
|
11
|
+
require('../chunk-2YQONY6G.cjs');
|
|
9
12
|
|
|
10
13
|
|
|
14
|
+
var _chunkW6QTLHZ3cjs = require('../chunk-W6QTLHZ3.cjs');
|
|
11
15
|
|
|
12
16
|
|
|
13
17
|
|
|
@@ -15,6 +19,8 @@
|
|
|
15
19
|
|
|
16
20
|
|
|
17
21
|
|
|
22
|
+
var _chunkAEAAN4ADcjs = require('../chunk-AEAAN4AD.cjs');
|
|
23
|
+
require('../chunk-MUUXNRU4.cjs');
|
|
18
24
|
|
|
19
25
|
|
|
20
26
|
|
|
@@ -37,13 +43,18 @@
|
|
|
37
43
|
|
|
38
44
|
|
|
39
45
|
|
|
46
|
+
var _chunkF2Y4E4GUcjs = require('../chunk-F2Y4E4GU.cjs');
|
|
47
|
+
require('../chunk-G5NMLUVF.cjs');
|
|
40
48
|
|
|
41
49
|
|
|
50
|
+
var _chunkCOAMRKVIcjs = require('../chunk-COAMRKVI.cjs');
|
|
42
51
|
|
|
43
52
|
|
|
44
53
|
|
|
45
54
|
|
|
46
55
|
|
|
56
|
+
var _chunkEGFUVXKKcjs = require('../chunk-EGFUVXKK.cjs');
|
|
57
|
+
require('../chunk-5OOIUXNJ.cjs');
|
|
47
58
|
|
|
48
59
|
|
|
49
60
|
|
|
@@ -69,22 +80,16 @@
|
|
|
69
80
|
|
|
70
81
|
|
|
71
82
|
|
|
72
|
-
|
|
73
|
-
var _chunkW4LNKTHTcjs = require('../chunk-W4LNKTHT.cjs');
|
|
74
83
|
|
|
75
84
|
|
|
76
|
-
var _chunkSFCPGMCTcjs = require('../chunk-SFCPGMCT.cjs');
|
|
77
85
|
|
|
78
86
|
|
|
79
87
|
|
|
80
88
|
|
|
81
89
|
|
|
82
90
|
|
|
83
|
-
var _chunkJLGNZMUVcjs = require('../chunk-JLGNZMUV.cjs');
|
|
84
|
-
require('../chunk-2YQONY6G.cjs');
|
|
85
91
|
|
|
86
92
|
|
|
87
|
-
var _chunkW6QTLHZ3cjs = require('../chunk-W6QTLHZ3.cjs');
|
|
88
93
|
|
|
89
94
|
|
|
90
95
|
|
|
@@ -92,8 +97,6 @@ var _chunkW6QTLHZ3cjs = require('../chunk-W6QTLHZ3.cjs');
|
|
|
92
97
|
|
|
93
98
|
|
|
94
99
|
|
|
95
|
-
var _chunk24ATT2PEcjs = require('../chunk-24ATT2PE.cjs');
|
|
96
|
-
require('../chunk-MUUXNRU4.cjs');
|
|
97
100
|
|
|
98
101
|
|
|
99
102
|
|
|
@@ -116,7 +119,6 @@ require('../chunk-MUUXNRU4.cjs');
|
|
|
116
119
|
|
|
117
120
|
|
|
118
121
|
|
|
119
|
-
var _chunkFHPVDTI2cjs = require('../chunk-FHPVDTI2.cjs');
|
|
120
122
|
|
|
121
123
|
|
|
122
124
|
|
|
@@ -125,11 +127,17 @@ var _chunkFHPVDTI2cjs = require('../chunk-FHPVDTI2.cjs');
|
|
|
125
127
|
|
|
126
128
|
|
|
127
129
|
|
|
130
|
+
var _chunk2XS6LTUPcjs = require('../chunk-2XS6LTUP.cjs');
|
|
131
|
+
require('../chunk-Q6OUXEK3.cjs');
|
|
132
|
+
require('../chunk-BJTCSLF6.cjs');
|
|
133
|
+
require('../chunk-IZ4WRXZA.cjs');
|
|
128
134
|
|
|
129
135
|
|
|
130
136
|
|
|
131
137
|
|
|
132
138
|
|
|
139
|
+
var _chunkJODTP4DPcjs = require('../chunk-JODTP4DP.cjs');
|
|
140
|
+
require('../chunk-RIWPYSKU.cjs');
|
|
133
141
|
|
|
134
142
|
|
|
135
143
|
|
|
@@ -168,7 +176,6 @@ var _chunkFHPVDTI2cjs = require('../chunk-FHPVDTI2.cjs');
|
|
|
168
176
|
|
|
169
177
|
|
|
170
178
|
|
|
171
|
-
var _chunk6GFRKLLScjs = require('../chunk-6GFRKLLS.cjs');
|
|
172
179
|
|
|
173
180
|
|
|
174
181
|
|
|
@@ -182,6 +189,8 @@ var _chunk6GFRKLLScjs = require('../chunk-6GFRKLLS.cjs');
|
|
|
182
189
|
|
|
183
190
|
|
|
184
191
|
|
|
192
|
+
var _chunkQBWEH3IMcjs = require('../chunk-QBWEH3IM.cjs');
|
|
193
|
+
require('../chunk-SYPFUL5B.cjs');
|
|
185
194
|
|
|
186
195
|
|
|
187
196
|
|
|
@@ -190,7 +199,6 @@ var _chunk6GFRKLLScjs = require('../chunk-6GFRKLLS.cjs');
|
|
|
190
199
|
|
|
191
200
|
|
|
192
201
|
|
|
193
|
-
var _chunkJ5BA3BQ6cjs = require('../chunk-J5BA3BQ6.cjs');
|
|
194
202
|
|
|
195
203
|
|
|
196
204
|
|
|
@@ -199,29 +207,20 @@ var _chunkJ5BA3BQ6cjs = require('../chunk-J5BA3BQ6.cjs');
|
|
|
199
207
|
|
|
200
208
|
|
|
201
209
|
|
|
202
|
-
var _chunkDCLJNVZScjs = require('../chunk-DCLJNVZS.cjs');
|
|
203
|
-
require('../chunk-G5NMLUVF.cjs');
|
|
204
|
-
require('../chunk-643B2HKC.cjs');
|
|
205
210
|
|
|
206
211
|
|
|
207
|
-
var _chunkCOAMRKVIcjs = require('../chunk-COAMRKVI.cjs');
|
|
208
212
|
|
|
209
213
|
|
|
210
214
|
|
|
211
215
|
|
|
212
216
|
|
|
213
|
-
var _chunkEGFUVXKKcjs = require('../chunk-EGFUVXKK.cjs');
|
|
214
|
-
require('../chunk-2R3UW57U.cjs');
|
|
215
|
-
require('../chunk-Q6OUXEK3.cjs');
|
|
216
|
-
require('../chunk-BJTCSLF6.cjs');
|
|
217
|
-
require('../chunk-IZ4WRXZA.cjs');
|
|
218
217
|
|
|
219
218
|
|
|
220
219
|
|
|
221
220
|
|
|
222
221
|
|
|
223
|
-
var
|
|
224
|
-
require('../chunk-
|
|
222
|
+
var _chunkO7LUD7MHcjs = require('../chunk-O7LUD7MH.cjs');
|
|
223
|
+
require('../chunk-643B2HKC.cjs');
|
|
225
224
|
require('../chunk-FD4LPFAE.cjs');
|
|
226
225
|
require('../chunk-EMQWJA3G.cjs');
|
|
227
226
|
require('../chunk-MKA3AHLV.cjs');
|
|
@@ -237,7 +236,7 @@ function newPaintLayerId() {
|
|
|
237
236
|
return `pl${Date.now().toString(36)}${(nextId++).toString(36)}`;
|
|
238
237
|
}
|
|
239
238
|
function createPaintLayer(name, id = newPaintLayerId()) {
|
|
240
|
-
return { type: "pixel", id, name, visible: true, opacity: 1, blend: "normal", surface:
|
|
239
|
+
return { type: "pixel", id, name, visible: true, opacity: 1, blend: "normal", surface: _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } };
|
|
241
240
|
}
|
|
242
241
|
var PaintDocumentError = class extends Error {
|
|
243
242
|
constructor(message) {
|
|
@@ -259,7 +258,7 @@ function normalizeCanvas(raw) {
|
|
|
259
258
|
function createPaintDocument(options = {}) {
|
|
260
259
|
const canvas = normalizeCanvas({ width: _nullishCoalesce(options.width, () => ( 2048)), height: _nullishCoalesce(options.height, () => ( 1536)), dpi: options.dpi });
|
|
261
260
|
const layer = createPaintLayer("Layer 1");
|
|
262
|
-
return { canvas, paper:
|
|
261
|
+
return { canvas, paper: _chunk2XS6LTUPcjs.normalizePaper.call(void 0, _nullishCoalesce(options.paper, () => ( {}))), layers: [layer], activeLayerId: layer.id, strokes: [] };
|
|
263
262
|
}
|
|
264
263
|
|
|
265
264
|
// src/paint-editor/dab-stroke.ts
|
|
@@ -284,7 +283,7 @@ function mixRgb(a, b, t, mixing) {
|
|
|
284
283
|
if (mixing === "pigment") {
|
|
285
284
|
const o = [0, 0, 0];
|
|
286
285
|
const q = (v) => Math.round(Math.min(1, Math.max(0, v)) * 255);
|
|
287
|
-
|
|
286
|
+
_chunkO7LUD7MHcjs.mixPigment8.call(void 0, q(a[0]), q(a[1]), q(a[2]), q(b[0]), q(b[1]), q(b[2]), t, o);
|
|
288
287
|
return [o[0], o[1], o[2]];
|
|
289
288
|
}
|
|
290
289
|
return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
|
|
@@ -303,7 +302,7 @@ function multiColorForDab(mc, palette, index, seed, mixing) {
|
|
|
303
302
|
const n = palette.length;
|
|
304
303
|
if (mc.order === "random") {
|
|
305
304
|
const run = Math.floor(index / mc.length);
|
|
306
|
-
return [...palette[Math.min(n - 1, Math.floor(
|
|
305
|
+
return [...palette[Math.min(n - 1, Math.floor(_chunkQBWEH3IMcjs.rand01.call(void 0, seed, run, 11) * n))]];
|
|
307
306
|
}
|
|
308
307
|
const f = index / mc.length % n;
|
|
309
308
|
const i = Math.floor(f);
|
|
@@ -313,24 +312,24 @@ var PaintDabStroke = (_class = class {
|
|
|
313
312
|
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);
|
|
314
313
|
this.brush = brush;
|
|
315
314
|
this.options = options;
|
|
316
|
-
this.smoother = new (0,
|
|
317
|
-
this.copies = _optionalChain([options, 'access', _2 => _2.copies, 'optionalAccess', _3 => _3.length]) ? options.copies : [
|
|
315
|
+
this.smoother = new (0, _chunk2XS6LTUPcjs.PenSmoother)(brush.tip.smoothing, brush.pressureSmoothing);
|
|
316
|
+
this.copies = _optionalChain([options, 'access', _2 => _2.copies, 'optionalAccess', _3 => _3.length]) ? options.copies : [_chunk2XS6LTUPcjs.IDENTITY_COPY];
|
|
318
317
|
const exchanging = brush.engine === "mixer" || brush.engine === "dab";
|
|
319
|
-
const rates = brush.engine === "mixer" ?
|
|
318
|
+
const rates = brush.engine === "mixer" ? _chunkQBWEH3IMcjs.mixerRates.call(void 0, brush.mixer) : _chunkQBWEH3IMcjs.exchangeRates.call(void 0, brush.behavior.pickup, brush.behavior.mix, 1, brush.behavior.mixing);
|
|
320
319
|
this.mixing = brush.engine === "mixer" ? brush.mixer.mixing : brush.behavior.mixing;
|
|
321
320
|
this.states = this.copies.map((c, i) => ({
|
|
322
|
-
walker: new (0,
|
|
323
|
-
exchange: exchanging ? new (0,
|
|
324
|
-
smudge: brush.engine === "smudge" ? new (0,
|
|
321
|
+
walker: new (0, _chunk2XS6LTUPcjs.PenDabWalker)(brush, (_nullishCoalesce(options.seed, () => ( 0))) + i * 7919 | 0, c.linear),
|
|
322
|
+
exchange: exchanging ? new (0, _chunkQBWEH3IMcjs.PaintExchange)(rates, options.load) : null,
|
|
323
|
+
smudge: brush.engine === "smudge" ? new (0, _chunkQBWEH3IMcjs.SmudgeTip)(brush.smudge, brush.tip.size * (1 + brush.dynamics.tiltSize * 1.5)) : null
|
|
325
324
|
}));
|
|
326
|
-
this.medium = new (0,
|
|
325
|
+
this.medium = new (0, _chunkQBWEH3IMcjs.TileMedium)(options.target, brush.engine === "dab" ? { blend: brush.tip.blend } : {});
|
|
327
326
|
this.depth = options.grain && !options.grain.flat ? Math.min(1, Math.max(0, options.paperDepth * brush.grain)) : 0;
|
|
328
|
-
this.coverage = brush.engine === "dab" ? new (0,
|
|
329
|
-
this.sampler = exchanging && options.paint ? new (0,
|
|
327
|
+
this.coverage = brush.engine === "dab" ? new (0, _chunkQBWEH3IMcjs.CoverageMap)() : null;
|
|
328
|
+
this.sampler = exchanging && options.paint ? new (0, _chunkQBWEH3IMcjs.PaintGradientSampler)(options.paint, _nullishCoalesce(options.seed, () => ( 0))) : null;
|
|
330
329
|
const table = _optionalChain([this, 'access', _4 => _4.sampler, 'optionalAccess', _5 => _5.acrossTip]) ? this.sampler.tipTable(GRADIENT_STEPS) : null;
|
|
331
330
|
this.gradient = table ? table.map((e) => e.rgb) : null;
|
|
332
331
|
this.gradientAlpha = table && table.some((e) => e.alpha < 1) ? table.map((e) => e.alpha) : null;
|
|
333
|
-
this.scratch = brush.engine === "blender" ?
|
|
332
|
+
this.scratch = brush.engine === "blender" ? _chunkQBWEH3IMcjs.createBlenderScratch.call(void 0, ) : null;
|
|
334
333
|
}
|
|
335
334
|
|
|
336
335
|
|
|
@@ -389,7 +388,7 @@ var PaintDabStroke = (_class = class {
|
|
|
389
388
|
}
|
|
390
389
|
paintDabs(copy, dabs, rects) {
|
|
391
390
|
for (const d of dabs) {
|
|
392
|
-
const rect =
|
|
391
|
+
const rect = _chunkQBWEH3IMcjs.dabRect.call(void 0, d, this.brush.tip.hardness);
|
|
393
392
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
394
393
|
this.dab(copy, d, rect);
|
|
395
394
|
rects.push(rect);
|
|
@@ -405,13 +404,13 @@ var PaintDabStroke = (_class = class {
|
|
|
405
404
|
}
|
|
406
405
|
const tip = this.tip.subarray(0, n);
|
|
407
406
|
tip.fill(0);
|
|
408
|
-
|
|
407
|
+
_chunkQBWEH3IMcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.brush.tip.hardness, rect, tip);
|
|
409
408
|
if (!(this.depth > 0 && this.options.grain)) return { tip, cov: tip };
|
|
410
409
|
const cov = this.cov.subarray(0, n);
|
|
411
410
|
const grain = this.options.grain;
|
|
412
411
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
413
412
|
const y = rect.y + yy + 0.5;
|
|
414
|
-
for (let xx = 0; xx < rect.width; xx++, k++) cov[k] = tip[k] > 0 ? tip[k] *
|
|
413
|
+
for (let xx = 0; xx < rect.width; xx++, k++) cov[k] = tip[k] > 0 ? tip[k] * _chunk2XS6LTUPcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, y), this.depth, d.pressure) : 0;
|
|
415
414
|
}
|
|
416
415
|
return { tip, cov };
|
|
417
416
|
}
|
|
@@ -420,7 +419,7 @@ var PaintDabStroke = (_class = class {
|
|
|
420
419
|
const { tip, cov } = this.rasterize(d, rect);
|
|
421
420
|
const st = this.states[copy];
|
|
422
421
|
if (brush.engine === "blender") {
|
|
423
|
-
|
|
422
|
+
_chunkQBWEH3IMcjs.blenderDab.call(void 0, this.medium, rect, cov, d.opacity * d.alpha * brush.tip.opacity, d.radius, brush.blender, this.scratch);
|
|
424
423
|
return;
|
|
425
424
|
}
|
|
426
425
|
if (brush.engine === "smudge") {
|
|
@@ -542,7 +541,7 @@ function normalizeLighting(raw = {}, base = DEFAULT_LIGHTING) {
|
|
|
542
541
|
};
|
|
543
542
|
}
|
|
544
543
|
function emptyThickChannels() {
|
|
545
|
-
return { height: new (0,
|
|
544
|
+
return { height: new (0, _chunkO7LUD7MHcjs.TiledSurface)(1, /* @__PURE__ */ new Map(), 0), material: new (0, _chunkO7LUD7MHcjs.TiledSurface)(4, /* @__PURE__ */ new Map(), 0) };
|
|
546
545
|
}
|
|
547
546
|
var RELIEF_PX = 7;
|
|
548
547
|
var AMBIENT = 0.38;
|
|
@@ -566,16 +565,16 @@ function lightTile(color, height, heightAround, material, light) {
|
|
|
566
565
|
const k = RELIEF_PX / 255 * light.relief * 2;
|
|
567
566
|
const flatDiffuse = AMBIENT + (1 - AMBIENT) * lz;
|
|
568
567
|
const read = (x, y) => {
|
|
569
|
-
if (x >= 0 && y >= 0 && x <
|
|
570
|
-
const dx = x < 0 ? -1 : x >=
|
|
571
|
-
const dy = y < 0 ? -1 : y >=
|
|
568
|
+
if (x >= 0 && y >= 0 && x < _chunkO7LUD7MHcjs.TILE && y < _chunkO7LUD7MHcjs.TILE) return height[y * _chunkO7LUD7MHcjs.TILE + x];
|
|
569
|
+
const dx = x < 0 ? -1 : x >= _chunkO7LUD7MHcjs.TILE ? 1 : 0;
|
|
570
|
+
const dy = y < 0 ? -1 : y >= _chunkO7LUD7MHcjs.TILE ? 1 : 0;
|
|
572
571
|
const t = heightAround(dx, dy);
|
|
573
572
|
if (!t) return 0;
|
|
574
|
-
return t[(y - dy *
|
|
573
|
+
return t[(y - dy * _chunkO7LUD7MHcjs.TILE) * _chunkO7LUD7MHcjs.TILE + (x - dx * _chunkO7LUD7MHcjs.TILE)];
|
|
575
574
|
};
|
|
576
|
-
for (let y = 0; y <
|
|
577
|
-
for (let x = 0; x <
|
|
578
|
-
const p = y *
|
|
575
|
+
for (let y = 0; y < _chunkO7LUD7MHcjs.TILE; y++) {
|
|
576
|
+
for (let x = 0; x < _chunkO7LUD7MHcjs.TILE; x++) {
|
|
577
|
+
const p = y * _chunkO7LUD7MHcjs.TILE + x;
|
|
579
578
|
const i = p * 4;
|
|
580
579
|
if (color[i + 3] === 0) continue;
|
|
581
580
|
const h = height[p];
|
|
@@ -596,10 +595,10 @@ function lightTile(color, height, heightAround, material, light) {
|
|
|
596
595
|
const nh = Math.max(0, nx * hx + ny * hy + nz * hz);
|
|
597
596
|
const spec = Math.max(0, Math.pow(nh, shininess) - Math.pow(hz, shininess)) * (0.25 + 0.75 * gloss) * light.relief;
|
|
598
597
|
for (let c = 0; c < 3; c++) {
|
|
599
|
-
const a =
|
|
598
|
+
const a = _chunkF2Y4E4GUcjs.SRGB_TO_LINEAR[color[i + c]];
|
|
600
599
|
const tint = metal * a + (1 - metal);
|
|
601
600
|
const v = a * shade * (1 - 0.35 * metal) + spec * tint * (1 + metal);
|
|
602
|
-
out[i + c] =
|
|
601
|
+
out[i + c] = _chunkF2Y4E4GUcjs.linearToSrgb8.call(void 0, v);
|
|
603
602
|
}
|
|
604
603
|
}
|
|
605
604
|
}
|
|
@@ -617,14 +616,14 @@ var LitCache = (_class2 = class {constructor() { _class2.prototype.__init11.call
|
|
|
617
616
|
for (const [key, tile] of color.tiles) {
|
|
618
617
|
const tx = key % 65536 - 32768;
|
|
619
618
|
const ty = Math.floor(key / 65536) - 32768;
|
|
620
|
-
const around = (dx, dy) => _nullishCoalesce(_optionalChain([ch, 'access', _10 => _10.height, 'access', _11 => _11.tiles, 'access', _12 => _12.get, 'call', _13 => _13(
|
|
619
|
+
const around = (dx, dy) => _nullishCoalesce(_optionalChain([ch, 'access', _10 => _10.height, 'access', _11 => _11.tiles, 'access', _12 => _12.get, 'call', _13 => _13(_chunkO7LUD7MHcjs.tileKey.call(void 0, tx + dx, ty + dy)), 'optionalAccess', _14 => _14.data]), () => ( null));
|
|
621
620
|
let any = false;
|
|
622
621
|
for (let dy = -1; dy <= 1 && !any; dy++) for (let dx = -1; dx <= 1 && !any; dx++) if (around(dx, dy)) any = true;
|
|
623
622
|
if (!any) continue;
|
|
624
623
|
const h = _nullishCoalesce(ch.height.tiles.get(key), () => ( null));
|
|
625
624
|
const m = _nullishCoalesce(ch.material.tiles.get(key), () => ( null));
|
|
626
625
|
const inputs = [tile, lk, m];
|
|
627
|
-
for (let dy = -1; dy <= 1; dy++) for (let dx = -1; dx <= 1; dx++) inputs.push(_nullishCoalesce(ch.height.tiles.get(
|
|
626
|
+
for (let dy = -1; dy <= 1; dy++) for (let dx = -1; dx <= 1; dx++) inputs.push(_nullishCoalesce(ch.height.tiles.get(_chunkO7LUD7MHcjs.tileKey.call(void 0, tx + dx, ty + dy)), () => ( null)));
|
|
628
627
|
const cached = this.tiles.get(key);
|
|
629
628
|
if (cached && cached.inputs.length === inputs.length && cached.inputs.every((v, i) => v === inputs[i])) {
|
|
630
629
|
out.set(key, cached.tile);
|
|
@@ -633,7 +632,7 @@ var LitCache = (_class2 = class {constructor() { _class2.prototype.__init11.call
|
|
|
633
632
|
const hd = h ? expand(h, 1) : null;
|
|
634
633
|
const md = m ? expand(m, 4) : null;
|
|
635
634
|
const data = lightTile(expand(tile, 4), hd, (dx, dy) => {
|
|
636
|
-
const t = ch.height.tiles.get(
|
|
635
|
+
const t = ch.height.tiles.get(_chunkO7LUD7MHcjs.tileKey.call(void 0, tx + dx, ty + dy));
|
|
637
636
|
return t ? expand(t, 1) : null;
|
|
638
637
|
}, md, light);
|
|
639
638
|
const lit = { data, uniform: null };
|
|
@@ -641,12 +640,12 @@ var LitCache = (_class2 = class {constructor() { _class2.prototype.__init11.call
|
|
|
641
640
|
out.set(key, lit);
|
|
642
641
|
}
|
|
643
642
|
for (const key of [...this.tiles.keys()]) if (!keys.has(key)) this.tiles.delete(key);
|
|
644
|
-
return new (0,
|
|
643
|
+
return new (0, _chunkO7LUD7MHcjs.TiledSurface)(4, out, color.defaultValue);
|
|
645
644
|
}
|
|
646
645
|
}, _class2);
|
|
647
646
|
function expand(t, channels) {
|
|
648
|
-
if (t.data.length ===
|
|
649
|
-
const out = new Uint8ClampedArray(
|
|
647
|
+
if (t.data.length === _chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE * channels) return t.data;
|
|
648
|
+
const out = new Uint8ClampedArray(_chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE * channels);
|
|
650
649
|
const u = _nullishCoalesce(t.uniform, () => ( 0));
|
|
651
650
|
if (channels === 1) out.fill(u & 255);
|
|
652
651
|
else {
|
|
@@ -659,19 +658,19 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
659
658
|
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);
|
|
660
659
|
this.init = init;
|
|
661
660
|
const b = init.brush;
|
|
662
|
-
this.smoother = new (0,
|
|
663
|
-
const copies = init.copies.length ? init.copies : [
|
|
661
|
+
this.smoother = new (0, _chunk2XS6LTUPcjs.PenSmoother)(b.tip.smoothing, b.pressureSmoothing);
|
|
662
|
+
const copies = init.copies.length ? init.copies : [_chunk2XS6LTUPcjs.IDENTITY_COPY];
|
|
664
663
|
this.copies = copies;
|
|
665
|
-
const rates =
|
|
664
|
+
const rates = _chunkQBWEH3IMcjs.exchangeRates.call(void 0, b.behavior.pickup, b.behavior.mix, 1, b.behavior.mixing);
|
|
666
665
|
this.states = copies.map((c, i) => ({
|
|
667
|
-
walker: new (0,
|
|
668
|
-
exchange: new (0,
|
|
669
|
-
smudge: b.impasto.tool === "knife" ? new (0,
|
|
666
|
+
walker: new (0, _chunk2XS6LTUPcjs.PenDabWalker)(b, init.seed + i * 7919 | 0, c.linear),
|
|
667
|
+
exchange: new (0, _chunkQBWEH3IMcjs.PaintExchange)(rates, init.load),
|
|
668
|
+
smudge: b.impasto.tool === "knife" ? new (0, _chunkQBWEH3IMcjs.SmudgeTip)({ strength: 0.85, length: 0.6 + 0.38 * b.impasto.drag, mixing: b.behavior.mixing }, b.tip.size * 1.2) : null,
|
|
670
669
|
carried: null,
|
|
671
670
|
amount: 1
|
|
672
671
|
}));
|
|
673
|
-
this.medium = new (0,
|
|
674
|
-
this.sampler = init.paint ? new (0,
|
|
672
|
+
this.medium = new (0, _chunkQBWEH3IMcjs.TileMedium)(init.target, {});
|
|
673
|
+
this.sampler = init.paint ? new (0, _chunkQBWEH3IMcjs.PaintGradientSampler)(init.paint.map.by === "across-tip" ? { ...init.paint, map: { by: "distance", length: 300, repeat: "mirror" } } : init.paint, init.seed) : null;
|
|
675
674
|
}
|
|
676
675
|
|
|
677
676
|
__init12() {this.dabCount = 0}
|
|
@@ -697,47 +696,47 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
697
696
|
const h = new Map(this.init.channels.height.tiles);
|
|
698
697
|
const m = new Map(this.init.channels.material.tiles);
|
|
699
698
|
for (const [k, d] of this.height) {
|
|
700
|
-
const t =
|
|
699
|
+
const t = _chunkO7LUD7MHcjs.finishTile.call(void 0, d, 1, 0);
|
|
701
700
|
if (t) h.set(k, t);
|
|
702
701
|
else h.delete(k);
|
|
703
702
|
}
|
|
704
703
|
for (const [k, d] of this.material) {
|
|
705
|
-
const t =
|
|
704
|
+
const t = _chunkO7LUD7MHcjs.finishTile.call(void 0, new Uint8ClampedArray(d), 4, 0);
|
|
706
705
|
if (t) m.set(k, t);
|
|
707
706
|
else m.delete(k);
|
|
708
707
|
}
|
|
709
708
|
void this.version;
|
|
710
|
-
return { height: new (0,
|
|
709
|
+
return { height: new (0, _chunkO7LUD7MHcjs.TiledSurface)(1, h, 0), material: new (0, _chunkO7LUD7MHcjs.TiledSurface)(4, m, 0) };
|
|
711
710
|
}
|
|
712
711
|
heightTile(tx, ty, write) {
|
|
713
|
-
const key =
|
|
712
|
+
const key = _chunkO7LUD7MHcjs.tileKey.call(void 0, tx, ty);
|
|
714
713
|
let t = this.height.get(key);
|
|
715
714
|
if (t) {
|
|
716
715
|
return t;
|
|
717
716
|
}
|
|
718
717
|
const base = this.init.channels.height.tiles.get(key);
|
|
719
718
|
if (!write) return base ? expand(base, 1) : null;
|
|
720
|
-
t = base ? new Uint8ClampedArray(expand(base, 1)) : new Uint8ClampedArray(
|
|
719
|
+
t = base ? new Uint8ClampedArray(expand(base, 1)) : new Uint8ClampedArray(_chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE);
|
|
721
720
|
this.height.set(key, t);
|
|
722
721
|
return t;
|
|
723
722
|
}
|
|
724
723
|
materialTile(tx, ty) {
|
|
725
|
-
const key =
|
|
724
|
+
const key = _chunkO7LUD7MHcjs.tileKey.call(void 0, tx, ty);
|
|
726
725
|
let t = this.material.get(key);
|
|
727
726
|
if (!t) {
|
|
728
727
|
const base = this.init.channels.material.tiles.get(key);
|
|
729
|
-
t = base ? new Uint8ClampedArray(expand(base, 4)) : new Uint8ClampedArray(
|
|
728
|
+
t = base ? new Uint8ClampedArray(expand(base, 4)) : new Uint8ClampedArray(_chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE * 4);
|
|
730
729
|
this.material.set(key, t);
|
|
731
730
|
}
|
|
732
731
|
return t;
|
|
733
732
|
}
|
|
734
733
|
getH(x, y) {
|
|
735
|
-
const t = this.heightTile(Math.floor(x /
|
|
736
|
-
return t ? t[(y & 255) *
|
|
734
|
+
const t = this.heightTile(Math.floor(x / _chunkO7LUD7MHcjs.TILE), Math.floor(y / _chunkO7LUD7MHcjs.TILE), false);
|
|
735
|
+
return t ? t[(y & 255) * _chunkO7LUD7MHcjs.TILE + (x & 255)] : 0;
|
|
737
736
|
}
|
|
738
737
|
setH(x, y, v) {
|
|
739
|
-
const t = this.heightTile(Math.floor(x /
|
|
740
|
-
t[(y & 255) *
|
|
738
|
+
const t = this.heightTile(Math.floor(x / _chunkO7LUD7MHcjs.TILE), Math.floor(y / _chunkO7LUD7MHcjs.TILE), true);
|
|
739
|
+
t[(y & 255) * _chunkO7LUD7MHcjs.TILE + (x & 255)] = v;
|
|
741
740
|
}
|
|
742
741
|
push(points) {
|
|
743
742
|
const rects = [];
|
|
@@ -767,7 +766,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
767
766
|
}
|
|
768
767
|
applyDabs(copy, dabs, rects) {
|
|
769
768
|
for (const d of dabs) {
|
|
770
|
-
const rect =
|
|
769
|
+
const rect = _chunkQBWEH3IMcjs.dabRect.call(void 0, d, this.init.brush.tip.hardness);
|
|
771
770
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
772
771
|
this.dab(copy, d, rect);
|
|
773
772
|
rects.push(rect);
|
|
@@ -782,7 +781,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
782
781
|
const n = rect.width * rect.height;
|
|
783
782
|
if (this.tip.length < n) this.tip = new Float32Array(n);
|
|
784
783
|
const tip = this.tip.subarray(0, n);
|
|
785
|
-
|
|
784
|
+
_chunkQBWEH3IMcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, b.tip.hardness, rect, tip);
|
|
786
785
|
const sel = this.init.target.selection;
|
|
787
786
|
if (sel) {
|
|
788
787
|
for (let yy = 0, p = 0; yy < rect.height; yy++)
|
|
@@ -836,7 +835,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
836
835
|
const full = 255 * thick * k;
|
|
837
836
|
switch (im.tool) {
|
|
838
837
|
case "brush": {
|
|
839
|
-
const ridge = 0.6 + 0.4 * Math.sin(u * 9 +
|
|
838
|
+
const ridge = 0.6 + 0.4 * Math.sin(u * 9 + _chunkQBWEH3IMcjs.hash2.call(void 0, Math.round(u * 6), 3, seed) * 6.28) + 0.15 * (_chunkQBWEH3IMcjs.hash2.call(void 0, lx, ly, seed) - 0.5);
|
|
840
839
|
const target = full * c * ridge;
|
|
841
840
|
h = Math.max(h0 * (1 - 0.25 * c * im.drag), Math.min(255, h0 * 0.35 + target));
|
|
842
841
|
break;
|
|
@@ -852,7 +851,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
852
851
|
break;
|
|
853
852
|
}
|
|
854
853
|
case "roller": {
|
|
855
|
-
const stipple = 0.75 + 0.5 *
|
|
854
|
+
const stipple = 0.75 + 0.5 * _chunkQBWEH3IMcjs.hash2.call(void 0, lx >> 1, ly >> 1, seed);
|
|
856
855
|
h = h0 + (Math.min(255, full * 0.6 * stipple) - h0) * Math.min(1, c * 1.5);
|
|
857
856
|
break;
|
|
858
857
|
}
|
|
@@ -897,8 +896,8 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
897
896
|
if (c <= 0) continue;
|
|
898
897
|
const lx = rect.x + xx - off.x;
|
|
899
898
|
const ly = rect.y + yy - off.y;
|
|
900
|
-
const t = this.materialTile(Math.floor(lx /
|
|
901
|
-
const i = ((ly & 255) *
|
|
899
|
+
const t = this.materialTile(Math.floor(lx / _chunkO7LUD7MHcjs.TILE), Math.floor(ly / _chunkO7LUD7MHcjs.TILE));
|
|
900
|
+
const i = ((ly & 255) * _chunkO7LUD7MHcjs.TILE + (lx & 255)) * 4;
|
|
902
901
|
t[i] = Math.round(t[i] + (gloss * 255 - t[i]) * c);
|
|
903
902
|
t[i + 1] = Math.round(t[i + 1] + (metal * 255 - t[i + 1]) * c);
|
|
904
903
|
t[i + 3] = 255;
|
|
@@ -917,28 +916,28 @@ function reliefInfo(ch) {
|
|
|
917
916
|
function thickToJSON(ch) {
|
|
918
917
|
const b = ch.height.bounds;
|
|
919
918
|
if (!b) return null;
|
|
920
|
-
return { rect: { ...b }, height:
|
|
919
|
+
return { rect: { ...b }, height: _chunkO7LUD7MHcjs.pngDataUrl.call(void 0, b.width, b.height, _chunkO7LUD7MHcjs.readRegion.call(void 0, ch.height, b), 1), material: _chunkO7LUD7MHcjs.pngDataUrl.call(void 0, b.width, b.height, _chunkO7LUD7MHcjs.readRegion.call(void 0, ch.material, b), 4) };
|
|
921
920
|
}
|
|
922
921
|
function thickFromJSON(raw) {
|
|
923
922
|
const r = raw;
|
|
924
923
|
if (!r || typeof r !== "object" || !r.rect || typeof r.height !== "string" || typeof r.material !== "string") throw new Error("not saved thick-paint channels");
|
|
925
924
|
const decode = (url, gray) => {
|
|
926
|
-
const parsed =
|
|
925
|
+
const parsed = _chunkO7LUD7MHcjs.parseDataUrl.call(void 0, url);
|
|
927
926
|
if (!parsed) throw new Error("a channel is not a PNG data URL");
|
|
928
|
-
return
|
|
927
|
+
return _chunkO7LUD7MHcjs.decodePng.call(void 0, parsed.bytes, { keepGray: gray });
|
|
929
928
|
};
|
|
930
929
|
const h = decode(r.height, true);
|
|
931
930
|
const m = decode(r.material, false);
|
|
932
931
|
const hd = h.channels === 1 ? h.data : Uint8ClampedArray.from({ length: h.width * h.height }, (_, i) => h.data[i * 4]);
|
|
933
932
|
return {
|
|
934
|
-
height:
|
|
935
|
-
material:
|
|
933
|
+
height: _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, { width: h.width, height: h.height, data: hd }, 1, r.rect.x, r.rect.y),
|
|
934
|
+
material: _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, { width: m.width, height: m.height, data: m.data }, 4, r.rect.x, r.rect.y)
|
|
936
935
|
};
|
|
937
936
|
}
|
|
938
937
|
|
|
939
938
|
// src/paint-editor/stroke.ts
|
|
940
939
|
function defaultTile(surface) {
|
|
941
|
-
const data = new Uint8ClampedArray(
|
|
940
|
+
const data = new Uint8ClampedArray(_chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE * surface.channels);
|
|
942
941
|
if (surface.defaultValue) data.fill(surface.defaultValue);
|
|
943
942
|
return data;
|
|
944
943
|
}
|
|
@@ -962,7 +961,7 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
962
961
|
this.layerId = init.layerId;
|
|
963
962
|
this.base = init.surface;
|
|
964
963
|
this.live = new Map(this.base.tiles);
|
|
965
|
-
this.copies = init.copies.length ? init.copies : [
|
|
964
|
+
this.copies = init.copies.length ? init.copies : [_chunk2XS6LTUPcjs.IDENTITY_COPY];
|
|
966
965
|
const brush = init.brush;
|
|
967
966
|
if (init.wet) this.wetDriver = init.wet.driver;
|
|
968
967
|
this.apply = {
|
|
@@ -977,11 +976,11 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
977
976
|
};
|
|
978
977
|
if (this.wetDriver) {
|
|
979
978
|
} else if (init.sticker) {
|
|
980
|
-
this.stickerSpray = new (0,
|
|
979
|
+
this.stickerSpray = new (0, _chunk2XS6LTUPcjs.StickerSpray)({ brush, target: this.tileTarget(), color: init.colorHex, seed: init.seed, copies: this.copies, nextId: init.sticker.nextId, paint: _nullishCoalesce(init.paint, () => ( null)) });
|
|
981
980
|
} else if (init.thick) {
|
|
982
981
|
const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
|
|
983
982
|
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)) });
|
|
984
|
-
} else if (brush.engine === "mixer" || brush.engine === "blender" || brush.engine === "smudge" ||
|
|
983
|
+
} else if (brush.engine === "mixer" || brush.engine === "blender" || brush.engine === "smudge" || _chunk2XS6LTUPcjs.usesPaintExchange.call(void 0, brush, Boolean(init.paint))) {
|
|
985
984
|
const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
|
|
986
985
|
this.wet = new PaintDabStroke(brush, {
|
|
987
986
|
target: this.tileTarget(),
|
|
@@ -996,7 +995,7 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
996
995
|
});
|
|
997
996
|
} else {
|
|
998
997
|
const opts = { grain: init.grain, paperDepth: init.paperDepth, seed: init.seed, copies: this.copies, paint: _nullishCoalesce(init.paint, () => ( null)) };
|
|
999
|
-
this.dry = brush.engine === "particle" ? new (0,
|
|
998
|
+
this.dry = brush.engine === "particle" ? new (0, _chunk2XS6LTUPcjs.ParticleStroke)(brush, opts) : brush.engine === "bristle" ? new (0, _chunk2XS6LTUPcjs.BristleStroke)(brush, opts) : new (0, _chunk2XS6LTUPcjs.DryStroke)(brush, opts);
|
|
1000
999
|
}
|
|
1001
1000
|
}
|
|
1002
1001
|
|
|
@@ -1028,9 +1027,9 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1028
1027
|
offset: this.init.offset,
|
|
1029
1028
|
lockTransparency: this.init.lockTransparency,
|
|
1030
1029
|
selection: _nullishCoalesce(this.init.selection, () => ( null)),
|
|
1031
|
-
readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _15 => _15.live, 'access', _16 => _16.get, 'call', _17 => _17(
|
|
1030
|
+
readTile: (tx, ty) => _nullishCoalesce(_optionalChain([this, 'access', _15 => _15.live, 'access', _16 => _16.get, 'call', _17 => _17(_chunkO7LUD7MHcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _18 => _18.data]), () => ( null)),
|
|
1032
1031
|
writeTile: (tx, ty) => {
|
|
1033
|
-
const key =
|
|
1032
|
+
const key = _chunkO7LUD7MHcjs.tileKey.call(void 0, tx, ty);
|
|
1034
1033
|
if (!this.touched.has(key)) {
|
|
1035
1034
|
const src = _nullishCoalesce(_optionalChain([this, 'access', _19 => _19.base, 'access', _20 => _20.tiles, 'access', _21 => _21.get, 'call', _22 => _22(key), 'optionalAccess', _23 => _23.data]), () => ( defaultTile(this.base)));
|
|
1036
1035
|
this.live.set(key, { data: new Uint8ClampedArray(src), uniform: null });
|
|
@@ -1086,7 +1085,7 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1086
1085
|
const changed = d.dabCount > 0;
|
|
1087
1086
|
this.result = { layerId: this.layerId, bounds: changed ? d.bounds : null, dabs: d.dabCount, strokeId: null, wet: true };
|
|
1088
1087
|
const carried = d.load;
|
|
1089
|
-
if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried :
|
|
1088
|
+
if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried : _chunkQBWEH3IMcjs.cleanMixer.call(void 0, carried);
|
|
1090
1089
|
this.host.commit(this, changed ? this.init.wet.surface() : null, false);
|
|
1091
1090
|
}
|
|
1092
1091
|
update(rects) {
|
|
@@ -1096,14 +1095,14 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1096
1095
|
if (!this.dry) {
|
|
1097
1096
|
for (const key of this.fresh) this.live.set(key, { data: this.live.get(key).data, uniform: null });
|
|
1098
1097
|
this.fresh.clear();
|
|
1099
|
-
this.host.update(this.layerId, new (0,
|
|
1098
|
+
this.host.update(this.layerId, new (0, _chunkO7LUD7MHcjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
|
|
1100
1099
|
return;
|
|
1101
1100
|
}
|
|
1102
1101
|
const off = this.init.offset;
|
|
1103
1102
|
const regions = /* @__PURE__ */ new Map();
|
|
1104
1103
|
for (const r of rects) {
|
|
1105
|
-
for (const t of
|
|
1106
|
-
const key =
|
|
1104
|
+
for (const t of _chunkO7LUD7MHcjs.tilesInRect.call(void 0, { x: r.x - off.x, y: r.y - off.y, width: r.width, height: r.height })) {
|
|
1105
|
+
const key = _chunkO7LUD7MHcjs.tileKey.call(void 0, t.tx, t.ty);
|
|
1107
1106
|
const cur = regions.get(key);
|
|
1108
1107
|
regions.set(key, { tx: t.tx, ty: t.ty, r: cur ? union(cur.r, r) : r });
|
|
1109
1108
|
}
|
|
@@ -1112,10 +1111,10 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1112
1111
|
const src = _nullishCoalesce(_optionalChain([this, 'access', _27 => _27.base, 'access', _28 => _28.tiles, 'access', _29 => _29.get, 'call', _30 => _30(key), 'optionalAccess', _31 => _31.data]), () => ( defaultTile(this.base)));
|
|
1113
1112
|
const prev = this.touched.has(key) ? _optionalChain([this, 'access', _32 => _32.live, 'access', _33 => _33.get, 'call', _34 => _34(key), 'optionalAccess', _35 => _35.data]) : void 0;
|
|
1114
1113
|
this.touched.add(key);
|
|
1115
|
-
const data =
|
|
1114
|
+
const data = _chunkQBWEH3IMcjs.applyStrokeToTile.call(void 0, this.dry.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
|
|
1116
1115
|
this.live.set(key, { data, uniform: null });
|
|
1117
1116
|
}
|
|
1118
|
-
this.host.update(this.layerId, new (0,
|
|
1117
|
+
this.host.update(this.layerId, new (0, _chunkO7LUD7MHcjs.TiledSurface)(ch, new Map(this.live), this.base.defaultValue), rects);
|
|
1119
1118
|
}
|
|
1120
1119
|
/** Ends the stroke (one undo step) and returns what changed. */
|
|
1121
1120
|
end() {
|
|
@@ -1136,18 +1135,18 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1136
1135
|
const tiles = new Map(this.base.tiles);
|
|
1137
1136
|
let changed = false;
|
|
1138
1137
|
for (const key of this.touched) {
|
|
1139
|
-
const tile =
|
|
1138
|
+
const tile = _chunkO7LUD7MHcjs.finishTile.call(void 0, this.live.get(key).data, ch, this.base.defaultValue);
|
|
1140
1139
|
const prev = this.base.tiles.get(key);
|
|
1141
1140
|
if (tile) tiles.set(key, tile);
|
|
1142
1141
|
else tiles.delete(key);
|
|
1143
1142
|
if (!sameTile(prev, tile)) changed = true;
|
|
1144
1143
|
}
|
|
1145
1144
|
if (this.thickDriver && this.thickDriver.dabCount > 0) changed = true;
|
|
1146
|
-
const surface = changed ? new (0,
|
|
1145
|
+
const surface = changed ? new (0, _chunkO7LUD7MHcjs.TiledSurface)(ch, tiles, this.base.defaultValue) : null;
|
|
1147
1146
|
const dabs = this.dry ? this.dry.dabCount : this.thickDriver ? this.thickDriver.dabCount : this.stickerSpray ? this.stickerSpray.dabCount : this.wet.dabCount;
|
|
1148
1147
|
this.result = { layerId: this.layerId, bounds: changed ? this.bounds : null, dabs, strokeId: null };
|
|
1149
1148
|
const carried = _nullishCoalesce(_optionalChain([this, 'access', _36 => _36.wet, 'optionalAccess', _37 => _37.load]), () => ( _optionalChain([this, 'access', _38 => _38.thickDriver, 'optionalAccess', _39 => _39.load])));
|
|
1150
|
-
if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried :
|
|
1149
|
+
if (carried) this.result.mixerLoad = this.init.brush.behavior.dirty ? carried : _chunkQBWEH3IMcjs.cleanMixer.call(void 0, carried);
|
|
1151
1150
|
this.host.commit(this, surface, false);
|
|
1152
1151
|
return this.result;
|
|
1153
1152
|
}
|
|
@@ -1160,15 +1159,15 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1160
1159
|
}, _class4);
|
|
1161
1160
|
function mixerLoadForStroke(brush, current, color) {
|
|
1162
1161
|
if (!brush.loadsColor) return { reservoir: null, amount: 0, pickup: brush.mixer.cleanEachStroke ? null : current.pickup };
|
|
1163
|
-
if (brush.mixer.loadEachStroke || !current.reservoir) return
|
|
1162
|
+
if (brush.mixer.loadEachStroke || !current.reservoir) return _chunkQBWEH3IMcjs.loadMixer.call(void 0, current, color);
|
|
1164
1163
|
return current;
|
|
1165
1164
|
}
|
|
1166
1165
|
function brushLoadForStroke(brush, current, color) {
|
|
1167
1166
|
if (brush.engine === "mixer") return mixerLoadForStroke(brush, current, color);
|
|
1168
1167
|
if (brush.engine === "impasto") return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
|
|
1169
|
-
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 } :
|
|
1170
|
-
if (
|
|
1171
|
-
return
|
|
1168
|
+
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 } : _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD;
|
|
1169
|
+
if (_chunk2XS6LTUPcjs.usesPaintExchange.call(void 0, brush)) return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
|
|
1170
|
+
return _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD;
|
|
1172
1171
|
}
|
|
1173
1172
|
|
|
1174
1173
|
// src/paint-editor/stencils.ts
|
|
@@ -1424,7 +1423,7 @@ function normalizeBrushStroke(raw) {
|
|
|
1424
1423
|
const out = {
|
|
1425
1424
|
id: r.id,
|
|
1426
1425
|
layerId: r.layerId,
|
|
1427
|
-
brush:
|
|
1426
|
+
brush: _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, _nullishCoalesce(r.brush, () => ( {}))),
|
|
1428
1427
|
color: typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : "#000000",
|
|
1429
1428
|
points,
|
|
1430
1429
|
seed: finite2(r.seed) ? r.seed | 0 : 0
|
|
@@ -1443,7 +1442,7 @@ function normalizeBrushStroke(raw) {
|
|
|
1443
1442
|
}
|
|
1444
1443
|
if (st.length) out.stencils = st;
|
|
1445
1444
|
}
|
|
1446
|
-
const paint =
|
|
1445
|
+
const paint = _chunkQBWEH3IMcjs.readPaintSource.call(void 0, r.paint);
|
|
1447
1446
|
if (paint && paint.type === "gradient") out.paint = paint;
|
|
1448
1447
|
if (Array.isArray(r.steps) && r.steps.length === points.length && r.steps.every((v) => Number.isInteger(v) && v >= 0)) out.steps = [...r.steps];
|
|
1449
1448
|
return out;
|
|
@@ -1480,9 +1479,9 @@ function varyStroke(stroke, m, v) {
|
|
|
1480
1479
|
if (ps !== 1) q.pressure = Math.min(1, Math.max(0, (_nullishCoalesce(p.pressure, () => ( 1))) * ps));
|
|
1481
1480
|
return q;
|
|
1482
1481
|
});
|
|
1483
|
-
const brush = s !== 1 ?
|
|
1482
|
+
const brush = s !== 1 ? _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { ...stroke.brush, tip: { ...stroke.brush.tip, size: stroke.brush.tip.size * s } }) : stroke.brush;
|
|
1484
1483
|
const out = { ...stroke, brush, points };
|
|
1485
|
-
if (stroke.paint && s !== 1) out.paint =
|
|
1484
|
+
if (stroke.paint && s !== 1) out.paint = _chunkQBWEH3IMcjs.scalePaintGradient.call(void 0, stroke.paint, s);
|
|
1486
1485
|
if (_optionalChain([stroke, 'access', _57 => _57.copies, 'optionalAccess', _58 => _58.length])) {
|
|
1487
1486
|
const inv = invertAffine(m);
|
|
1488
1487
|
out.copies = stroke.copies.map((c) => composeAffine(m, composeAffine(c, inv)));
|
|
@@ -1514,7 +1513,7 @@ function paperGrain(paper) {
|
|
|
1514
1513
|
const key = JSON.stringify([paper.pattern, paper.seed, paper.scale, paper.tiling, paper.dry]);
|
|
1515
1514
|
let g = grainCache.get(key);
|
|
1516
1515
|
if (!g) {
|
|
1517
|
-
g = new (0,
|
|
1516
|
+
g = new (0, _chunk2XS6LTUPcjs.PaperGrain)(paper, "dry");
|
|
1518
1517
|
if (grainCache.size > 16) grainCache.delete(grainCache.keys().next().value);
|
|
1519
1518
|
grainCache.set(key, g);
|
|
1520
1519
|
}
|
|
@@ -1524,7 +1523,7 @@ function paperTile(paper, r, light) {
|
|
|
1524
1523
|
const key = `${paperKey(paper, light)}|${r.x},${r.y},${r.width},${r.height}`;
|
|
1525
1524
|
let t = tileCache.get(key);
|
|
1526
1525
|
if (!t) {
|
|
1527
|
-
t =
|
|
1526
|
+
t = _chunk2XS6LTUPcjs.renderPaper.call(void 0, paper, r, paperGrain(paper), light);
|
|
1528
1527
|
if (tileCache.size > 512) tileCache.delete(tileCache.keys().next().value);
|
|
1529
1528
|
tileCache.set(key, t);
|
|
1530
1529
|
}
|
|
@@ -1553,7 +1552,7 @@ var PROFILE = {
|
|
|
1553
1552
|
}
|
|
1554
1553
|
};
|
|
1555
1554
|
function createPaintCompositor() {
|
|
1556
|
-
return new (0,
|
|
1555
|
+
return new (0, _chunkAEAAN4ADcjs.RasterCompositor)(PROFILE);
|
|
1557
1556
|
}
|
|
1558
1557
|
function downsampleRgba(data, width, height, tw, th) {
|
|
1559
1558
|
tw = Math.max(1, Math.round(tw));
|
|
@@ -1628,11 +1627,11 @@ function header(state, options) {
|
|
|
1628
1627
|
return out;
|
|
1629
1628
|
}
|
|
1630
1629
|
function serializePaintDocument(state, options = {}) {
|
|
1631
|
-
const { layers, assets } =
|
|
1630
|
+
const { layers, assets } = _chunkXN2NBLV5cjs.serializeLayers.call(void 0, state.layers);
|
|
1632
1631
|
return { ...header(state, options), layers, assets };
|
|
1633
1632
|
}
|
|
1634
1633
|
async function serializePaintDocumentExternal(state, store, options = {}) {
|
|
1635
|
-
const { layers, assets } = await
|
|
1634
|
+
const { layers, assets } = await _chunkXN2NBLV5cjs.serializeLayersExternal.call(void 0, state.layers, store);
|
|
1636
1635
|
return { ...header(state, options), layers, assets };
|
|
1637
1636
|
}
|
|
1638
1637
|
function paintLayersOnly(layers, problems) {
|
|
@@ -1667,11 +1666,11 @@ function deserializePaintDocument(raw) {
|
|
|
1667
1666
|
}
|
|
1668
1667
|
const problems = [];
|
|
1669
1668
|
const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
|
|
1670
|
-
const paper =
|
|
1669
|
+
const paper = _chunk2XS6LTUPcjs.normalizePaper.call(void 0, _nullishCoalesce(r.paper, () => ( {})));
|
|
1671
1670
|
const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
|
|
1672
|
-
const layers = paintLayersOnly(
|
|
1671
|
+
const layers = paintLayersOnly(_chunkXN2NBLV5cjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
|
|
1673
1672
|
const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
|
|
1674
|
-
const activeLayerId = wanted &&
|
|
1673
|
+
const activeLayerId = wanted && _chunkAEAAN4ADcjs.findLayer.call(void 0, layers, wanted) ? wanted : _nullishCoalesce(_optionalChain([_chunkAEAAN4ADcjs.flattenLayers.call(void 0, layers), 'access', _70 => _70.filter, 'call', _71 => _71((l) => l.type === "pixel"), 'access', _72 => _72.pop, 'call', _73 => _73(), 'optionalAccess', _74 => _74.id]), () => ( null));
|
|
1675
1674
|
const wetEvents = Array.isArray(r.wetEvents) ? r.wetEvents.filter((e) => e && typeof e === "object" && Number.isInteger(e.clock) && typeof e.kind === "string") : [];
|
|
1676
1675
|
const state = { canvas, paper, layers, activeLayerId, strokes: readStrokes(r.strokes, problems) };
|
|
1677
1676
|
if (wetEvents.length) state.wetEvents = wetEvents;
|
|
@@ -1683,7 +1682,7 @@ async function deserializePaintDocumentAsync(raw, store) {
|
|
|
1683
1682
|
if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
|
|
1684
1683
|
const r = raw;
|
|
1685
1684
|
const problems = [];
|
|
1686
|
-
const assets = await
|
|
1685
|
+
const assets = await _chunkXN2NBLV5cjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
|
|
1687
1686
|
const loaded = deserializePaintDocument({ ...r, assets });
|
|
1688
1687
|
return { ...loaded, problems: [...problems, ...loaded.problems] };
|
|
1689
1688
|
}
|
|
@@ -1760,13 +1759,13 @@ function viewPenToDocument(view, p) {
|
|
|
1760
1759
|
|
|
1761
1760
|
// src/paint-editor/input.ts
|
|
1762
1761
|
function samplePressure(e) {
|
|
1763
|
-
return
|
|
1762
|
+
return _chunkF2Y4E4GUcjs.pointerPressure.call(void 0, e);
|
|
1764
1763
|
}
|
|
1765
1764
|
function pointerToPenPoint(e, x, y, view) {
|
|
1766
1765
|
const p = { x, y, pressure: samplePressure(e) };
|
|
1767
1766
|
if (typeof e.timeStamp === "number" && Number.isFinite(e.timeStamp)) p.t = e.timeStamp;
|
|
1768
1767
|
if (e.pointerType !== "pen") return p;
|
|
1769
|
-
const o =
|
|
1768
|
+
const o = _chunk2XS6LTUPcjs.penOrientation.call(void 0, {
|
|
1770
1769
|
x,
|
|
1771
1770
|
y,
|
|
1772
1771
|
altitude: typeof e.altitudeAngle === "number" ? e.altitudeAngle : void 0,
|
|
@@ -1830,7 +1829,7 @@ function downloadBytes(bytes, fileName, mimeType) {
|
|
|
1830
1829
|
|
|
1831
1830
|
// src/paint-editor/wet.ts
|
|
1832
1831
|
var STROKE_WATER = 0.9;
|
|
1833
|
-
var STROKE_MASS =
|
|
1832
|
+
var STROKE_MASS = _chunkF2Y4E4GUcjs.PIGMENT_UNIT * 2.5;
|
|
1834
1833
|
var COVERAGE_STEPS = 4096;
|
|
1835
1834
|
function union2(a, b) {
|
|
1836
1835
|
if (!a) return { ...b };
|
|
@@ -1839,13 +1838,13 @@ function union2(a, b) {
|
|
|
1839
1838
|
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 };
|
|
1840
1839
|
}
|
|
1841
1840
|
function wetPaperInput(paper) {
|
|
1842
|
-
const grain = new (0,
|
|
1841
|
+
const grain = new (0, _chunk2XS6LTUPcjs.PaperGrain)(paper, "wet");
|
|
1843
1842
|
const flat = grain.flat;
|
|
1844
1843
|
return {
|
|
1845
1844
|
absorption: paper.absorption,
|
|
1846
1845
|
permeability: paper.permeability,
|
|
1847
1846
|
roughness: flat ? 0 : paper.roughness,
|
|
1848
|
-
color:
|
|
1847
|
+
color: _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, paper.color),
|
|
1849
1848
|
heightAt: flat ? () => 0.5 : (x, y) => grain.at(x, y)
|
|
1850
1849
|
};
|
|
1851
1850
|
}
|
|
@@ -1853,27 +1852,27 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
1853
1852
|
constructor(init) {;_class5.prototype.__init35.call(this);_class5.prototype.__init36.call(this);_class5.prototype.__init37.call(this);_class5.prototype.__init38.call(this);_class5.prototype.__init39.call(this);_class5.prototype.__init40.call(this);_class5.prototype.__init41.call(this);_class5.prototype.__init42.call(this);_class5.prototype.__init43.call(this);_class5.prototype.__init44.call(this);_class5.prototype.__init45.call(this);_class5.prototype.__init46.call(this);
|
|
1854
1853
|
this.init = init;
|
|
1855
1854
|
const brush = init.brush;
|
|
1856
|
-
this.smoother = new (0,
|
|
1857
|
-
const copies = init.copies.length ? init.copies : [
|
|
1855
|
+
this.smoother = new (0, _chunk2XS6LTUPcjs.PenSmoother)(brush.tip.smoothing, brush.pressureSmoothing);
|
|
1856
|
+
const copies = init.copies.length ? init.copies : [_chunk2XS6LTUPcjs.IDENTITY_COPY];
|
|
1858
1857
|
const wet = brush.wet;
|
|
1859
1858
|
const spacing = Math.max(0.02, brush.tip.spacing);
|
|
1860
1859
|
const perDab = Math.min(1, spacing * 1.2);
|
|
1861
1860
|
const thin = wet.thinner;
|
|
1862
|
-
this.medium = new (0,
|
|
1861
|
+
this.medium = new (0, _chunkF2Y4E4GUcjs.WetMedium)(init.world, init.laneId, {
|
|
1863
1862
|
water: STROKE_WATER * Math.min(1, wet.water * (1 + thin)) * perDab,
|
|
1864
1863
|
mass: STROKE_MASS * wet.pigment * (1 - 0.6 * thin) * perDab,
|
|
1865
1864
|
body: wet.body * (1 - thin)
|
|
1866
1865
|
});
|
|
1867
|
-
const rates =
|
|
1866
|
+
const rates = _chunkQBWEH3IMcjs.exchangeRates.call(void 0, brush.behavior.pickup, brush.behavior.mix, wet.load, brush.behavior.mixing);
|
|
1868
1867
|
this.states = copies.map((c, i) => ({
|
|
1869
|
-
walker: new (0,
|
|
1870
|
-
exchange: wet.tool === "paint" ? new (0,
|
|
1868
|
+
walker: new (0, _chunk2XS6LTUPcjs.PenDabWalker)(brush, init.seed + i * 7919 | 0, c.linear),
|
|
1869
|
+
exchange: wet.tool === "paint" ? new (0, _chunkQBWEH3IMcjs.PaintExchange)(rates, init.load) : null,
|
|
1871
1870
|
last: null
|
|
1872
1871
|
}));
|
|
1873
1872
|
this.copies = copies;
|
|
1874
1873
|
this.depth = init.grain && !init.grain.flat ? Math.min(1, Math.max(0, init.paperDepth * brush.grain)) : 0;
|
|
1875
1874
|
const g = _nullishCoalesce(init.paint, () => ( null));
|
|
1876
|
-
this.sampler = g ? new (0,
|
|
1875
|
+
this.sampler = g ? new (0, _chunkQBWEH3IMcjs.PaintGradientSampler)(g.map.by === "across-tip" ? { ...g, map: { by: "distance", length: 300, repeat: "mirror" } } : g, init.seed) : null;
|
|
1877
1876
|
}
|
|
1878
1877
|
|
|
1879
1878
|
__init35() {this.dabCount = 0}
|
|
@@ -1945,7 +1944,7 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
1945
1944
|
}
|
|
1946
1945
|
applyDabs(copy, dabs, rects) {
|
|
1947
1946
|
for (const d of dabs) {
|
|
1948
|
-
const rect =
|
|
1947
|
+
const rect = _chunkQBWEH3IMcjs.dabRect.call(void 0, d, this.init.brush.tip.hardness);
|
|
1949
1948
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
1950
1949
|
this.dab(copy, d, rect);
|
|
1951
1950
|
rects.push(rect);
|
|
@@ -1962,7 +1961,7 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
1962
1961
|
const tip = this.tip.subarray(0, n);
|
|
1963
1962
|
const cov = this.cov.subarray(0, n);
|
|
1964
1963
|
tip.fill(0);
|
|
1965
|
-
|
|
1964
|
+
_chunkQBWEH3IMcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.init.brush.tip.hardness, rect, tip);
|
|
1966
1965
|
const grain = this.depth > 0 ? this.init.grain : null;
|
|
1967
1966
|
const mask = this.init.mask;
|
|
1968
1967
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
@@ -1973,7 +1972,7 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
1973
1972
|
tip[k] *= mx >= 0 && my >= 0 && mx < mask.width && my < mask.height ? mask.data[my * mask.width + mx] / 255 : 0;
|
|
1974
1973
|
}
|
|
1975
1974
|
let v = tip[k];
|
|
1976
|
-
if (v > 0 && grain) v *=
|
|
1975
|
+
if (v > 0 && grain) v *= _chunk2XS6LTUPcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, rect.y + yy + 0.5), this.depth, d.pressure);
|
|
1977
1976
|
tip[k] = Math.round(tip[k] * COVERAGE_STEPS) / COVERAGE_STEPS;
|
|
1978
1977
|
cov[k] = Math.round(v * COVERAGE_STEPS) / COVERAGE_STEPS;
|
|
1979
1978
|
}
|
|
@@ -2051,7 +2050,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2051
2050
|
|
|
2052
2051
|
|
|
2053
2052
|
__init47() {this.world = null}
|
|
2054
|
-
__init48() {this.tilt = { ...
|
|
2053
|
+
__init48() {this.tilt = { ..._chunkF2Y4E4GUcjs.FLAT }}
|
|
2055
2054
|
__init49() {this.settings = /* @__PURE__ */ new Map()}
|
|
2056
2055
|
__init50() {this.paused = false}
|
|
2057
2056
|
/** Wet strokes dry as soon as they end (one undo step with the stroke). */
|
|
@@ -2075,8 +2074,8 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2075
2074
|
/** Starts the GPU engine for the world (once; it may turn out unavailable). */
|
|
2076
2075
|
startGpu() {
|
|
2077
2076
|
if (this.gpuMode === "off" || this.gpu || this.gpuStarting || this.gpuSupport) return;
|
|
2078
|
-
const provider = this.options.gpuProvider === void 0 ?
|
|
2079
|
-
this.gpuStarting =
|
|
2077
|
+
const provider = this.options.gpuProvider === void 0 ? _chunkF2Y4E4GUcjs.findWebGpu.call(void 0, ) : this.options.gpuProvider;
|
|
2078
|
+
this.gpuStarting = _chunkF2Y4E4GUcjs.createWetGpuEngine.call(void 0, provider).then(({ engine, support }) => {
|
|
2080
2079
|
this.gpuSupport = support;
|
|
2081
2080
|
if (!engine) return;
|
|
2082
2081
|
if (this.gpuMode === "off" || !this.world) {
|
|
@@ -2129,7 +2128,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2129
2128
|
const { width, height } = this.host.canvas();
|
|
2130
2129
|
if (this.world && (this.world.width !== width || this.world.height !== height)) throw new Error("The wet world is the wrong size; dry the paint before resizing the canvas.");
|
|
2131
2130
|
if (!this.world) {
|
|
2132
|
-
this.world = new (0,
|
|
2131
|
+
this.world = new (0, _chunkF2Y4E4GUcjs.WetWorld)(width, height, wetPaperInput(this.host.paper()), { kernel: this.options.kernel, threads: this.options.threads });
|
|
2133
2132
|
this.world.setTilt(this.tilt);
|
|
2134
2133
|
this.world.gpuMinTiles = this.gpuMinTiles;
|
|
2135
2134
|
if (this.gpu) this.world.attachGpu(this.gpu);
|
|
@@ -2159,7 +2158,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2159
2158
|
settingsOf(layerId, medium = "watercolor") {
|
|
2160
2159
|
let s = this.settings.get(layerId);
|
|
2161
2160
|
if (!s) {
|
|
2162
|
-
s = { params:
|
|
2161
|
+
s = { params: _chunkF2Y4E4GUcjs.normalizeWetParams.call(void 0, WET_MEDIUM_PARAMS[medium], _chunkF2Y4E4GUcjs.DEFAULT_WET_PARAMS), flow: { ..._chunkF2Y4E4GUcjs.DEFAULT_FLOW } };
|
|
2163
2162
|
this.settings.set(layerId, s);
|
|
2164
2163
|
}
|
|
2165
2164
|
return s;
|
|
@@ -2168,31 +2167,31 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2168
2167
|
ensureLane(layerId, medium) {
|
|
2169
2168
|
const w = this.ensureWorld();
|
|
2170
2169
|
if (!w.hasLane(layerId)) {
|
|
2171
|
-
const base = _nullishCoalesce(this.host.layerSurface(layerId), () => ( new (0,
|
|
2170
|
+
const base = _nullishCoalesce(this.host.layerSurface(layerId), () => ( new (0, _chunkO7LUD7MHcjs.TiledSurface)(4, /* @__PURE__ */ new Map(), 0)));
|
|
2172
2171
|
const s = this.settingsOf(layerId, medium);
|
|
2173
2172
|
w.ensureLane(layerId, { params: s.params, base });
|
|
2174
2173
|
const { width, height } = this.host.canvas();
|
|
2175
|
-
if (s.flow.kind !== "none") w.setFlow(layerId,
|
|
2174
|
+
if (s.flow.kind !== "none") w.setFlow(layerId, _chunkF2Y4E4GUcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
|
|
2176
2175
|
}
|
|
2177
2176
|
return w;
|
|
2178
2177
|
}
|
|
2179
2178
|
setParams(layerId, update) {
|
|
2180
2179
|
const s = this.settingsOf(layerId);
|
|
2181
|
-
s.params =
|
|
2180
|
+
s.params = _chunkF2Y4E4GUcjs.normalizeWetParams.call(void 0, update, s.params);
|
|
2182
2181
|
if (_optionalChain([this, 'access', _100 => _100.world, 'optionalAccess', _101 => _101.hasLane, 'call', _102 => _102(layerId)])) this.world.setParams(layerId, s.params);
|
|
2183
2182
|
return { ...s.params };
|
|
2184
2183
|
}
|
|
2185
2184
|
setFlow(layerId, update) {
|
|
2186
2185
|
const s = this.settingsOf(layerId);
|
|
2187
|
-
s.flow =
|
|
2186
|
+
s.flow = _chunkF2Y4E4GUcjs.normalizeFlow.call(void 0, update, s.flow);
|
|
2188
2187
|
if (_optionalChain([this, 'access', _103 => _103.world, 'optionalAccess', _104 => _104.hasLane, 'call', _105 => _105(layerId)])) {
|
|
2189
2188
|
const { width, height } = this.host.canvas();
|
|
2190
|
-
this.world.setFlow(layerId,
|
|
2189
|
+
this.world.setFlow(layerId, _chunkF2Y4E4GUcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
|
|
2191
2190
|
}
|
|
2192
2191
|
return { ...s.flow };
|
|
2193
2192
|
}
|
|
2194
2193
|
setTilt(update) {
|
|
2195
|
-
this.tilt =
|
|
2194
|
+
this.tilt = _chunkF2Y4E4GUcjs.normalizeTilt.call(void 0, update, this.tilt);
|
|
2196
2195
|
_optionalChain([this, 'access', _106 => _106.world, 'optionalAccess', _107 => _107.setTilt, 'call', _108 => _108(this.tilt)]);
|
|
2197
2196
|
return { ...this.tilt };
|
|
2198
2197
|
}
|
|
@@ -2407,10 +2406,10 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2407
2406
|
const w = this.world;
|
|
2408
2407
|
if (!w) return [];
|
|
2409
2408
|
const out = [];
|
|
2410
|
-
const tx0 = Math.max(0, Math.floor(rect.x /
|
|
2411
|
-
const ty0 = Math.max(0, Math.floor(rect.y /
|
|
2412
|
-
const tx1 = Math.floor((rect.x + rect.width - 1) /
|
|
2413
|
-
const ty1 = Math.floor((rect.y + rect.height - 1) /
|
|
2409
|
+
const tx0 = Math.max(0, Math.floor(rect.x / _chunkO7LUD7MHcjs.TILE));
|
|
2410
|
+
const ty0 = Math.max(0, Math.floor(rect.y / _chunkO7LUD7MHcjs.TILE));
|
|
2411
|
+
const tx1 = Math.floor((rect.x + rect.width - 1) / _chunkO7LUD7MHcjs.TILE);
|
|
2412
|
+
const ty1 = Math.floor((rect.y + rect.height - 1) / _chunkO7LUD7MHcjs.TILE);
|
|
2414
2413
|
for (let ty = ty0; ty <= ty1; ty++)
|
|
2415
2414
|
for (let tx = tx0; tx <= tx1; tx++) {
|
|
2416
2415
|
let merged = null;
|
|
@@ -2432,8 +2431,8 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2432
2431
|
}
|
|
2433
2432
|
}, _class6);
|
|
2434
2433
|
function wetPigmentOf(hex, body) {
|
|
2435
|
-
const [r, g, b] =
|
|
2436
|
-
return Array.from(
|
|
2434
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, hex);
|
|
2435
|
+
return Array.from(_chunkF2Y4E4GUcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], body));
|
|
2437
2436
|
}
|
|
2438
2437
|
|
|
2439
2438
|
// src/paint-editor/thumbnails.ts
|
|
@@ -2441,28 +2440,28 @@ var thumbWorld = null;
|
|
|
2441
2440
|
function paintWetTestStroke(brush, paper, color, width, height) {
|
|
2442
2441
|
if (!thumbWorld || thumbWorld.width !== width || thumbWorld.height !== height) {
|
|
2443
2442
|
_optionalChain([thumbWorld, 'optionalAccess', _137 => _137.destroy, 'call', _138 => _138()]);
|
|
2444
|
-
thumbWorld = new (0,
|
|
2443
|
+
thumbWorld = new (0, _chunkF2Y4E4GUcjs.WetWorld)(width, height, wetPaperInput(paper), { kernel: "typescript", threads: 0 });
|
|
2445
2444
|
} else thumbWorld.setPaper(wetPaperInput(paper));
|
|
2446
2445
|
const w = thumbWorld;
|
|
2447
2446
|
if (w.hasLane("thumb")) w.removeLane("thumb");
|
|
2448
2447
|
w.ensureLane("thumb");
|
|
2449
|
-
const [r, g, b] =
|
|
2448
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, color);
|
|
2450
2449
|
if (brush.wet.tool !== "paint" && brush.wet.tool !== "water") {
|
|
2451
2450
|
const half = Math.ceil(height / 2);
|
|
2452
|
-
w.paint("thumb", { x: 0, y: 0, width, height: half }, null, 0.4, Array.from(
|
|
2453
|
-
w.paint("thumb", { x: 0, y: half, width, height: height - half }, null, 0.4, Array.from(
|
|
2451
|
+
w.paint("thumb", { x: 0, y: 0, width, height: half }, null, 0.4, Array.from(_chunkF2Y4E4GUcjs.pigmentOf.call(void 0, [r / 255, g / 255, b / 255], 0), (v) => v * 0.05));
|
|
2452
|
+
w.paint("thumb", { x: 0, y: half, width, height: height - half }, null, 0.4, Array.from(_chunkF2Y4E4GUcjs.pigmentOf.call(void 0, [232 / 255, 196 / 255, 64 / 255], 0), (v) => v * 0.05));
|
|
2454
2453
|
}
|
|
2455
2454
|
const driver = new WetStrokeDriver({
|
|
2456
2455
|
world: w,
|
|
2457
2456
|
laneId: "thumb",
|
|
2458
2457
|
brush,
|
|
2459
2458
|
color: [r / 255, g / 255, b / 255],
|
|
2460
|
-
load: brushLoadForStroke(brush,
|
|
2459
|
+
load: brushLoadForStroke(brush, _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255]),
|
|
2461
2460
|
grain: paperGrain(paper),
|
|
2462
2461
|
paperDepth: paper.depth,
|
|
2463
|
-
paperColor:
|
|
2462
|
+
paperColor: _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, paper.color),
|
|
2464
2463
|
seed: 7,
|
|
2465
|
-
copies: [
|
|
2464
|
+
copies: [_chunk2XS6LTUPcjs.IDENTITY_COPY]
|
|
2466
2465
|
});
|
|
2467
2466
|
driver.push(thumbnailStroke(width, height));
|
|
2468
2467
|
driver.finish();
|
|
@@ -2482,7 +2481,7 @@ function thumbnailStroke(width, height) {
|
|
|
2482
2481
|
return pts;
|
|
2483
2482
|
}
|
|
2484
2483
|
function paintTestStroke(surface, brush, paper, color, width, height) {
|
|
2485
|
-
const [r, g, b] =
|
|
2484
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, color);
|
|
2486
2485
|
let result = surface;
|
|
2487
2486
|
let thick = null;
|
|
2488
2487
|
const session = new PaintStrokeSession(
|
|
@@ -2501,14 +2500,14 @@ function paintTestStroke(surface, brush, paper, color, width, height) {
|
|
|
2501
2500
|
lockTransparency: false,
|
|
2502
2501
|
brush,
|
|
2503
2502
|
color: [r, g, b, 255],
|
|
2504
|
-
background: [...
|
|
2503
|
+
background: [..._chunk2XS6LTUPcjs.hexToRgb8.call(void 0, paper.color), 255],
|
|
2505
2504
|
grain: paperGrain(paper),
|
|
2506
2505
|
paperDepth: paper.depth,
|
|
2507
2506
|
seed: 7,
|
|
2508
2507
|
colorHex: color,
|
|
2509
2508
|
affineCopies: [],
|
|
2510
|
-
copies: [
|
|
2511
|
-
mixerLoad: brushLoadForStroke(brush,
|
|
2509
|
+
copies: [_chunk2XS6LTUPcjs.IDENTITY_COPY],
|
|
2510
|
+
mixerLoad: brushLoadForStroke(brush, _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255]),
|
|
2512
2511
|
thick: brush.engine === "impasto" ? { channels: emptyThickChannels() } : void 0,
|
|
2513
2512
|
sticker: brush.engine === "sticker" ? { nextId: 1 } : void 0
|
|
2514
2513
|
}
|
|
@@ -2521,16 +2520,16 @@ function renderBrushThumbnail(brush, options) {
|
|
|
2521
2520
|
const width = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.width, () => ( 160)))));
|
|
2522
2521
|
const height = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.height, () => ( 48)))));
|
|
2523
2522
|
const maxSize = height * 0.42;
|
|
2524
|
-
const b = brush.tip.size > maxSize ?
|
|
2525
|
-
const rgba = [...
|
|
2526
|
-
let surface =
|
|
2523
|
+
const b = brush.tip.size > maxSize ? _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: maxSize } }, brush) : brush;
|
|
2524
|
+
const rgba = [..._chunk2XS6LTUPcjs.hexToRgb8.call(void 0, options.color), 255];
|
|
2525
|
+
let surface = _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4);
|
|
2527
2526
|
if (b.engine === "eraser") {
|
|
2528
|
-
surface =
|
|
2527
|
+
surface = _chunkO7LUD7MHcjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height }, rgba);
|
|
2529
2528
|
} else if (b.engine === "wet") {
|
|
2530
2529
|
} else if (b.engine === "blender" || b.engine === "smudge" || b.engine === "mixer" && !b.loadsColor || b.behavior.pickup > 0) {
|
|
2531
2530
|
const half = Math.ceil(height / 2);
|
|
2532
|
-
surface =
|
|
2533
|
-
surface =
|
|
2531
|
+
surface = _chunkO7LUD7MHcjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height: half }, rgba);
|
|
2532
|
+
surface = _chunkO7LUD7MHcjs.fillRect.call(void 0, surface, { x: 0, y: half, width, height: height - half }, [232, 196, 64, 255]);
|
|
2534
2533
|
}
|
|
2535
2534
|
surface = b.engine === "wet" ? paintWetTestStroke(b, options.paper, options.color, width, height) : paintTestStroke(surface, b, options.paper, options.color, width, height);
|
|
2536
2535
|
const layer = { type: "pixel", id: "thumbnail", name: "thumbnail", visible: true, opacity: 1, blend: "normal", surface, offset: { x: 0, y: 0 } };
|
|
@@ -2826,8 +2825,8 @@ function colorHarmony(base, kind, options = {}) {
|
|
|
2826
2825
|
function readSwatch(raw) {
|
|
2827
2826
|
if (!raw || typeof raw !== "object") return null;
|
|
2828
2827
|
const r = raw;
|
|
2829
|
-
const g =
|
|
2830
|
-
const color = typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : _optionalChain([g, 'optionalAccess', _139 => _139.type]) === "gradient" ?
|
|
2828
|
+
const g = _chunkQBWEH3IMcjs.readPaintSource.call(void 0, r.paint);
|
|
2829
|
+
const color = typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : _optionalChain([g, 'optionalAccess', _139 => _139.type]) === "gradient" ? _chunkQBWEH3IMcjs.paintSourceColor.call(void 0, g) : null;
|
|
2831
2830
|
if (!color) return null;
|
|
2832
2831
|
const out = { color };
|
|
2833
2832
|
if (typeof r.name === "string" && r.name.trim()) out.name = r.name.trim().slice(0, 80);
|
|
@@ -2850,7 +2849,7 @@ var DEFAULT_SWATCHES = [
|
|
|
2850
2849
|
// src/paint-editor/mixing-pad.ts
|
|
2851
2850
|
var MIXING_PAD_WIDTH = 360;
|
|
2852
2851
|
var MIXING_PAD_HEIGHT = 220;
|
|
2853
|
-
var PAD_PAINT =
|
|
2852
|
+
var PAD_PAINT = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, {
|
|
2854
2853
|
id: "pad-paint",
|
|
2855
2854
|
name: "Pad paint",
|
|
2856
2855
|
category: "mixer",
|
|
@@ -2858,7 +2857,7 @@ var PAD_PAINT = _chunkW4LNKTHTcjs.normalizePaintBrush.call(void 0, {
|
|
|
2858
2857
|
tip: { size: 28, hardness: 0.75, spacing: 0.1, opacity: 1, flow: 0.7, pressureSize: false, pressureOpacity: false },
|
|
2859
2858
|
mixer: { wet: 0.45, load: 1, mix: 0.4, loadEachStroke: true, cleanEachStroke: true, mixing: "pigment" }
|
|
2860
2859
|
});
|
|
2861
|
-
var PAD_KNIFE =
|
|
2860
|
+
var PAD_KNIFE = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, {
|
|
2862
2861
|
id: "pad-knife",
|
|
2863
2862
|
name: "Palette knife",
|
|
2864
2863
|
category: "smudge",
|
|
@@ -2868,7 +2867,7 @@ var PAD_KNIFE = _chunkW4LNKTHTcjs.normalizePaintBrush.call(void 0, {
|
|
|
2868
2867
|
// A knife drags streaks of paint and folds them into each other, mixing them as pigment.
|
|
2869
2868
|
smudge: { strength: 0.6, length: 0.8, mixing: "pigment" }
|
|
2870
2869
|
});
|
|
2871
|
-
var PAD_BLOB =
|
|
2870
|
+
var PAD_BLOB = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, {
|
|
2872
2871
|
id: "pad-blob",
|
|
2873
2872
|
name: "Pad blob",
|
|
2874
2873
|
category: "custom",
|
|
@@ -2878,7 +2877,7 @@ var PAD_BLOB = _chunkW4LNKTHTcjs.normalizePaintBrush.call(void 0, {
|
|
|
2878
2877
|
var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.call(this);_class8.prototype.__init66.call(this);_class8.prototype.__init67.call(this);_class8.prototype.__init68.call(this); }
|
|
2879
2878
|
__init65() {this.width = MIXING_PAD_WIDTH}
|
|
2880
2879
|
__init66() {this.height = MIXING_PAD_HEIGHT}
|
|
2881
|
-
__init67() {this.surface =
|
|
2880
|
+
__init67() {this.surface = _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4)}
|
|
2882
2881
|
/** Increments on every change (for redrawing). */
|
|
2883
2882
|
__init68() {this.version = 0}
|
|
2884
2883
|
/** Paints (`paint`, with `color`) or smears (`knife`) through `points` in pad pixels. */
|
|
@@ -2890,12 +2889,12 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2890
2889
|
}
|
|
2891
2890
|
}
|
|
2892
2891
|
let brush = options.tool === "knife" ? PAD_KNIFE : PAD_PAINT;
|
|
2893
|
-
if (options.size !== void 0) brush =
|
|
2892
|
+
if (options.size !== void 0) brush = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...brush.tip, size: options.size } }, brush);
|
|
2894
2893
|
return this.run(brush, points, options.color);
|
|
2895
2894
|
}
|
|
2896
2895
|
/** Paints `points` with `brush` in `color` on the pad. */
|
|
2897
2896
|
run(brush, points, color) {
|
|
2898
|
-
const [r, g, b] =
|
|
2897
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, color);
|
|
2899
2898
|
let result = null;
|
|
2900
2899
|
const session = new PaintStrokeSession(
|
|
2901
2900
|
{ update: () => {
|
|
@@ -2913,8 +2912,8 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2913
2912
|
seed: 1,
|
|
2914
2913
|
colorHex: color,
|
|
2915
2914
|
affineCopies: [],
|
|
2916
|
-
copies: [
|
|
2917
|
-
mixerLoad: brushLoadForStroke(brush,
|
|
2915
|
+
copies: [_chunk2XS6LTUPcjs.IDENTITY_COPY],
|
|
2916
|
+
mixerLoad: brushLoadForStroke(brush, _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255])
|
|
2918
2917
|
}
|
|
2919
2918
|
);
|
|
2920
2919
|
session.push(points);
|
|
@@ -2933,7 +2932,7 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2933
2932
|
const y0 = Math.max(0, Math.floor(y) - r);
|
|
2934
2933
|
const x1 = Math.min(this.width, Math.floor(x) + r + 1);
|
|
2935
2934
|
const y1 = Math.min(this.height, Math.floor(y) + r + 1);
|
|
2936
|
-
const px =
|
|
2935
|
+
const px = _chunkO7LUD7MHcjs.readRegion.call(void 0, this.surface, { x: x0, y: y0, width: x1 - x0, height: y1 - y0 });
|
|
2937
2936
|
let R = 0;
|
|
2938
2937
|
let G = 0;
|
|
2939
2938
|
let B = 0;
|
|
@@ -2950,7 +2949,7 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2950
2949
|
return `#${hex(R)}${hex(G)}${hex(B)}`;
|
|
2951
2950
|
}
|
|
2952
2951
|
clear() {
|
|
2953
|
-
this.surface =
|
|
2952
|
+
this.surface = _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4);
|
|
2954
2953
|
this.version++;
|
|
2955
2954
|
}
|
|
2956
2955
|
/**
|
|
@@ -2980,7 +2979,7 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2980
2979
|
throw new Error(`A pile of radius ${R} at (${cx}, ${cy}) does not fit on the ${this.width}\xD7${this.height} pad; move it at least ${R} px from every edge or use a smaller radius.`);
|
|
2981
2980
|
}
|
|
2982
2981
|
const bounds = { x: Math.floor(cx - R), y: Math.floor(cy - R), width: Math.ceil(2 * R), height: Math.ceil(2 * R) };
|
|
2983
|
-
if (options.clear !== false) this.surface =
|
|
2982
|
+
if (options.clear !== false) this.surface = _chunkO7LUD7MHcjs.writeRegion.call(void 0, this.surface, bounds, new Uint8ClampedArray(bounds.width * bounds.height * 4));
|
|
2984
2983
|
const used = paints.filter((p) => p.parts > 0);
|
|
2985
2984
|
const area = Math.PI * (0.7 * R) ** 2;
|
|
2986
2985
|
used.forEach((p, i) => {
|
|
@@ -2989,10 +2988,10 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2989
2988
|
const off = used.length === 1 ? 0 : 0.45 * R;
|
|
2990
2989
|
const x = Math.min(cx + R - r, Math.max(cx - R + r, cx + Math.cos(a) * off));
|
|
2991
2990
|
const y = Math.min(cy + R - r, Math.max(cy - R + r, cy + Math.sin(a) * off));
|
|
2992
|
-
const blob =
|
|
2991
|
+
const blob = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: Math.max(2, 2 * r) } }, PAD_BLOB);
|
|
2993
2992
|
this.run(blob, [{ x, y }], p.color.toLowerCase());
|
|
2994
2993
|
});
|
|
2995
|
-
const knife =
|
|
2994
|
+
const knife = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_KNIFE.tip, size: Math.max(12, R * 0.5) } }, PAD_KNIFE);
|
|
2996
2995
|
for (let k = 0; k < passes; k++) {
|
|
2997
2996
|
const stir = [];
|
|
2998
2997
|
const turns = 1.6;
|
|
@@ -3003,26 +3002,26 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
3003
3002
|
}
|
|
3004
3003
|
this.run(knife, stir, "#000000");
|
|
3005
3004
|
}
|
|
3006
|
-
const mixed =
|
|
3007
|
-
paints.map((p) =>
|
|
3005
|
+
const mixed = _chunkO7LUD7MHcjs.mixPigments.call(void 0,
|
|
3006
|
+
paints.map((p) => _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, p.color).map((v) => v / 255)),
|
|
3008
3007
|
paints.map((p) => p.parts)
|
|
3009
3008
|
);
|
|
3010
|
-
const core =
|
|
3009
|
+
const core = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: R * 1.1, hardness: 0.55 } }, PAD_BLOB);
|
|
3011
3010
|
const hex = "#" + mixed.map((v) => Math.round(v * 255).toString(16).padStart(2, "0")).join("");
|
|
3012
3011
|
this.run(core, [{ x: cx, y: cy }], hex);
|
|
3013
3012
|
return { color: this.pick(cx, cy, 2), bounds };
|
|
3014
3013
|
}
|
|
3015
3014
|
/** The pad's pixels as a PNG data URL (with alpha), for saving. */
|
|
3016
3015
|
toPng() {
|
|
3017
|
-
return
|
|
3016
|
+
return _chunkO7LUD7MHcjs.pngDataUrl.call(void 0, this.width, this.height, _chunkO7LUD7MHcjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height }));
|
|
3018
3017
|
}
|
|
3019
3018
|
/** Replaces the pad with a PNG (data URL or base64) of the pad's size, as `toPng` writes. */
|
|
3020
3019
|
fromPng(png) {
|
|
3021
|
-
const bytes = png.startsWith("data:") ? _optionalChain([
|
|
3022
|
-
if (!bytes || !
|
|
3023
|
-
const img =
|
|
3020
|
+
const bytes = png.startsWith("data:") ? _optionalChain([_chunkO7LUD7MHcjs.parseDataUrl.call(void 0, png), 'optionalAccess', _141 => _141.bytes]) : _chunkO7LUD7MHcjs.base64ToBytes.call(void 0, png);
|
|
3021
|
+
if (!bytes || !_chunkO7LUD7MHcjs.isPng.call(void 0, bytes)) throw new Error("The pad image is not a PNG data URL or base64 PNG.");
|
|
3022
|
+
const img = _chunkO7LUD7MHcjs.decodePng.call(void 0, bytes);
|
|
3024
3023
|
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}.`);
|
|
3025
|
-
this.surface =
|
|
3024
|
+
this.surface = _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, { width: img.width, height: img.height, data: img.data }, 4);
|
|
3026
3025
|
this.version++;
|
|
3027
3026
|
}
|
|
3028
3027
|
/** Whether nothing is on the pad. */
|
|
@@ -3031,7 +3030,7 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
3031
3030
|
}
|
|
3032
3031
|
/** The pad over white, `width × height` RGBA. */
|
|
3033
3032
|
pixels() {
|
|
3034
|
-
const px =
|
|
3033
|
+
const px = _chunkO7LUD7MHcjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height });
|
|
3035
3034
|
for (let i = 0; i < px.length; i += 4) {
|
|
3036
3035
|
const a = px[i + 3] / 255;
|
|
3037
3036
|
px[i] = Math.round(px[i] * a + 255 * (1 - a));
|
|
@@ -3055,7 +3054,7 @@ function replayItems(doc) {
|
|
|
3055
3054
|
}
|
|
3056
3055
|
function emptiedLayers(layers) {
|
|
3057
3056
|
let out = [...layers];
|
|
3058
|
-
for (const l of
|
|
3057
|
+
for (const l of _chunkAEAAN4ADcjs.flattenLayers.call(void 0, layers)) if (l.type === "pixel") out = _chunkAEAAN4ADcjs.mapLayer.call(void 0, out, l.id, () => ({ ...l, surface: _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4), offset: { x: 0, y: 0 } }));
|
|
3059
3058
|
return out;
|
|
3060
3059
|
}
|
|
3061
3060
|
async function replayPainting(source, target, options = {}) {
|
|
@@ -3187,7 +3186,7 @@ async function buildTimeLapse(source, target, options = {}) {
|
|
|
3187
3186
|
const f = replayFrame(target, maxSide, stroke);
|
|
3188
3187
|
width = f.width;
|
|
3189
3188
|
height = f.height;
|
|
3190
|
-
frames.push(
|
|
3189
|
+
frames.push(_chunkO7LUD7MHcjs.encodePng.call(void 0, f.width, f.height, f.data));
|
|
3191
3190
|
};
|
|
3192
3191
|
shoot(0);
|
|
3193
3192
|
await replayPainting(source, target, {
|
|
@@ -3331,15 +3330,15 @@ function readPaintEffectSource(raw) {
|
|
|
3331
3330
|
};
|
|
3332
3331
|
}
|
|
3333
3332
|
function paperEffectToJSON(p) {
|
|
3334
|
-
return { ...sourceOut(p), opacity: p.opacity, blend: p.blend, png:
|
|
3333
|
+
return { ...sourceOut(p), opacity: p.opacity, blend: p.blend, png: _chunkO7LUD7MHcjs.pngDataUrl.call(void 0, p.image.width, p.image.height, p.image.data) };
|
|
3335
3334
|
}
|
|
3336
3335
|
function paperEffectFromJSON(raw, width, height) {
|
|
3337
3336
|
const source = readPaintEffectSource(raw);
|
|
3338
3337
|
if (!source) throw new Error("it is not an effect (effect id and values)");
|
|
3339
3338
|
const r = raw;
|
|
3340
|
-
const parsed = typeof r.png === "string" ?
|
|
3339
|
+
const parsed = typeof r.png === "string" ? _chunkO7LUD7MHcjs.parseDataUrl.call(void 0, r.png) : null;
|
|
3341
3340
|
if (!parsed) throw new Error("its pixels are missing");
|
|
3342
|
-
const image =
|
|
3341
|
+
const image = _chunkO7LUD7MHcjs.decodePng.call(void 0, parsed.bytes);
|
|
3343
3342
|
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}`);
|
|
3344
3343
|
const opacity = typeof r.opacity === "number" && r.opacity >= 0 && r.opacity <= 1 ? r.opacity : 1;
|
|
3345
3344
|
const blend = PAPER_EFFECT_BLENDS.includes(r.blend) ? r.blend : "multiply";
|
|
@@ -3364,7 +3363,7 @@ function parseColor(value, what = "color") {
|
|
|
3364
3363
|
return value.trim().toLowerCase();
|
|
3365
3364
|
}
|
|
3366
3365
|
function rgbaOf(hex) {
|
|
3367
|
-
const [r, g, b] =
|
|
3366
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, hex);
|
|
3368
3367
|
return [r, g, b, 255];
|
|
3369
3368
|
}
|
|
3370
3369
|
function rgbToHex(r, g, b) {
|
|
@@ -3392,7 +3391,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3392
3391
|
__init76() {this.secondaryColor = "#ffffff"}
|
|
3393
3392
|
/** Gradient paint chosen with `setPaint` (`null`: the paint colour). */
|
|
3394
3393
|
__init77() {this.gradient = null}
|
|
3395
|
-
__init78() {this.mixerLoad =
|
|
3394
|
+
__init78() {this.mixerLoad = _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD}
|
|
3396
3395
|
__init79() {this.view = { ...DEFAULT_VIEW, pan: { ...DEFAULT_VIEW.pan } }}
|
|
3397
3396
|
|
|
3398
3397
|
|
|
@@ -3433,9 +3432,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3433
3432
|
constructor(options = {}) {;_class10.prototype.__init72.call(this);_class10.prototype.__init73.call(this);_class10.prototype.__init74.call(this);_class10.prototype.__init75.call(this);_class10.prototype.__init76.call(this);_class10.prototype.__init77.call(this);_class10.prototype.__init78.call(this);_class10.prototype.__init79.call(this);_class10.prototype.__init80.call(this);_class10.prototype.__init81.call(this);_class10.prototype.__init82.call(this);_class10.prototype.__init83.call(this);_class10.prototype.__init84.call(this);_class10.prototype.__init85.call(this);_class10.prototype.__init86.call(this);_class10.prototype.__init87.call(this);_class10.prototype.__init88.call(this);_class10.prototype.__init89.call(this);_class10.prototype.__init90.call(this);_class10.prototype.__init91.call(this);_class10.prototype.__init92.call(this);_class10.prototype.__init93.call(this);_class10.prototype.__init94.call(this);_class10.prototype.__init95.call(this);_class10.prototype.__init96.call(this);_class10.prototype.__init97.call(this);_class10.prototype.__init98.call(this);_class10.prototype.__init99.call(this);_class10.prototype.__init100.call(this);_class10.prototype.__init101.call(this);_class10.prototype.__init102.call(this);_class10.prototype.__init103.call(this);_class10.prototype.__init104.call(this);_class10.prototype.__init105.call(this);_class10.prototype.__init106.call(this);_class10.prototype.__init107.call(this);_class10.prototype.__init108.call(this);
|
|
3434
3433
|
this.historyLimit = Math.max(1, _nullishCoalesce(options.historyLimit, () => ( 200)));
|
|
3435
3434
|
this.doc = createPaintDocument({ width: options.width, height: options.height, dpi: options.dpi, paper: this.resolvePaper(options.paper) });
|
|
3436
|
-
this.userBrushes = (_nullishCoalesce(options.brushes, () => ( []))).map((b) =>
|
|
3437
|
-
const start = _nullishCoalesce(this.findBrush(_nullishCoalesce(options.brushId, () => (
|
|
3438
|
-
this.brush =
|
|
3435
|
+
this.userBrushes = (_nullishCoalesce(options.brushes, () => ( []))).map((b) => _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { ...b, builtin: false }));
|
|
3436
|
+
const start = _nullishCoalesce(this.findBrush(_nullishCoalesce(options.brushId, () => ( _chunk2XS6LTUPcjs.DEFAULT_BRUSH_ID))), () => ( this.findBrush(_chunk2XS6LTUPcjs.DEFAULT_BRUSH_ID)));
|
|
3437
|
+
this.brush = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, start);
|
|
3439
3438
|
this.color = options.color ? parseColor(options.color) : "#1f2937";
|
|
3440
3439
|
this.hand = options.hand === "left" ? "left" : "right";
|
|
3441
3440
|
this.encodeImage = options.encodeImage;
|
|
@@ -3446,12 +3445,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3446
3445
|
canvas: () => this.doc.canvas,
|
|
3447
3446
|
paper: () => this.doc.paper,
|
|
3448
3447
|
layerSurface: (id) => {
|
|
3449
|
-
const l = _optionalChain([
|
|
3448
|
+
const l = _optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _159 => _159.layer]);
|
|
3450
3449
|
return isPixelLayer(l) ? l.surface : null;
|
|
3451
3450
|
},
|
|
3452
3451
|
updateSurfaces: (surfaces, rects) => {
|
|
3453
3452
|
let layers = this.doc.layers;
|
|
3454
|
-
for (const [id, surface] of surfaces) if (
|
|
3453
|
+
for (const [id, surface] of surfaces) if (_chunkAEAAN4ADcjs.findLayer.call(void 0, layers, id)) layers = _chunkAEAAN4ADcjs.mapLayer.call(void 0, layers, id, (l) => ({ ...l, surface }));
|
|
3455
3454
|
this.doc = { ...this.doc, layers };
|
|
3456
3455
|
this.emit(rects.length ? rects : "all");
|
|
3457
3456
|
},
|
|
@@ -3482,7 +3481,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3482
3481
|
this.cached = {
|
|
3483
3482
|
document: this.doc,
|
|
3484
3483
|
brush: this.brush,
|
|
3485
|
-
brushes: this.library ??= [...
|
|
3484
|
+
brushes: this.library ??= [..._chunk2XS6LTUPcjs.BUILTIN_BRUSHES, ...this.userBrushes],
|
|
3486
3485
|
color: this.color,
|
|
3487
3486
|
secondaryColor: this.secondaryColor,
|
|
3488
3487
|
paint: _nullishCoalesce(this.gradient, () => ( { type: "color", color: this.color })),
|
|
@@ -3649,7 +3648,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3649
3648
|
// --- Canvas and paper ----------------------------------------------------------
|
|
3650
3649
|
resolvePaper(paper) {
|
|
3651
3650
|
if (typeof paper === "string") {
|
|
3652
|
-
const p =
|
|
3651
|
+
const p = _chunk2XS6LTUPcjs.paperPreset.call(void 0, paper);
|
|
3653
3652
|
if (!p) throw new PaintEditorError(`Unknown paper "${paper}". Call list_papers for the ids.`);
|
|
3654
3653
|
return p;
|
|
3655
3654
|
}
|
|
@@ -3694,23 +3693,23 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3694
3693
|
this.requireIdle("changing the paper");
|
|
3695
3694
|
let base = this.doc.paper;
|
|
3696
3695
|
if (update.preset !== void 0 && update.preset !== this.doc.paper.preset) {
|
|
3697
|
-
const p =
|
|
3696
|
+
const p = _chunk2XS6LTUPcjs.paperPreset.call(void 0, update.preset);
|
|
3698
3697
|
if (!p) throw new PaintEditorError(`Unknown paper "${update.preset}". Call list_papers for the ids.`);
|
|
3699
3698
|
base = p;
|
|
3700
3699
|
}
|
|
3701
3700
|
const { preset: _p, ...rest } = update;
|
|
3702
3701
|
if (rest.color !== void 0) parseColor(rest.color, "paper color");
|
|
3703
|
-
const paper =
|
|
3702
|
+
const paper = _chunk2XS6LTUPcjs.normalizePaper.call(void 0, { ...rest, preset: base.preset }, base);
|
|
3704
3703
|
const changedKeys = Object.keys(rest).filter((k) => k !== "name");
|
|
3705
3704
|
if (changedKeys.length && update.preset === void 0) paper.preset = base.preset;
|
|
3706
3705
|
if (this.wet.world) this.beginWetOp();
|
|
3707
3706
|
this.commit("Paper", { ...this.doc, paper });
|
|
3708
3707
|
this.wet.paperChanged();
|
|
3709
|
-
return
|
|
3708
|
+
return _chunk2XS6LTUPcjs.clonePaper.call(void 0, paper);
|
|
3710
3709
|
}
|
|
3711
3710
|
// --- Layers --------------------------------------------------------------------
|
|
3712
3711
|
getLayer(id) {
|
|
3713
|
-
return _optionalChain([
|
|
3712
|
+
return _optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _174 => _174.layer]);
|
|
3714
3713
|
}
|
|
3715
3714
|
/** The active pixel layer (or `undefined`). */
|
|
3716
3715
|
getActiveLayer() {
|
|
@@ -3729,12 +3728,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3729
3728
|
walk(this.doc.layers, null, 0);
|
|
3730
3729
|
return out;
|
|
3731
3730
|
}
|
|
3732
|
-
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([
|
|
3731
|
+
describeLayer(l, parentId = _nullishCoalesce(_optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _175 => _175.parent, 'optionalAccess', _176 => _176.id]), () => ( null)), depth = _nullishCoalesce(_optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, l.id), 'optionalAccess', _177 => _177.path, 'access', _178 => _178.length]), () => ( 0))) {
|
|
3733
3732
|
let bounds = null;
|
|
3734
3733
|
if (l.type === "pixel") {
|
|
3735
|
-
const b =
|
|
3734
|
+
const b = _chunkO7LUD7MHcjs.contentBounds.call(void 0, l.surface);
|
|
3736
3735
|
bounds = b ? { ...b, x: b.x + l.offset.x, y: b.y + l.offset.y } : null;
|
|
3737
|
-
} else for (const c of
|
|
3736
|
+
} else for (const c of _chunkAEAAN4ADcjs.flattenLayers.call(void 0, l.children)) if (c.type === "pixel") bounds = unionRect(bounds, this.describeLayer(c, l.id, depth + 1).bounds);
|
|
3738
3737
|
return {
|
|
3739
3738
|
id: l.id,
|
|
3740
3739
|
name: l.name,
|
|
@@ -3761,7 +3760,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3761
3760
|
if (!id) throw new PaintEditorError(`There is no active layer to ${what}; add one with add_layer.`);
|
|
3762
3761
|
const l = this.requireLayer(id);
|
|
3763
3762
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; ${what} a pixel layer inside it.`);
|
|
3764
|
-
if (
|
|
3763
|
+
if (_chunkAEAAN4ADcjs.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.`);
|
|
3765
3764
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) before you ${what} it.`);
|
|
3766
3765
|
return l;
|
|
3767
3766
|
}
|
|
@@ -3774,7 +3773,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3774
3773
|
/** Adds an empty pixel layer or group above `aboveId` (default: the active layer) and makes it active. */
|
|
3775
3774
|
addLayer(options = {}) {
|
|
3776
3775
|
this.requireIdle("adding a layer");
|
|
3777
|
-
const count =
|
|
3776
|
+
const count = _chunkAEAAN4ADcjs.flattenLayers.call(void 0, this.doc.layers).length;
|
|
3778
3777
|
const type = _nullishCoalesce(options.type, () => ( "pixel"));
|
|
3779
3778
|
const name = _optionalChain([options, 'access', _179 => _179.name, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181()]) || (type === "group" ? `Group ${count + 1}` : `Layer ${count + 1}`);
|
|
3780
3779
|
const layer = type === "group" ? { type: "group", id: newPaintLayerId(), name, visible: true, opacity: 1, blend: "pass-through", children: [] } : createPaintLayer(name);
|
|
@@ -3786,21 +3785,21 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3786
3785
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
3787
3786
|
parentId = g.id;
|
|
3788
3787
|
} else if (above) {
|
|
3789
|
-
const loc =
|
|
3788
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, above);
|
|
3790
3789
|
if (!loc) throw new PaintEditorError(`Unknown layer "${above}". Call list_layers for the ids.`);
|
|
3791
3790
|
parentId = _nullishCoalesce(_optionalChain([loc, 'access', _182 => _182.parent, 'optionalAccess', _183 => _183.id]), () => ( null));
|
|
3792
3791
|
index = loc.index + 1;
|
|
3793
3792
|
}
|
|
3794
|
-
const layers =
|
|
3793
|
+
const layers = _chunkAEAAN4ADcjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
|
|
3795
3794
|
this.commit(type === "group" ? "Add group" : "Add layer", { ...this.doc, layers, activeLayerId: layer.id });
|
|
3796
3795
|
return this.describeLayer(layer);
|
|
3797
3796
|
}
|
|
3798
3797
|
updateLayer(id, update) {
|
|
3799
3798
|
this.requireIdle("changing a layer");
|
|
3800
3799
|
const l = this.requireLayer(id);
|
|
3801
|
-
if (
|
|
3800
|
+
if (_chunkAEAAN4ADcjs.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}).`);
|
|
3802
3801
|
if (update.opacity !== void 0 && !(update.opacity >= 0 && update.opacity <= 1)) throw new PaintEditorError(`opacity ${update.opacity} is out of range; use 0..1.`);
|
|
3803
|
-
if (update.blend !== void 0 && !
|
|
3802
|
+
if (update.blend !== void 0 && !_chunkO7LUD7MHcjs.isBlendMode.call(void 0, update.blend) && !(l.type === "group" && update.blend === "pass-through")) {
|
|
3804
3803
|
throw new PaintEditorError(`Unknown blend mode "${update.blend}". Call get_canvas_info for the blend modes.`);
|
|
3805
3804
|
}
|
|
3806
3805
|
if (update.name !== void 0 && !update.name.trim()) throw new PaintEditorError("name is empty; give the layer a name.");
|
|
@@ -3814,31 +3813,31 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3814
3813
|
const locks = { ..._nullishCoalesce(l.locks, () => ( {})), ...update.locks };
|
|
3815
3814
|
next.locks = Object.values(locks).some(Boolean) ? locks : void 0;
|
|
3816
3815
|
}
|
|
3817
|
-
this.commit("Layer properties", { ...this.doc, layers:
|
|
3816
|
+
this.commit("Layer properties", { ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, id, () => next) });
|
|
3818
3817
|
return this.describeLayer(next);
|
|
3819
3818
|
}
|
|
3820
3819
|
removeLayer(id) {
|
|
3821
3820
|
this.requireIdle("removing a layer");
|
|
3822
3821
|
const l = this.requireLayer(id);
|
|
3823
|
-
if (
|
|
3824
|
-
const wetIds = this.wet.wetLayerIds().filter((x) => x === id || l.type === "group" &&
|
|
3822
|
+
if (_chunkAEAAN4ADcjs.isLayerLocked.call(void 0, l, "all")) throw new PaintEditorError(`Layer "${l.name}" is fully locked; unlock it before removing it.`);
|
|
3823
|
+
const wetIds = this.wet.wetLayerIds().filter((x) => x === id || l.type === "group" && _chunkAEAAN4ADcjs.findLayer.call(void 0, l.children, x));
|
|
3825
3824
|
if (wetIds.length) {
|
|
3826
3825
|
this.beginWetOp();
|
|
3827
3826
|
for (const x of wetIds) this.wet.world.removeLane(x);
|
|
3828
3827
|
}
|
|
3829
|
-
const layers =
|
|
3828
|
+
const layers = _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
3830
3829
|
let active = this.doc.activeLayerId;
|
|
3831
|
-
if (active && !
|
|
3832
|
-
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(
|
|
3830
|
+
if (active && !_chunkAEAAN4ADcjs.findLayer.call(void 0, layers, active)) active = _nullishCoalesce(_optionalChain([_chunkAEAAN4ADcjs.flattenLayers.call(void 0, layers), 'access', _184 => _184.filter, 'call', _185 => _185((x) => x.type === "pixel"), 'access', _186 => _186.pop, 'call', _187 => _187(), 'optionalAccess', _188 => _188.id]), () => ( null));
|
|
3831
|
+
this.commit("Remove layer", { ...this.doc, layers, activeLayerId: active, ...this.thickWithout(_chunkAEAAN4ADcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)), ...this.stickersWithout(_chunkAEAAN4ADcjs.flattenLayers.call(void 0, [l]).map((x) => x.id)) });
|
|
3833
3832
|
return { removed: id, activeLayerId: active };
|
|
3834
3833
|
}
|
|
3835
3834
|
duplicateLayer(id) {
|
|
3836
3835
|
this.requireIdle("duplicating a layer");
|
|
3837
|
-
if (
|
|
3836
|
+
if (_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id)) {
|
|
3838
3837
|
const inside = (l) => l.type === "group" ? l.children.flatMap(inside) : [l.id];
|
|
3839
|
-
this.dryLayersFirst(inside(
|
|
3838
|
+
this.dryLayersFirst(inside(_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id).layer));
|
|
3840
3839
|
}
|
|
3841
|
-
const loc =
|
|
3840
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3842
3841
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3843
3842
|
const thick = { ..._nullishCoalesce(this.doc.thick, () => ( {})) };
|
|
3844
3843
|
const stickers = { ..._nullishCoalesce(this.doc.stickers, () => ( {})) };
|
|
@@ -3849,53 +3848,53 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3849
3848
|
return l.type === "group" ? { ...l, id: id2, children: l.children.map(copy) } : { ...l, id: id2 };
|
|
3850
3849
|
};
|
|
3851
3850
|
const dup = { ...copy(loc.layer), name: `${loc.layer.name} copy` };
|
|
3852
|
-
const layers =
|
|
3851
|
+
const layers = _chunkAEAAN4ADcjs.insertLayer.call(void 0, this.doc.layers, dup, _nullishCoalesce(_optionalChain([loc, 'access', _189 => _189.parent, 'optionalAccess', _190 => _190.id]), () => ( null)), loc.index + 1);
|
|
3853
3852
|
this.commit("Duplicate layer", this.withWetEvents({ ...this.doc, layers, activeLayerId: dup.id, ...this.doc.thick ? { thick } : {}, ...this.doc.stickers ? { stickers } : {} }));
|
|
3854
3853
|
return this.describeLayer(dup);
|
|
3855
3854
|
}
|
|
3856
3855
|
/** Moves a layer to `index` (0 = bottom) within `parentId` (default its own parent; `null` = top level). */
|
|
3857
3856
|
moveLayer(id, index, parentId) {
|
|
3858
3857
|
this.requireIdle("moving a layer");
|
|
3859
|
-
const loc =
|
|
3858
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3860
3859
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3861
3860
|
const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _191 => _191.parent, 'optionalAccess', _192 => _192.id]), () => ( null)) : parentId;
|
|
3862
3861
|
if (target) {
|
|
3863
3862
|
const g = this.requireLayer(target);
|
|
3864
3863
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
3865
|
-
if (target === id || loc.layer.type === "group" &&
|
|
3864
|
+
if (target === id || loc.layer.type === "group" && _chunkAEAAN4ADcjs.findLayer.call(void 0, loc.layer.children, target)) throw new PaintEditorError("A group cannot move into itself.");
|
|
3866
3865
|
}
|
|
3867
|
-
const without =
|
|
3868
|
-
const siblings = target ?
|
|
3866
|
+
const without = _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
3867
|
+
const siblings = target ? _chunkAEAAN4ADcjs.findLayer.call(void 0, without, target).layer.children : without;
|
|
3869
3868
|
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).`);
|
|
3870
|
-
const layers =
|
|
3869
|
+
const layers = _chunkAEAAN4ADcjs.insertLayer.call(void 0, without, loc.layer, target, index);
|
|
3871
3870
|
this.commit("Move layer", { ...this.doc, layers });
|
|
3872
3871
|
return this.describeLayer(loc.layer);
|
|
3873
3872
|
}
|
|
3874
3873
|
/** Merges a pixel layer into the pixel layer below it (keeping the lower one's settings). */
|
|
3875
3874
|
mergeDown(id) {
|
|
3876
3875
|
this.requireIdle("merging");
|
|
3877
|
-
const pre =
|
|
3876
|
+
const pre = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3878
3877
|
if (pre) {
|
|
3879
3878
|
const sib = pre.parent ? pre.parent.children : this.doc.layers;
|
|
3880
3879
|
this.dryLayersFirst([id, _optionalChain([sib, 'access', _193 => _193[pre.index - 1], 'optionalAccess', _194 => _194.id])].filter((x) => Boolean(x)));
|
|
3881
3880
|
}
|
|
3882
|
-
const loc =
|
|
3881
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3883
3882
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3884
3883
|
const siblings = loc.parent ? loc.parent.children : this.doc.layers;
|
|
3885
3884
|
const below = siblings[loc.index - 1];
|
|
3886
3885
|
const upper = loc.layer;
|
|
3887
3886
|
if (!isPixelLayer(upper) || !isPixelLayer(below)) throw new PaintEditorError("Merge down needs a pixel layer directly above another pixel layer in the same group.");
|
|
3888
|
-
if (
|
|
3887
|
+
if (_chunkAEAAN4ADcjs.isLayerLocked.call(void 0, below, "pixels")) throw new PaintEditorError(`Layer "${below.name}" has its pixels locked; unlock it to merge into it.`);
|
|
3889
3888
|
const rect = unionRect(this.describeLayer(below).bounds, this.describeLayer(upper).bounds);
|
|
3890
|
-
let surface =
|
|
3889
|
+
let surface = _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4);
|
|
3891
3890
|
if (rect) {
|
|
3892
3891
|
const base = { ...below, opacity: 1, blend: "normal", visible: true, clipped: void 0, mask: void 0 };
|
|
3893
3892
|
const upperLit = this.litLayers([upper])[0];
|
|
3894
3893
|
const px = createPaintCompositor().composite([base, upper.visible ? upperLit : { ...upperLit, opacity: 0 }], rect, this.sources());
|
|
3895
|
-
surface =
|
|
3894
|
+
surface = _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, { width: rect.width, height: rect.height, data: px }, 4, rect.x, rect.y);
|
|
3896
3895
|
}
|
|
3897
3896
|
const merged = { ...below, surface, offset: { x: 0, y: 0 } };
|
|
3898
|
-
const layers =
|
|
3897
|
+
const layers = _chunkAEAAN4ADcjs.mapLayer.call(void 0, _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
|
|
3899
3898
|
this.commit("Merge down", this.withWetEvents({ ...this.doc, layers, activeLayerId: below.id, ...this.thickWithout([upper.id]), ...this.stickersWithout([upper.id, below.id]) }));
|
|
3900
3899
|
return this.describeLayer(merged);
|
|
3901
3900
|
}
|
|
@@ -3908,7 +3907,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3908
3907
|
this.wet.world.removeLane(l.id);
|
|
3909
3908
|
}
|
|
3910
3909
|
const bounds = this.describeLayer(l).bounds;
|
|
3911
|
-
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers:
|
|
3910
|
+
this.commit("Clear layer", this.withPaintEvent({ ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface: _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4) })), ...this.thickWithout([l.id]), ...this.stickersWithout([l.id]) }, { kind: "clear", layerId: l.id }));
|
|
3912
3911
|
return { layerId: l.id, bounds };
|
|
3913
3912
|
}
|
|
3914
3913
|
/**
|
|
@@ -3928,16 +3927,16 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3928
3927
|
if (!(grainAmount >= 0 && grainAmount <= 1)) throw new PaintEditorError(`grain ${grainAmount} is out of range; use 0..1.`);
|
|
3929
3928
|
const pressure = _nullishCoalesce(options.pressure, () => ( 0.5));
|
|
3930
3929
|
const blend = _nullishCoalesce(options.blend, () => ( "normal"));
|
|
3931
|
-
if (!
|
|
3930
|
+
if (!_chunkO7LUD7MHcjs.isBlendMode.call(void 0, blend)) throw new PaintEditorError(`Unknown blend mode "${blend}".`);
|
|
3932
3931
|
const { width, height } = this.doc.canvas;
|
|
3933
3932
|
const rect = { x: 0, y: 0, width, height };
|
|
3934
|
-
const coverage = new (0,
|
|
3933
|
+
const coverage = new (0, _chunkQBWEH3IMcjs.CoverageMap)();
|
|
3935
3934
|
const depth = grainAmount * this.doc.paper.depth;
|
|
3936
3935
|
const grain = depth > 0 ? paperGrain(this.doc.paper) : null;
|
|
3937
|
-
for (const { tx, ty } of
|
|
3938
|
-
const r = { x: tx *
|
|
3936
|
+
for (const { tx, ty } of _chunkO7LUD7MHcjs.tilesInRect.call(void 0, rect)) {
|
|
3937
|
+
const r = { x: tx * _chunkO7LUD7MHcjs.TILE, y: ty * _chunkO7LUD7MHcjs.TILE, width: Math.min(_chunkO7LUD7MHcjs.TILE, width - tx * _chunkO7LUD7MHcjs.TILE), height: Math.min(_chunkO7LUD7MHcjs.TILE, height - ty * _chunkO7LUD7MHcjs.TILE) };
|
|
3939
3938
|
const vals = new Float32Array(r.width * r.height);
|
|
3940
|
-
for (let y = 0, k = 0; y < r.height; y++) for (let x = 0; x < r.width; x++, k++) vals[k] = grain ?
|
|
3939
|
+
for (let y = 0, k = 0; y < r.height; y++) for (let x = 0; x < r.width; x++, k++) vals[k] = grain ? _chunk2XS6LTUPcjs.grainCatch.call(void 0, grain.at(r.x + x + 0.5, r.y + y + 0.5), depth, pressure) : 1;
|
|
3941
3940
|
coverage.accumulate(r, vals, 1);
|
|
3942
3941
|
}
|
|
3943
3942
|
const apply = {
|
|
@@ -3946,25 +3945,25 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3946
3945
|
background: rgbaOf(this.doc.paper.color),
|
|
3947
3946
|
opacity,
|
|
3948
3947
|
blend,
|
|
3949
|
-
lockTransparency:
|
|
3948
|
+
lockTransparency: _chunkAEAAN4ADcjs.isLayerLocked.call(void 0, l, "transparency"),
|
|
3950
3949
|
selection: null,
|
|
3951
3950
|
offset: l.offset
|
|
3952
3951
|
};
|
|
3953
3952
|
const surface = this.applyCoverage(l, coverage, rect, apply);
|
|
3954
|
-
this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers:
|
|
3953
|
+
this.commit("Fill layer", this.withPaintEvent(this.withWetEvents({ ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })) }), { kind: "fill", layerId: l.id, data: { color, opacity, grain: grainAmount, pressure, blend } }));
|
|
3955
3954
|
return { layerId: l.id, bounds: rect };
|
|
3956
3955
|
}
|
|
3957
3956
|
applyCoverage(l, coverage, rect, apply) {
|
|
3958
3957
|
const base = l.surface;
|
|
3959
3958
|
const tiles = new Map(base.tiles);
|
|
3960
|
-
for (const { tx, ty } of
|
|
3961
|
-
const key =
|
|
3962
|
-
const src = _nullishCoalesce(_optionalChain([base, 'access', _199 => _199.tiles, 'access', _200 => _200.get, 'call', _201 => _201(key), 'optionalAccess', _202 => _202.data]), () => ( new Uint8ClampedArray(
|
|
3963
|
-
const tile =
|
|
3959
|
+
for (const { tx, ty } of _chunkO7LUD7MHcjs.tilesInRect.call(void 0, { x: rect.x - l.offset.x, y: rect.y - l.offset.y, width: rect.width, height: rect.height })) {
|
|
3960
|
+
const key = _chunkO7LUD7MHcjs.tileKey.call(void 0, tx, ty);
|
|
3961
|
+
const src = _nullishCoalesce(_optionalChain([base, 'access', _199 => _199.tiles, 'access', _200 => _200.get, 'call', _201 => _201(key), 'optionalAccess', _202 => _202.data]), () => ( new Uint8ClampedArray(_chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE * 4)));
|
|
3962
|
+
const tile = _chunkO7LUD7MHcjs.finishTile.call(void 0, _chunkQBWEH3IMcjs.applyStrokeToTile.call(void 0, coverage, src, 4, tx, ty, apply), 4, 0);
|
|
3964
3963
|
if (tile) tiles.set(key, tile);
|
|
3965
3964
|
else tiles.delete(key);
|
|
3966
3965
|
}
|
|
3967
|
-
return new (0,
|
|
3966
|
+
return new (0, _chunkO7LUD7MHcjs.TiledSurface)(4, tiles, 0);
|
|
3968
3967
|
}
|
|
3969
3968
|
// --- Provider effects ------------------------------------------------------------
|
|
3970
3969
|
/** The registered effects provider, or `null`. */
|
|
@@ -3992,7 +3991,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3992
3991
|
}
|
|
3993
3992
|
/** The effect a layer is drawn from, or `undefined` for other layers. */
|
|
3994
3993
|
getEffectLayer(layerId) {
|
|
3995
|
-
return
|
|
3994
|
+
return _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, layerId) ? _optionalChain([this, 'access', _203 => _203.doc, 'access', _204 => _204.effectLayers, 'optionalAccess', _205 => _205[layerId]]) : void 0;
|
|
3996
3995
|
}
|
|
3997
3996
|
/** The effect paper (without its pixels), or `null`. */
|
|
3998
3997
|
getPaperEffect() {
|
|
@@ -4113,17 +4112,17 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4113
4112
|
this.requireIdle("adding a layer");
|
|
4114
4113
|
this.checkOpacity(options.opacity);
|
|
4115
4114
|
this.checkTime(options.time);
|
|
4116
|
-
if (options.blend !== void 0 && !
|
|
4115
|
+
if (options.blend !== void 0 && !_chunkO7LUD7MHcjs.isBlendMode.call(void 0, options.blend)) throw new PaintEditorError(`Unknown blend mode "${options.blend}". Call get_canvas_info for the blend modes.`);
|
|
4117
4116
|
if (options.aboveId !== void 0) this.requireLayer(options.aboveId);
|
|
4118
4117
|
const d = await this.describeEffect(effect, "layer");
|
|
4119
4118
|
const values = this.effectValues(d, { ...d.defaults }, options.values);
|
|
4120
4119
|
const pixels = await this.renderEffectCanvas(d, values, options.time);
|
|
4121
4120
|
this.requireIdle("adding a layer");
|
|
4122
4121
|
const above = _nullishCoalesce(options.aboveId, () => ( this.doc.activeLayerId));
|
|
4123
|
-
const loc = above ?
|
|
4122
|
+
const loc = above ? _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, above) : null;
|
|
4124
4123
|
if (options.aboveId !== void 0 && !loc) throw new PaintEditorError(`Layer "${options.aboveId}" was removed while the effect rendered.`);
|
|
4125
|
-
const layer = { ...createPaintLayer(_optionalChain([options, 'access', _212 => _212.name, 'optionalAccess', _213 => _213.trim, 'call', _214 => _214()]) || d.name), surface:
|
|
4126
|
-
const layers =
|
|
4124
|
+
const layer = { ...createPaintLayer(_optionalChain([options, 'access', _212 => _212.name, 'optionalAccess', _213 => _213.trim, 'call', _214 => _214()]) || d.name), surface: _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, pixels, 4), opacity: _nullishCoalesce(options.opacity, () => ( 1)), blend: _nullishCoalesce(options.blend, () => ( "normal")) };
|
|
4125
|
+
const layers = _chunkAEAAN4ADcjs.insertLayer.call(void 0, this.doc.layers, layer, _nullishCoalesce(_optionalChain([loc, 'optionalAccess', _215 => _215.parent, 'optionalAccess', _216 => _216.id]), () => ( null)), loc ? loc.index + 1 : void 0);
|
|
4127
4126
|
const source = this.sourceOf(d, values, options.time);
|
|
4128
4127
|
this.commit("Add effect layer", { ...this.doc, layers, activeLayerId: layer.id, effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [layer.id]: source } });
|
|
4129
4128
|
return { layer: this.describeLayer(layer), source };
|
|
@@ -4147,7 +4146,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4147
4146
|
this.requireIdle("changing an effect layer");
|
|
4148
4147
|
if (!isPixelLayer(now)) throw new PaintEditorError(`Layer "${l.name}" was removed while the effect rendered.`);
|
|
4149
4148
|
const source = this.sourceOf(d, values, time);
|
|
4150
|
-
this.commitOrAmend("Effect layer", { ...this.doc, layers:
|
|
4149
|
+
this.commitOrAmend("Effect layer", { ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...now, surface: _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, pixels, 4), offset: { x: 0, y: 0 } })), effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [l.id]: source } }, commitToHistory);
|
|
4151
4150
|
return source;
|
|
4152
4151
|
}
|
|
4153
4152
|
/** Turns an effect layer into a plain pixel layer, keeping its pixels (one undo step). */
|
|
@@ -4173,11 +4172,11 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4173
4172
|
const pixels = await this.renderEffectCanvas(d, values, options.time);
|
|
4174
4173
|
const now = this.sameLayerAfterRender(l);
|
|
4175
4174
|
const rect = this.canvasRectOf(now);
|
|
4176
|
-
const before =
|
|
4175
|
+
const before = _chunkO7LUD7MHcjs.readRegion.call(void 0, now.surface, rect);
|
|
4177
4176
|
let after = overPixels(before, pixels.data, _nullishCoalesce(options.opacity, () => ( 1)));
|
|
4178
|
-
if (options.lockTransparency ||
|
|
4179
|
-
const surface =
|
|
4180
|
-
this.commit("Effect fill", { ...this.doc, layers:
|
|
4177
|
+
if (options.lockTransparency || _chunkAEAAN4ADcjs.isLayerLocked.call(void 0, now, "transparency")) after = mixPixels(before, after, 1);
|
|
4178
|
+
const surface = _chunkO7LUD7MHcjs.writeRegion.call(void 0, now.surface, rect, after);
|
|
4179
|
+
this.commit("Effect fill", { ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, now.id, () => ({ ...now, surface })) });
|
|
4181
4180
|
return { layerId: now.id, source: this.sourceOf(d, values, options.time) };
|
|
4182
4181
|
}
|
|
4183
4182
|
/**
|
|
@@ -4192,16 +4191,16 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4192
4191
|
if (!(amount >= 0 && amount <= 1)) throw new PaintEditorError(`amount ${options.amount} is out of range; use 0..1.`);
|
|
4193
4192
|
this.checkTime(options.time);
|
|
4194
4193
|
const l = this.effectTarget(layerId, "light");
|
|
4195
|
-
if (!
|
|
4194
|
+
if (!_chunkO7LUD7MHcjs.contentBounds.call(void 0, l.surface)) throw new PaintEditorError(`Layer "${l.name}" has no paint to light; paint on it first, or add an effect layer (add_effect_layer).`);
|
|
4196
4195
|
const d = await this.describeEffect(effect, "light");
|
|
4197
4196
|
const values = this.effectValues(d, { ...d.defaults }, options.values);
|
|
4198
4197
|
const rect = this.canvasRectOf(l);
|
|
4199
|
-
const before =
|
|
4198
|
+
const before = _chunkO7LUD7MHcjs.readRegion.call(void 0, l.surface, rect);
|
|
4200
4199
|
const inputs = { source: { width: rect.width, height: rect.height, data: before } };
|
|
4201
4200
|
const heightInput = d.inputs.find((i) => i.kind === "image" && /^(height|depth|relief)$/i.test(i.name));
|
|
4202
4201
|
const relief = _optionalChain([this, 'access', _217 => _217.doc, 'access', _218 => _218.thick, 'optionalAccess', _219 => _219[l.id]]);
|
|
4203
4202
|
if (heightInput && relief) {
|
|
4204
|
-
const h =
|
|
4203
|
+
const h = _chunkO7LUD7MHcjs.readRegion.call(void 0, relief.height, rect);
|
|
4205
4204
|
const rgba = new Uint8ClampedArray(rect.width * rect.height * 4);
|
|
4206
4205
|
for (let i = 0; i < h.length; i++) rgba.set([h[i], h[i], h[i], 255], i * 4);
|
|
4207
4206
|
inputs[heightInput.name] = { width: rect.width, height: rect.height, data: rgba };
|
|
@@ -4213,18 +4212,18 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4213
4212
|
}
|
|
4214
4213
|
const out = await this.effectsRenderer.render(this.effects.require(), d.id, { width: rect.width, height: rect.height }, { time: _nullishCoalesce(options.time, () => ( 0)), values, inputs });
|
|
4215
4214
|
const now = this.sameLayerAfterRender(l);
|
|
4216
|
-
const surface =
|
|
4217
|
-
this.commit("Light effect", { ...this.doc, layers:
|
|
4215
|
+
const surface = _chunkO7LUD7MHcjs.writeRegion.call(void 0, now.surface, rect, mixPixels(before, out.data, amount));
|
|
4216
|
+
this.commit("Light effect", { ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, now.id, () => ({ ...now, surface })) });
|
|
4218
4217
|
return { layerId: now.id, source: this.sourceOf(d, values, options.time), amount };
|
|
4219
4218
|
}
|
|
4220
4219
|
// --- Brushes -------------------------------------------------------------------
|
|
4221
4220
|
findBrush(id) {
|
|
4222
|
-
return _nullishCoalesce(
|
|
4221
|
+
return _nullishCoalesce(_chunk2XS6LTUPcjs.BUILTIN_BRUSHES.find((b) => b.id === id), () => ( this.userBrushes.find((b) => b.id === id)));
|
|
4223
4222
|
}
|
|
4224
4223
|
/** A library brush by id (`undefined` when unknown). */
|
|
4225
4224
|
getBrush(id) {
|
|
4226
4225
|
const b = this.findBrush(id);
|
|
4227
|
-
return b ?
|
|
4226
|
+
return b ? _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, b, b) : void 0;
|
|
4228
4227
|
}
|
|
4229
4228
|
requireBrush(id) {
|
|
4230
4229
|
const b = this.findBrush(id);
|
|
@@ -4239,7 +4238,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4239
4238
|
const { id, ...changes } = update;
|
|
4240
4239
|
const base = id !== void 0 ? this.requireBrush(id) : this.brush;
|
|
4241
4240
|
if (changes.paint !== void 0 && changes.paint !== null) this.readStrokePaint(changes.paint);
|
|
4242
|
-
const next =
|
|
4241
|
+
const next = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { ...changes, id: base.id }, base);
|
|
4243
4242
|
if (base.builtin && !Object.keys(changes).length) next.builtin = true;
|
|
4244
4243
|
else delete next.builtin;
|
|
4245
4244
|
this.brush = next;
|
|
@@ -4248,10 +4247,10 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4248
4247
|
}
|
|
4249
4248
|
/** Saves the active brush (or `brush`) into the user library under `id` / `name`. */
|
|
4250
4249
|
saveBrush(options) {
|
|
4251
|
-
if (!
|
|
4252
|
-
if (
|
|
4253
|
-
const source = options.brush ?
|
|
4254
|
-
const saved =
|
|
4250
|
+
if (!_chunk2XS6LTUPcjs.BRUSH_ID.test(options.id)) throw new PaintEditorError(`Brush id "${options.id}" is invalid; use lowercase letters, digits and dashes (e.g. "my-pencil").`);
|
|
4251
|
+
if (_chunk2XS6LTUPcjs.BUILTIN_BRUSHES.some((b) => b.id === options.id)) throw new PaintEditorError(`"${options.id}" is a built-in brush; save under another id.`);
|
|
4252
|
+
const source = options.brush ? _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, options.brush, this.brush) : this.brush;
|
|
4253
|
+
const saved = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { ...source, id: options.id, name: _nullishCoalesce(options.name, () => ( source.name)) });
|
|
4255
4254
|
delete saved.builtin;
|
|
4256
4255
|
const i = this.userBrushes.findIndex((b) => b.id === options.id);
|
|
4257
4256
|
if (i >= 0) this.userBrushes[i] = saved;
|
|
@@ -4261,7 +4260,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4261
4260
|
return saved;
|
|
4262
4261
|
}
|
|
4263
4262
|
removeBrush(id) {
|
|
4264
|
-
if (
|
|
4263
|
+
if (_chunk2XS6LTUPcjs.BUILTIN_BRUSHES.some((b) => b.id === id)) throw new PaintEditorError(`"${id}" is a built-in brush and cannot be removed.`);
|
|
4265
4264
|
const i = this.userBrushes.findIndex((b) => b.id === id);
|
|
4266
4265
|
if (i < 0) throw new PaintEditorError(`Unknown brush "${id}". Call list_brushes for the ids.`);
|
|
4267
4266
|
this.userBrushes.splice(i, 1);
|
|
@@ -4270,12 +4269,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4270
4269
|
}
|
|
4271
4270
|
/** The user's saved brushes. */
|
|
4272
4271
|
getUserBrushes() {
|
|
4273
|
-
return this.userBrushes.map((b) =>
|
|
4272
|
+
return this.userBrushes.map((b) => _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, b, b));
|
|
4274
4273
|
}
|
|
4275
4274
|
/** A brush library file of the given brushes (default: the user's brushes). */
|
|
4276
4275
|
exportBrushes(ids) {
|
|
4277
4276
|
const list = ids ? ids.map((id) => this.requireBrush(id)) : this.userBrushes;
|
|
4278
|
-
return { format: "pixerate-brushes", version: 1, brushes: list.map(
|
|
4277
|
+
return { format: "pixerate-brushes", version: 1, brushes: list.map(_chunk2XS6LTUPcjs.brushToJSON) };
|
|
4279
4278
|
}
|
|
4280
4279
|
/**
|
|
4281
4280
|
* Adds the brushes of a library file to the user library. A brush whose id is taken is skipped
|
|
@@ -4285,14 +4284,14 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4285
4284
|
const problems = [];
|
|
4286
4285
|
let list;
|
|
4287
4286
|
try {
|
|
4288
|
-
list =
|
|
4287
|
+
list = _chunk2XS6LTUPcjs.parseBrushLibrary.call(void 0, file, problems);
|
|
4289
4288
|
} catch (e) {
|
|
4290
4289
|
throw new PaintEditorError(e.message);
|
|
4291
4290
|
}
|
|
4292
4291
|
const added = [];
|
|
4293
4292
|
const skipped = [];
|
|
4294
4293
|
for (const b of list) {
|
|
4295
|
-
if (
|
|
4294
|
+
if (_chunk2XS6LTUPcjs.BUILTIN_BRUSHES.some((x) => x.id === b.id)) {
|
|
4296
4295
|
skipped.push(b.id);
|
|
4297
4296
|
problems.push(`"${b.id}" is a built-in brush id; rename it to import it.`);
|
|
4298
4297
|
continue;
|
|
@@ -4334,9 +4333,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4334
4333
|
setPaint(paint) {
|
|
4335
4334
|
let p;
|
|
4336
4335
|
try {
|
|
4337
|
-
p =
|
|
4336
|
+
p = _chunkQBWEH3IMcjs.parsePaintSource.call(void 0, paint);
|
|
4338
4337
|
} catch (e) {
|
|
4339
|
-
if (e instanceof
|
|
4338
|
+
if (e instanceof _chunkQBWEH3IMcjs.PaintSourceError) throw new PaintEditorError(e.message);
|
|
4340
4339
|
throw e;
|
|
4341
4340
|
}
|
|
4342
4341
|
if (p.type === "color") {
|
|
@@ -4353,19 +4352,19 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4353
4352
|
* brush's gradient, else the editor's gradient paint. Erasers, blenders and smudges take none.
|
|
4354
4353
|
*/
|
|
4355
4354
|
strokeGradient(init, brush, color) {
|
|
4356
|
-
if (!
|
|
4355
|
+
if (!_chunk2XS6LTUPcjs.brushTakesPaint.call(void 0, brush)) return null;
|
|
4357
4356
|
let g = null;
|
|
4358
4357
|
if (init.paint !== void 0) {
|
|
4359
4358
|
const p = this.readStrokePaint(init.paint);
|
|
4360
4359
|
g = p.type === "gradient" ? p : null;
|
|
4361
4360
|
} else g = _nullishCoalesce(brush.paint, () => ( (init.color === void 0 ? this.gradient : null)));
|
|
4362
|
-
return g ?
|
|
4361
|
+
return g ? _chunkQBWEH3IMcjs.resolvePaintGradient.call(void 0, g, { paint: color, secondary: this.secondaryColor }) : null;
|
|
4363
4362
|
}
|
|
4364
4363
|
readStrokePaint(raw) {
|
|
4365
4364
|
try {
|
|
4366
|
-
return
|
|
4365
|
+
return _chunkQBWEH3IMcjs.parsePaintSource.call(void 0, raw);
|
|
4367
4366
|
} catch (e) {
|
|
4368
|
-
if (e instanceof
|
|
4367
|
+
if (e instanceof _chunkQBWEH3IMcjs.PaintSourceError) throw new PaintEditorError(e.message);
|
|
4369
4368
|
throw e;
|
|
4370
4369
|
}
|
|
4371
4370
|
}
|
|
@@ -4387,7 +4386,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4387
4386
|
if (options.layerId !== void 0) {
|
|
4388
4387
|
const l = this.requireLayer(options.layerId);
|
|
4389
4388
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; pick from a pixel layer or the composite.`);
|
|
4390
|
-
const [r, g, b, a] =
|
|
4389
|
+
const [r, g, b, a] = _chunkO7LUD7MHcjs.readPixel.call(void 0, l.surface, px - l.offset.x, py - l.offset.y);
|
|
4391
4390
|
return { color: rgbToHex(r, g, b), alpha: Math.round(a / 255 * 1e3) / 1e3 };
|
|
4392
4391
|
}
|
|
4393
4392
|
const d = this.exportCompositor.composite(this.renderLayers({}), { x: px, y: py, width: 1, height: 1 }, this.sources());
|
|
@@ -4396,14 +4395,14 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4396
4395
|
// --- Mixer Brush ---------------------------------------------------------------
|
|
4397
4396
|
/** Fills the Mixer Brush reservoir with a colour (default the editor colour). */
|
|
4398
4397
|
loadMixerBrush(color) {
|
|
4399
|
-
const [r, g, b] =
|
|
4400
|
-
this.mixerLoad =
|
|
4398
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, color === void 0 ? this.color : parseColor(color));
|
|
4399
|
+
this.mixerLoad = _chunkQBWEH3IMcjs.loadMixer.call(void 0, this.mixerLoad, [r / 255, g / 255, b / 255]);
|
|
4401
4400
|
this.emit([]);
|
|
4402
4401
|
return this.mixerLoad;
|
|
4403
4402
|
}
|
|
4404
4403
|
/** Empties the pickup well (and with `emptyReservoir` the loaded paint too). */
|
|
4405
4404
|
cleanMixerBrush(emptyReservoir = false) {
|
|
4406
|
-
this.mixerLoad = emptyReservoir ?
|
|
4405
|
+
this.mixerLoad = emptyReservoir ? _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD : _chunkQBWEH3IMcjs.cleanMixer.call(void 0, this.mixerLoad);
|
|
4407
4406
|
this.emit([]);
|
|
4408
4407
|
return this.mixerLoad;
|
|
4409
4408
|
}
|
|
@@ -4426,7 +4425,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4426
4425
|
// --- Strokes -------------------------------------------------------------------
|
|
4427
4426
|
strokeBrush(init) {
|
|
4428
4427
|
let brush = init.brushId !== void 0 ? this.requireBrush(init.brushId) : this.brush;
|
|
4429
|
-
if (init.brush) brush =
|
|
4428
|
+
if (init.brush) brush = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { ...init.brush, id: brush.id }, brush);
|
|
4430
4429
|
return brush;
|
|
4431
4430
|
}
|
|
4432
4431
|
/**
|
|
@@ -4450,41 +4449,41 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4450
4449
|
let layer = (() => {
|
|
4451
4450
|
const id = _nullishCoalesce(init.layerId, () => ( doc.activeLayerId));
|
|
4452
4451
|
if (!id) throw new PaintEditorError("There is no active layer to paint on; add one with add_layer.");
|
|
4453
|
-
const loc =
|
|
4452
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, doc.layers, id);
|
|
4454
4453
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
4455
4454
|
const l = loc.layer;
|
|
4456
4455
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; paint on a pixel layer inside it.`);
|
|
4457
|
-
if (
|
|
4456
|
+
if (_chunkAEAAN4ADcjs.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.`);
|
|
4458
4457
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) to paint on it.`);
|
|
4459
4458
|
return l;
|
|
4460
4459
|
})();
|
|
4461
4460
|
const brush = this.strokeBrush(init);
|
|
4462
4461
|
const stickerLayer = Boolean(_optionalChain([doc, 'access', _225 => _225.stickers, 'optionalAccess', _226 => _226[layer.id], 'optionalAccess', _227 => _227.length]));
|
|
4463
4462
|
if (brush.engine === "sticker") {
|
|
4464
|
-
if (!stickerLayer &&
|
|
4463
|
+
if (!stickerLayer && _chunkO7LUD7MHcjs.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.`);
|
|
4465
4464
|
} else if (stickerLayer) {
|
|
4466
4465
|
throw new PaintEditorError(`Layer "${layer.name}" is a sticker layer (its pixels are drawn from its stickers); paint on another layer (add_layer).`);
|
|
4467
4466
|
}
|
|
4468
4467
|
let wet;
|
|
4469
|
-
if (
|
|
4468
|
+
if (_chunk2XS6LTUPcjs.isWetBrush.call(void 0, brush)) {
|
|
4470
4469
|
this.requireWetIdle("painting");
|
|
4471
4470
|
if (layer.offset.x || layer.offset.y) {
|
|
4472
|
-
const moved = { ...layer, surface:
|
|
4473
|
-
this.doc = { ...this.doc, layers:
|
|
4474
|
-
if (doc !== this.doc) doc = { ...doc, layers:
|
|
4471
|
+
const moved = { ...layer, surface: _chunkO7LUD7MHcjs.translateSurface.call(void 0, layer.surface, layer.offset.x, layer.offset.y), offset: { x: 0, y: 0 } };
|
|
4472
|
+
this.doc = { ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => moved) };
|
|
4473
|
+
if (doc !== this.doc) doc = { ...doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, doc.layers, layer.id, () => moved) };
|
|
4475
4474
|
layer = moved;
|
|
4476
4475
|
}
|
|
4477
|
-
if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >=
|
|
4478
|
-
throw new PaintEditorError(`At most ${
|
|
4476
|
+
if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >= _chunkF2Y4E4GUcjs.MAX_WET_LANES) {
|
|
4477
|
+
throw new PaintEditorError(`At most ${_chunkF2Y4E4GUcjs.MAX_WET_LANES} layers can hold wet paint at once; dry one first (dry_paint).`);
|
|
4479
4478
|
}
|
|
4480
4479
|
this.beginWetOp();
|
|
4481
4480
|
const world = this.wet.ensureLane(layer.id, brush.wet.medium);
|
|
4482
4481
|
const id = layer.id;
|
|
4483
4482
|
const wetColor = init.color === void 0 ? this.color : parseColor(init.color);
|
|
4484
|
-
const [r, g, b] =
|
|
4483
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, wetColor);
|
|
4485
4484
|
const wetGradient = this.strokeGradient(init, brush, wetColor);
|
|
4486
4485
|
const load = _nullishCoalesce(init.load, () => ( brushLoadForStroke(brush, this.mixerLoad, [r / 255, g / 255, b / 255])));
|
|
4487
|
-
const seedW = _nullishCoalesce(init.seed, () => (
|
|
4486
|
+
const seedW = _nullishCoalesce(init.seed, () => ( _chunkQBWEH3IMcjs.mix32.call(void 0, this.seedCounter * 2654435761 >>> 0) & 2147483647));
|
|
4488
4487
|
const copiesW = (_nullishCoalesce(init.copies, () => ( this.strokeCopies()))).filter((m) => m.some((v, i) => v !== IDENTITY_AFFINE[i]));
|
|
4489
4488
|
const driver = new WetStrokeDriver({
|
|
4490
4489
|
world,
|
|
@@ -4494,7 +4493,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4494
4493
|
load,
|
|
4495
4494
|
grain: paperGrain(doc.paper),
|
|
4496
4495
|
paperDepth: doc.paper.depth,
|
|
4497
|
-
paperColor:
|
|
4496
|
+
paperColor: _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, doc.paper.color),
|
|
4498
4497
|
seed: seedW,
|
|
4499
4498
|
copies: [IDENTITY_AFFINE, ...copiesW].map(affineCopy),
|
|
4500
4499
|
mask: init.maskStencils ? this.stencilSelection(init.maskStencils) : init.stencils !== false ? this.stencilSelection() : null,
|
|
@@ -4504,7 +4503,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4504
4503
|
wet = { driver, surface: () => world.display(id).surface };
|
|
4505
4504
|
} else if (this.wet.wetLayerIds().includes(layer.id)) {
|
|
4506
4505
|
this.dryLayersFirst([layer.id]);
|
|
4507
|
-
const dried =
|
|
4506
|
+
const dried = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, layer.id).layer;
|
|
4508
4507
|
layer = dried;
|
|
4509
4508
|
}
|
|
4510
4509
|
let color = init.color === void 0 ? this.color : parseColor(init.color);
|
|
@@ -4517,13 +4516,13 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4517
4516
|
const selection = init.maskStencils ? this.stencilSelection(init.maskStencils) : useStencils ? this.stencilSelection() : null;
|
|
4518
4517
|
const inputFilter = snapper || stencilSnapper ? (p) => stencilSnapper ? stencilSnapper.snap(snapper ? snapper.snap(p) : p) : snapper.snap(p) : void 0;
|
|
4519
4518
|
const rgba = rgbaOf(color);
|
|
4520
|
-
const seed = _nullishCoalesce(init.seed, () => (
|
|
4519
|
+
const seed = _nullishCoalesce(init.seed, () => ( _chunkQBWEH3IMcjs.mix32.call(void 0, this.seedCounter++ * 2654435761 >>> 0) & 2147483647));
|
|
4521
4520
|
const copies = (_nullishCoalesce(init.copies, () => ( this.strokeCopies()))).filter((m) => m.some((v, i) => v !== IDENTITY_AFFINE[i]));
|
|
4522
4521
|
const session = new PaintStrokeSession(host, {
|
|
4523
4522
|
layerId: layer.id,
|
|
4524
4523
|
surface: layer.surface,
|
|
4525
4524
|
offset: layer.offset,
|
|
4526
|
-
lockTransparency:
|
|
4525
|
+
lockTransparency: _chunkAEAAN4ADcjs.isLayerLocked.call(void 0, layer, "transparency"),
|
|
4527
4526
|
brush,
|
|
4528
4527
|
color: rgba,
|
|
4529
4528
|
background: rgbaOf(doc.paper.color),
|
|
@@ -4551,7 +4550,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4551
4550
|
const stroke = {
|
|
4552
4551
|
id: `s${this.strokeCounter++}`,
|
|
4553
4552
|
layerId: session.layerId,
|
|
4554
|
-
brush:
|
|
4553
|
+
brush: _chunk2XS6LTUPcjs.brushToJSON.call(void 0, init.brush),
|
|
4555
4554
|
color: init.colorHex,
|
|
4556
4555
|
points: session.points.map((p) => ({ ...p })),
|
|
4557
4556
|
seed: init.seed
|
|
@@ -4618,7 +4617,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4618
4617
|
const thick = ch ? { ..._nullishCoalesce(this.doc.thick, () => ( {})), [l.id]: ch } : this.doc.thick;
|
|
4619
4618
|
const sprayed = s.stickers();
|
|
4620
4619
|
const stickers = sprayed ? { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([this, 'access', _239 => _239.doc, 'access', _240 => _240.stickers, 'optionalAccess', _241 => _241[l.id]]), () => ( [])), ...sprayed] } : this.doc.stickers;
|
|
4621
|
-
this.commit(`${brush.name} stroke`, this.withWetEvents({ ...this.doc, layers:
|
|
4620
|
+
this.commit(`${brush.name} stroke`, this.withWetEvents({ ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, l.id, () => ({ ...l, surface })), strokes: [...this.doc.strokes, stroke], ...thick ? { thick } : {}, ...stickers ? { stickers } : {} }), wetStroke ? before : this.doc);
|
|
4622
4621
|
}
|
|
4623
4622
|
};
|
|
4624
4623
|
let session;
|
|
@@ -4646,13 +4645,13 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4646
4645
|
if (cancelled || !surface) return;
|
|
4647
4646
|
const stroke = this.record(s);
|
|
4648
4647
|
s.result.strokeId = stroke.id;
|
|
4649
|
-
const l =
|
|
4648
|
+
const l = _chunkAEAAN4ADcjs.findLayer.call(void 0, out.layers, s.layerId).layer;
|
|
4650
4649
|
const offset = s.init.wet ? { x: 0, y: 0 } : l.offset;
|
|
4651
4650
|
const ch = s.thickChannels();
|
|
4652
4651
|
const sprayed = s.stickers();
|
|
4653
4652
|
out = {
|
|
4654
4653
|
...out,
|
|
4655
|
-
layers:
|
|
4654
|
+
layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface, offset })),
|
|
4656
4655
|
strokes: [...out.strokes, stroke],
|
|
4657
4656
|
...ch ? { thick: { ..._nullishCoalesce(out.thick, () => ( {})), [l.id]: ch } } : {},
|
|
4658
4657
|
...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _242 => _242.stickers, 'optionalAccess', _243 => _243[l.id]]), () => ( [])), ...sprayed] } } : {}
|
|
@@ -4667,8 +4666,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4667
4666
|
if (this.wet.instantDry && result.strokeId) {
|
|
4668
4667
|
this.wet.dry(session.layerId);
|
|
4669
4668
|
this.logWet({ kind: "dry", layerId: session.layerId, at: out.strokes.length });
|
|
4670
|
-
const dried =
|
|
4671
|
-
out = { ...out, layers:
|
|
4669
|
+
const dried = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, session.layerId).layer.surface;
|
|
4670
|
+
out = { ...out, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, out.layers, session.layerId, (l) => ({ ...l, surface: dried })) };
|
|
4672
4671
|
}
|
|
4673
4672
|
result.wet = this.wet.isWet(session.layerId);
|
|
4674
4673
|
}
|
|
@@ -4743,13 +4742,13 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4743
4742
|
let brush = v.brush;
|
|
4744
4743
|
if (options.brushId !== void 0) {
|
|
4745
4744
|
const b = this.requireBrush(options.brushId);
|
|
4746
|
-
brush =
|
|
4745
|
+
brush = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
|
|
4747
4746
|
}
|
|
4748
4747
|
const layerId = _nullishCoalesce(options.layerId, () => ( s.layerId));
|
|
4749
|
-
if (!
|
|
4748
|
+
if (!_chunkAEAAN4ADcjs.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.`);
|
|
4750
4749
|
let load = s.load;
|
|
4751
4750
|
if (load && options.color !== void 0 && load.reservoir) {
|
|
4752
|
-
const [r, g, b] =
|
|
4751
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, options.color);
|
|
4753
4752
|
load = { ...load, reservoir: [r / 255, g / 255, b / 255] };
|
|
4754
4753
|
}
|
|
4755
4754
|
const paint = v.paint && options.color === void 0 ? { paint: v.paint } : {};
|
|
@@ -4842,7 +4841,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4842
4841
|
/** `renderHighRes` as PNG bytes. */
|
|
4843
4842
|
async exportHighResPng(options) {
|
|
4844
4843
|
const img = await this.renderHighRes(options);
|
|
4845
|
-
return
|
|
4844
|
+
return _chunkO7LUD7MHcjs.encodePng.call(void 0, img.width, img.height, img.data);
|
|
4846
4845
|
}
|
|
4847
4846
|
async renderHighRes(options) {
|
|
4848
4847
|
const target = this.createReplayTarget(options.scale);
|
|
@@ -4894,7 +4893,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4894
4893
|
wetState() {
|
|
4895
4894
|
const st = this.getState().wet;
|
|
4896
4895
|
const backend = this.wet.backend();
|
|
4897
|
-
return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess', _249 => _249.message]), () => (
|
|
4896
|
+
return { ...st, layers: this.wet.wetLayerIds().map((id) => this.wet.info(id)), backend, message: _nullishCoalesce(_optionalChain([backend, 'optionalAccess', _249 => _249.message]), () => ( _chunkF2Y4E4GUcjs.wetSupport.call(void 0, ).message)), engine: this.wet.engineInfo() };
|
|
4898
4897
|
}
|
|
4899
4898
|
/**
|
|
4900
4899
|
* Engine B, the WebGPU accelerator for large wet areas: whether it may run, its state (`off`,
|
|
@@ -4963,11 +4962,11 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4963
4962
|
wetPaper(options = {}) {
|
|
4964
4963
|
this.requireIdle("wetting the paper");
|
|
4965
4964
|
const l = this.wetLayer(options.layerId, "wet the paper of");
|
|
4966
|
-
if (
|
|
4965
|
+
if (_chunkAEAAN4ADcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it first.`);
|
|
4967
4966
|
const amount = _nullishCoalesce(options.amount, () => ( 1));
|
|
4968
4967
|
if (!(amount > 0 && amount <= 1)) throw new PaintEditorError(`amount ${amount} is out of range; use above 0 up to 1.`);
|
|
4969
4968
|
const rect = _nullishCoalesce(this.checkRect(options.rect), () => ( { x: 0, y: 0, width: this.doc.canvas.width, height: this.doc.canvas.height }));
|
|
4970
|
-
if (!this.wet.wetLayerIds().includes(l.id) && this.wet.wetLayerIds().length >=
|
|
4969
|
+
if (!this.wet.wetLayerIds().includes(l.id) && this.wet.wetLayerIds().length >= _chunkF2Y4E4GUcjs.MAX_WET_LANES) throw new PaintEditorError(`At most ${_chunkF2Y4E4GUcjs.MAX_WET_LANES} layers can hold wet paint at once; dry one first (dry_paint).`);
|
|
4971
4970
|
const before = this.doc;
|
|
4972
4971
|
this.beginWetOp();
|
|
4973
4972
|
const world = this.wet.ensureLane(l.id);
|
|
@@ -5047,7 +5046,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5047
5046
|
const live = this.live;
|
|
5048
5047
|
if (!live) return this.doc.layers;
|
|
5049
5048
|
if (_optionalChain([this, 'access', _253 => _253.liveLayers, 'optionalAccess', _254 => _254.key]) === live.surface) return this.liveLayers.layers;
|
|
5050
|
-
const layers =
|
|
5049
|
+
const layers = _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
|
|
5051
5050
|
this.liveLayers = { key: live.surface, layers };
|
|
5052
5051
|
return layers;
|
|
5053
5052
|
}
|
|
@@ -5084,7 +5083,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5084
5083
|
let out = layers;
|
|
5085
5084
|
for (const id of ids) {
|
|
5086
5085
|
const baked = this.wet.bakedSurface(id);
|
|
5087
|
-
if (baked &&
|
|
5086
|
+
if (baked && _chunkAEAAN4ADcjs.findLayer.call(void 0, out, id)) out = _chunkAEAAN4ADcjs.mapLayer.call(void 0, out, id, (l) => ({ ...l, surface: baked }));
|
|
5088
5087
|
}
|
|
5089
5088
|
return out;
|
|
5090
5089
|
}
|
|
@@ -5097,12 +5096,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5097
5096
|
const ids = /* @__PURE__ */ new Set([...Object.keys(_nullishCoalesce(thick, () => ( {}))), ...live ? [live.layerId] : []]);
|
|
5098
5097
|
for (const id of ids) {
|
|
5099
5098
|
const ch = _optionalChain([live, 'optionalAccess', _257 => _257.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _258 => _258[id]]);
|
|
5100
|
-
const l = ch && _optionalChain([
|
|
5099
|
+
const l = ch && _optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, out, id), 'optionalAccess', _259 => _259.layer]);
|
|
5101
5100
|
if (!ch || !isPixelLayer(l)) continue;
|
|
5102
5101
|
let cache = this.litCaches.get(id);
|
|
5103
5102
|
if (!cache) this.litCaches.set(id, cache = new LitCache());
|
|
5104
5103
|
const lit = cache.lit(l.surface, ch, this.lighting);
|
|
5105
|
-
if (lit !== l.surface) out =
|
|
5104
|
+
if (lit !== l.surface) out = _chunkAEAAN4ADcjs.mapLayer.call(void 0, out, id, () => ({ ...l, surface: lit }));
|
|
5106
5105
|
}
|
|
5107
5106
|
return out;
|
|
5108
5107
|
}
|
|
@@ -5110,7 +5109,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5110
5109
|
let layers = this.litLayers((_nullishCoalesce(options.wet, () => ( "display"))) === "dried" ? this.driedLayers() : this.currentLayers());
|
|
5111
5110
|
if (options.layerIds) {
|
|
5112
5111
|
const picked = [];
|
|
5113
|
-
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([
|
|
5112
|
+
for (const id of options.layerIds) picked.push(_nullishCoalesce(_optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, layers, id), 'optionalAccess', _260 => _260.layer]), () => ( this.requireLayer(id))));
|
|
5114
5113
|
layers = picked.map((l) => ({ ...l, visible: true }));
|
|
5115
5114
|
}
|
|
5116
5115
|
const under = options.paper === false ? [] : [paperNode(this.doc.paper, this.lighting)];
|
|
@@ -5153,7 +5152,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5153
5152
|
/** Wet settings saved with the document (`null` when they are all defaults). */
|
|
5154
5153
|
wetJSON() {
|
|
5155
5154
|
const layers = {};
|
|
5156
|
-
for (const [id, set] of this.wet.settings) if (
|
|
5155
|
+
for (const [id, set] of this.wet.settings) if (_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id)) layers[id] = { params: { ...set.params }, flow: { ...set.flow } };
|
|
5157
5156
|
const flat = this.wet.tilt.angle === 0;
|
|
5158
5157
|
if (!Object.keys(layers).length && flat) return void 0;
|
|
5159
5158
|
return { tilt: { ...this.wet.tilt }, layers };
|
|
@@ -5162,7 +5161,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5162
5161
|
this.wet.reset();
|
|
5163
5162
|
if (!raw || typeof raw !== "object") return;
|
|
5164
5163
|
const r = raw;
|
|
5165
|
-
this.wet.setTilt(
|
|
5164
|
+
this.wet.setTilt(_chunkF2Y4E4GUcjs.normalizeTilt.call(void 0, _nullishCoalesce(r.tilt, () => ( {}))));
|
|
5166
5165
|
if (r.layers && typeof r.layers === "object") {
|
|
5167
5166
|
for (const [id, v] of Object.entries(r.layers)) {
|
|
5168
5167
|
if (!v || typeof v !== "object") {
|
|
@@ -5170,7 +5169,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5170
5169
|
continue;
|
|
5171
5170
|
}
|
|
5172
5171
|
const x = v;
|
|
5173
|
-
this.wet.settings.set(id, { params:
|
|
5172
|
+
this.wet.settings.set(id, { params: _chunkF2Y4E4GUcjs.normalizeWetParams.call(void 0, _nullishCoalesce(x.params, () => ( {}))), flow: _chunkF2Y4E4GUcjs.normalizeFlow.call(void 0, _nullishCoalesce(x.flow, () => ( {}))) });
|
|
5174
5173
|
}
|
|
5175
5174
|
}
|
|
5176
5175
|
}
|
|
@@ -5179,17 +5178,17 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5179
5178
|
const ext = { ...this.extensions };
|
|
5180
5179
|
const channels = {};
|
|
5181
5180
|
for (const [id, ch] of Object.entries(_nullishCoalesce(this.doc.thick, () => ( {})))) {
|
|
5182
|
-
if (!
|
|
5181
|
+
if (!_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id)) continue;
|
|
5183
5182
|
const saved = thickToJSON(ch);
|
|
5184
5183
|
if (saved) channels[id] = saved;
|
|
5185
5184
|
}
|
|
5186
5185
|
if (Object.keys(channels).length) ext.layerChannels = channels;
|
|
5187
5186
|
else delete ext.layerChannels;
|
|
5188
5187
|
const stickers = {};
|
|
5189
|
-
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length &&
|
|
5188
|
+
for (const [id, list] of Object.entries(_nullishCoalesce(this.doc.stickers, () => ( {})))) if (list.length && _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id)) stickers[id] = list.map((x) => ({ ...x }));
|
|
5190
5189
|
if (Object.keys(stickers).length) ext.stickers = stickers;
|
|
5191
5190
|
else delete ext.stickers;
|
|
5192
|
-
const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([
|
|
5191
|
+
const effectLayers = effectLayersToJSON(_nullishCoalesce(this.doc.effectLayers, () => ( {})), (id) => isPixelLayer(_optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _263 => _263.layer])));
|
|
5193
5192
|
if (effectLayers) ext.effectLayers = effectLayers;
|
|
5194
5193
|
else delete ext.effectLayers;
|
|
5195
5194
|
if (this.doc.paperEffect) ext.paperEffect = paperEffectToJSON(this.doc.paperEffect);
|
|
@@ -5205,8 +5204,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5205
5204
|
if (ext.stickers && typeof ext.stickers === "object") {
|
|
5206
5205
|
const stickers = {};
|
|
5207
5206
|
for (const [id, list] of Object.entries(ext.stickers)) {
|
|
5208
|
-
if (!
|
|
5209
|
-
const ok = list.filter((x) => x && typeof x.id === "string" &&
|
|
5207
|
+
if (!_chunkAEAAN4ADcjs.findLayer.call(void 0, state.layers, id) || !Array.isArray(list)) continue;
|
|
5208
|
+
const ok = list.filter((x) => x && typeof x.id === "string" && _chunk2XS6LTUPcjs.STAMP_KINDS.includes(x.stamp) && Number.isFinite(x.x) && Number.isFinite(x.y) && x.size > 0);
|
|
5210
5209
|
if (ok.length !== list.length) problems.push(`Some stickers of layer "${id}" could not be read; they were dropped.`);
|
|
5211
5210
|
stickers[id] = ok.map((x) => ({ ...x }));
|
|
5212
5211
|
}
|
|
@@ -5215,7 +5214,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5215
5214
|
if (ext.effectLayers && typeof ext.effectLayers === "object") {
|
|
5216
5215
|
const effectLayers = {};
|
|
5217
5216
|
for (const [id, v] of Object.entries(ext.effectLayers)) {
|
|
5218
|
-
if (!isPixelLayer(_optionalChain([
|
|
5217
|
+
if (!isPixelLayer(_optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _264 => _264.layer]))) continue;
|
|
5219
5218
|
const source = readPaintEffectSource(v);
|
|
5220
5219
|
if (source) effectLayers[id] = source;
|
|
5221
5220
|
else problems.push(`The effect of layer "${id}" could not be read; it loads as a plain layer.`);
|
|
@@ -5233,7 +5232,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5233
5232
|
if (!raw || typeof raw !== "object") return state;
|
|
5234
5233
|
const thick = {};
|
|
5235
5234
|
for (const [id, v] of Object.entries(raw)) {
|
|
5236
|
-
if (!
|
|
5235
|
+
if (!_chunkAEAAN4ADcjs.findLayer.call(void 0, state.layers, id)) continue;
|
|
5237
5236
|
try {
|
|
5238
5237
|
thick[id] = thickFromJSON(v);
|
|
5239
5238
|
} catch (e) {
|
|
@@ -5292,7 +5291,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5292
5291
|
/** The canvas as PNG bytes (paper included by default; `scale` below 1 shrinks it). */
|
|
5293
5292
|
exportPng(options = {}) {
|
|
5294
5293
|
const img = this.scaled(options);
|
|
5295
|
-
return
|
|
5294
|
+
return _chunkO7LUD7MHcjs.encodePng.call(void 0, img.width, img.height, img.data);
|
|
5296
5295
|
}
|
|
5297
5296
|
scaled(options) {
|
|
5298
5297
|
const full = this.compositePixels(options);
|
|
@@ -5335,22 +5334,22 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5335
5334
|
opacity: 1,
|
|
5336
5335
|
blend: "normal",
|
|
5337
5336
|
locks: { all: true },
|
|
5338
|
-
surface:
|
|
5337
|
+
surface: _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, paperPixels, 4),
|
|
5339
5338
|
offset: { x: 0, y: 0 }
|
|
5340
5339
|
};
|
|
5341
5340
|
const merged = this.compositePixels({ paper: true }).data;
|
|
5342
5341
|
const changed = /* @__PURE__ */ new Map();
|
|
5343
5342
|
const toStandard = (layers2) => layers2.map((l) => {
|
|
5344
|
-
const blend = l.blend === "pass-through" ? l.blend :
|
|
5343
|
+
const blend = l.blend === "pass-through" ? l.blend : _chunkO7LUD7MHcjs.standardBlendMode.call(void 0, l.blend);
|
|
5345
5344
|
if (blend !== l.blend) changed.set(l.blend, [..._nullishCoalesce(changed.get(l.blend), () => ( [])), l.name]);
|
|
5346
5345
|
const next = blend === l.blend ? l : { ...l, blend };
|
|
5347
5346
|
return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
|
|
5348
5347
|
});
|
|
5349
5348
|
const layers = toStandard(dried);
|
|
5350
|
-
const result =
|
|
5349
|
+
const result = _chunkXN2NBLV5cjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
|
|
5351
5350
|
for (const [mode, names] of changed) {
|
|
5352
|
-
const label = _nullishCoalesce(_optionalChain([
|
|
5353
|
-
const std = _nullishCoalesce(_optionalChain([
|
|
5351
|
+
const label = _nullishCoalesce(_optionalChain([_chunkO7LUD7MHcjs.BLEND_MODES, 'access', _268 => _268.find, 'call', _269 => _269((m) => m.id === mode), 'optionalAccess', _270 => _270.label]), () => ( mode));
|
|
5352
|
+
const std = _nullishCoalesce(_optionalChain([_chunkO7LUD7MHcjs.BLEND_MODES, 'access', _271 => _271.find, 'call', _272 => _272((m) => m.id === _chunkO7LUD7MHcjs.standardBlendMode.call(void 0, mode)), 'optionalAccess', _273 => _273.label]), () => ( _chunkO7LUD7MHcjs.standardBlendMode.call(void 0, mode)));
|
|
5354
5353
|
const list = names.map((n) => `"${n}"`).join(", ");
|
|
5355
5354
|
const one = names.length === 1;
|
|
5356
5355
|
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).`);
|
|
@@ -5360,7 +5359,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5360
5359
|
/** `render_preview` as a base64 PNG. */
|
|
5361
5360
|
previewPngBase64(options = {}) {
|
|
5362
5361
|
const img = this.renderPreview(options);
|
|
5363
|
-
return { data:
|
|
5362
|
+
return { data: _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, _chunkO7LUD7MHcjs.encodePng.call(void 0, img.width, img.height, img.data)), width: img.width, height: img.height };
|
|
5364
5363
|
}
|
|
5365
5364
|
// --- Guides --------------------------------------------------------------------
|
|
5366
5365
|
setGuides(next) {
|
|
@@ -5398,17 +5397,17 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5398
5397
|
pixels = this.decodeImage(input.png.trim().startsWith("data:") ? input.png.trim() : `data:image/png;base64,${input.png.trim()}`, what);
|
|
5399
5398
|
} else throw new PaintEditorError(`${what}: pass png (a PNG as base64 or a data URL) or pixels.`);
|
|
5400
5399
|
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.`);
|
|
5401
|
-
const src =
|
|
5400
|
+
const src = _chunkO7LUD7MHcjs.pngDataUrl.call(void 0, pixels.width, pixels.height, pixels.data);
|
|
5402
5401
|
this.imagePixels.set(src, pixels);
|
|
5403
5402
|
return { src, pixels };
|
|
5404
5403
|
}
|
|
5405
5404
|
decodeImage(src, what = "Image") {
|
|
5406
5405
|
const cached = this.imagePixels.get(src);
|
|
5407
5406
|
if (cached) return cached;
|
|
5408
|
-
const parsed =
|
|
5407
|
+
const parsed = _chunkO7LUD7MHcjs.parseDataUrl.call(void 0, src);
|
|
5409
5408
|
if (!parsed) throw new PaintEditorError(`${what} is not a data URL or base64 PNG.`);
|
|
5410
5409
|
try {
|
|
5411
|
-
const png =
|
|
5410
|
+
const png = _chunkO7LUD7MHcjs.decodePng.call(void 0, parsed.bytes);
|
|
5412
5411
|
const px = { width: png.width, height: png.height, data: png.data };
|
|
5413
5412
|
this.imagePixels.set(src, px);
|
|
5414
5413
|
return px;
|
|
@@ -5597,9 +5596,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5597
5596
|
}
|
|
5598
5597
|
/** Replaces a layer's stickers and redraws its pixels from them (one undo step). */
|
|
5599
5598
|
commitStickers(label, layer, stickers) {
|
|
5600
|
-
if (
|
|
5601
|
-
const surface =
|
|
5602
|
-
const doc = { ...this.doc, layers:
|
|
5599
|
+
if (_chunkAEAAN4ADcjs.isLayerLocked.call(void 0, layer, "pixels")) throw new PaintEditorError(`Layer "${layer.name}" has its pixels locked; unlock it first.`);
|
|
5600
|
+
const surface = _chunk2XS6LTUPcjs.stickerSurface.call(void 0, stickers);
|
|
5601
|
+
const doc = { ...this.doc, layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, layer.id, () => ({ ...layer, surface, offset: { x: 0, y: 0 } })), stickers: { ..._nullishCoalesce(this.doc.stickers, () => ( {})), [layer.id]: stickers } };
|
|
5603
5602
|
this.commit(label, this.withPaintEvent(doc, { kind: "stickers", layerId: layer.id, data: { stickers: stickers.map((s) => ({ ...s })) } }));
|
|
5604
5603
|
}
|
|
5605
5604
|
/** Moves, turns, resizes, recolours or restamps one sticker (one undo step). Returns it. */
|
|
@@ -5609,7 +5608,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5609
5608
|
if (i < 0) throw new PaintEditorError(`Layer "${layer.name}" has no sticker "${id}". Call list_stickers for the ids.`);
|
|
5610
5609
|
let u;
|
|
5611
5610
|
try {
|
|
5612
|
-
u =
|
|
5611
|
+
u = _chunk2XS6LTUPcjs.normalizeStickerUpdate.call(void 0, update);
|
|
5613
5612
|
} catch (e) {
|
|
5614
5613
|
throw new PaintEditorError(e.message);
|
|
5615
5614
|
}
|
|
@@ -5710,7 +5709,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5710
5709
|
}
|
|
5711
5710
|
makeSwatch(color, name) {
|
|
5712
5711
|
const p = typeof color === "string" ? { type: "color", color: parseColor(color) } : this.readStrokePaint(color);
|
|
5713
|
-
const out = { color:
|
|
5712
|
+
const out = { color: _chunkQBWEH3IMcjs.paintSourceColor.call(void 0, p, { paint: this.color, secondary: this.secondaryColor }) };
|
|
5714
5713
|
if (_optionalChain([name, 'optionalAccess', _292 => _292.trim, 'call', _293 => _293()])) out.name = name.trim();
|
|
5715
5714
|
if (p.type === "gradient") out.paint = p;
|
|
5716
5715
|
return out;
|
|
@@ -5852,7 +5851,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5852
5851
|
}
|
|
5853
5852
|
/** A layer's tile surface (live while stroking), for thumbnails. */
|
|
5854
5853
|
layerSurface(id) {
|
|
5855
|
-
const l = _optionalChain([
|
|
5854
|
+
const l = _optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _296 => _296.layer]);
|
|
5856
5855
|
return isPixelLayer(l) ? l.surface : null;
|
|
5857
5856
|
}
|
|
5858
5857
|
}, _class10);
|
|
@@ -6076,7 +6075,7 @@ function createPaintStickerTools(c) {
|
|
|
6076
6075
|
properties: {
|
|
6077
6076
|
layerId: LAYER_ID,
|
|
6078
6077
|
id: { type: "string", description: "Sticker id from list_stickers." },
|
|
6079
|
-
stamp: { type: "string", enum: [...
|
|
6078
|
+
stamp: { type: "string", enum: [..._chunk2XS6LTUPcjs.STAMP_KINDS], description: "Another stamp." },
|
|
6080
6079
|
x: { type: "number", description: "Centre x in document pixels." },
|
|
6081
6080
|
y: { type: "number", description: "Centre y in document pixels." },
|
|
6082
6081
|
size: { type: "number", minimum: 2, maximum: 2048, description: "Diameter in pixels." },
|
|
@@ -6373,7 +6372,7 @@ function createPaintGuideTools(c) {
|
|
|
6373
6372
|
type: "object",
|
|
6374
6373
|
properties: {
|
|
6375
6374
|
color: { ...COLOR, description: "A colour #rrggbb." },
|
|
6376
|
-
paint: { ...
|
|
6375
|
+
paint: { ..._chunkQBWEH3IMcjs.PAINT_SOURCE_JSON_SCHEMA, description: "Gradient paint (or a colour) for the swatch, instead of color." },
|
|
6377
6376
|
name: { type: "string", minLength: 1, description: "Optional name." }
|
|
6378
6377
|
},
|
|
6379
6378
|
additionalProperties: false
|
|
@@ -6527,7 +6526,7 @@ function createPaintGuideTools(c) {
|
|
|
6527
6526
|
const pad = c.mixingPad;
|
|
6528
6527
|
return {
|
|
6529
6528
|
content: [
|
|
6530
|
-
{ type: "image", data:
|
|
6529
|
+
{ type: "image", data: _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, _chunkO7LUD7MHcjs.encodePng.call(void 0, pad.width, pad.height, pad.pixels())), mimeType: "image/png" },
|
|
6531
6530
|
{ type: "text", text: `Mixing pad ${pad.width}\xD7${pad.height}` }
|
|
6532
6531
|
]
|
|
6533
6532
|
};
|
|
@@ -6664,7 +6663,7 @@ function createPaintWetTools(c) {
|
|
|
6664
6663
|
type: "object",
|
|
6665
6664
|
properties: {
|
|
6666
6665
|
layerId: LAYER_ID2,
|
|
6667
|
-
kind: { type: "string", enum: [...
|
|
6666
|
+
kind: { type: "string", enum: [..._chunkF2Y4E4GUcjs.WET_FLOW_KINDS], description: "none, linear, swirl, radial or turbulent." },
|
|
6668
6667
|
strength: UNIT("How hard it pushes, 0..1 (1 is about a 25\xB0 tilt; default 0.5)."),
|
|
6669
6668
|
angle: { type: "number", minimum: -360, maximum: 360, description: "linear: direction in degrees clockwise from canvas down (default 0)." },
|
|
6670
6669
|
center: {
|
|
@@ -6828,7 +6827,7 @@ function createPaintReplayTools(c) {
|
|
|
6828
6827
|
await c.wetIdle();
|
|
6829
6828
|
const tl = await c.timeLapse({ frames: a.frames, fps: a.fps, maxSide: a.maxSide, wetStepsPerFrame: a.wetStepsPerFrame, holdMs: a.holdMs });
|
|
6830
6829
|
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);
|
|
6831
|
-
const sheet = contactSheet(pick.map((i) =>
|
|
6830
|
+
const sheet = contactSheet(pick.map((i) => _chunkO7LUD7MHcjs.decodePng.call(void 0, tl.frames[i])), pick.length, 160);
|
|
6832
6831
|
const info = {
|
|
6833
6832
|
frames: tl.frames.length,
|
|
6834
6833
|
fps: tl.fps,
|
|
@@ -6837,9 +6836,9 @@ function createPaintReplayTools(c) {
|
|
|
6837
6836
|
durationMs: tl.durationMs,
|
|
6838
6837
|
ffmpeg: tl.ffmpeg.command,
|
|
6839
6838
|
video: tl.video,
|
|
6840
|
-
...a.includeFrames ? { framesPng: tl.frames.map((f) =>
|
|
6839
|
+
...a.includeFrames ? { framesPng: tl.frames.map((f) => _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, f)) } : {}
|
|
6841
6840
|
};
|
|
6842
|
-
return { content: [{ type: "image", data:
|
|
6841
|
+
return { content: [{ type: "image", data: _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, _chunkO7LUD7MHcjs.encodePng.call(void 0, sheet.width, sheet.height, sheet.data)), mimeType: "image/png" }, { type: "text", text: JSON.stringify(info) }] };
|
|
6843
6842
|
}
|
|
6844
6843
|
},
|
|
6845
6844
|
{
|
|
@@ -6859,8 +6858,8 @@ function createPaintReplayTools(c) {
|
|
|
6859
6858
|
handler: async ({ scale, paper }) => {
|
|
6860
6859
|
await c.wetIdle();
|
|
6861
6860
|
const img = await c.renderHighRes({ scale, paper });
|
|
6862
|
-
const bytes =
|
|
6863
|
-
return { mimeType: "image/png", width: img.width, height: img.height, bytes: bytes.length, data:
|
|
6861
|
+
const bytes = _chunkO7LUD7MHcjs.encodePng.call(void 0, img.width, img.height, img.data);
|
|
6862
|
+
return { mimeType: "image/png", width: img.width, height: img.height, bytes: bytes.length, data: _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, bytes) };
|
|
6864
6863
|
}
|
|
6865
6864
|
}
|
|
6866
6865
|
];
|
|
@@ -6878,7 +6877,7 @@ var TIP = {
|
|
|
6878
6877
|
type: "object",
|
|
6879
6878
|
description: "The tip (the shared brush engine). Missing fields keep their current values.",
|
|
6880
6879
|
properties: {
|
|
6881
|
-
size: { type: "number", minimum: 1, maximum:
|
|
6880
|
+
size: { type: "number", minimum: 1, maximum: _chunkQBWEH3IMcjs.MAX_BRUSH_SIZE, description: "Diameter in document pixels." },
|
|
6882
6881
|
hardness: { type: "number", minimum: 0, maximum: 1, description: "Edge hardness, 0 (soft) .. 1 (hard)." },
|
|
6883
6882
|
spacing: { type: "number", minimum: 0.01, maximum: 10, description: "Dab spacing as a fraction of the diameter (0.05 is smooth, 1 is dotted)." },
|
|
6884
6883
|
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." },
|
|
@@ -6890,7 +6889,7 @@ var TIP = {
|
|
|
6890
6889
|
pressureOpacity: { type: "boolean", description: "Pressure scales the opacity." },
|
|
6891
6890
|
blend: {
|
|
6892
6891
|
type: "string",
|
|
6893
|
-
enum:
|
|
6892
|
+
enum: _chunkO7LUD7MHcjs.BLEND_MODES.map((m) => m.id),
|
|
6894
6893
|
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)."
|
|
6895
6894
|
}
|
|
6896
6895
|
},
|
|
@@ -6923,11 +6922,11 @@ var MIXER = {
|
|
|
6923
6922
|
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." },
|
|
6924
6923
|
loadEachStroke: { type: "boolean", description: "Refill the reservoir with the colour before each stroke." },
|
|
6925
6924
|
cleanEachStroke: { type: "boolean", description: "Empty the pickup well after each stroke." },
|
|
6926
|
-
mixing: { type: "string", enum: [...
|
|
6925
|
+
mixing: { type: "string", enum: [..._chunkQBWEH3IMcjs.MIXING_MODELS], description: "rgb: RGB averages. pigment: mixes like paint (Kubelka-Munk)." }
|
|
6927
6926
|
},
|
|
6928
6927
|
additionalProperties: false
|
|
6929
6928
|
};
|
|
6930
|
-
var MIXING = { type: "string", enum: [...
|
|
6929
|
+
var MIXING = { type: "string", enum: [..._chunkQBWEH3IMcjs.MIXING_MODELS], description: "pigment: mixes like paint (Kubelka-Munk, blue and yellow make green); rgb: straight RGB averages." };
|
|
6931
6930
|
var BEHAVIOR = {
|
|
6932
6931
|
type: "object",
|
|
6933
6932
|
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.",
|
|
@@ -6940,7 +6939,7 @@ var BEHAVIOR = {
|
|
|
6940
6939
|
type: "object",
|
|
6941
6940
|
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.",
|
|
6942
6941
|
properties: {
|
|
6943
|
-
mode: { type: "string", enum: [...
|
|
6942
|
+
mode: { type: "string", enum: [..._chunk2XS6LTUPcjs.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." },
|
|
6944
6943
|
colors: { type: "array", maxItems: 8, items: { ...COLOR2 }, description: "2..8 colours #rrggbb; fewer than 2 uses the paint colour and the secondary colour." },
|
|
6945
6944
|
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)." },
|
|
6946
6945
|
length: { type: "integer", minimum: 1, maximum: 500, description: "dab mode: dabs per colour (default 12)." },
|
|
@@ -6953,7 +6952,7 @@ var BEHAVIOR = {
|
|
|
6953
6952
|
};
|
|
6954
6953
|
var BRUSH_PAINT = {
|
|
6955
6954
|
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.`,
|
|
6956
|
-
anyOf: [
|
|
6955
|
+
anyOf: [_chunkQBWEH3IMcjs.PAINT_GRADIENT_JSON_SCHEMA, { type: "null", description: "No gradient of its own: the editor's paint." }]
|
|
6957
6956
|
};
|
|
6958
6957
|
var BLENDER = {
|
|
6959
6958
|
type: "object",
|
|
@@ -6981,10 +6980,10 @@ var WET_BRUSH = {
|
|
|
6981
6980
|
properties: {
|
|
6982
6981
|
tool: {
|
|
6983
6982
|
type: "string",
|
|
6984
|
-
enum: [...
|
|
6983
|
+
enum: [..._chunk2XS6LTUPcjs.WET_TOOLS],
|
|
6985
6984
|
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)."
|
|
6986
6985
|
},
|
|
6987
|
-
medium: { type: "string", enum: [...
|
|
6986
|
+
medium: { type: "string", enum: [..._chunk2XS6LTUPcjs.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)." },
|
|
6988
6987
|
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)." },
|
|
6989
6988
|
thinner: { type: "number", minimum: 0, maximum: 1, description: "Thinner (water or solvent): more transparent, runnier paint." },
|
|
6990
6989
|
water: { type: "number", minimum: 0, maximum: 1, description: "Wetness: water laid per stroke, 0.2 a damp brush .. 1 a dripping one." },
|
|
@@ -7001,7 +7000,7 @@ var IMPASTO_BRUSH = {
|
|
|
7001
7000
|
properties: {
|
|
7002
7001
|
tool: {
|
|
7003
7002
|
type: "string",
|
|
7004
|
-
enum: [...
|
|
7003
|
+
enum: [..._chunk2XS6LTUPcjs.IMPASTO_TOOLS],
|
|
7005
7004
|
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."
|
|
7006
7005
|
},
|
|
7007
7006
|
thickness: { type: "number", minimum: 0, maximum: 1, description: "How far the paint stands up." },
|
|
@@ -7017,8 +7016,8 @@ var PARTICLE_BRUSH = {
|
|
|
7017
7016
|
type: "object",
|
|
7018
7017
|
description: "Particle engine settings (procedural brushes). Missing fields keep their current values.",
|
|
7019
7018
|
properties: {
|
|
7020
|
-
kind: { type: "string", enum: [...
|
|
7021
|
-
render: { type: "string", enum: [...
|
|
7019
|
+
kind: { type: "string", enum: [..._chunk2XS6LTUPcjs.PARTICLE_KINDS], 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." },
|
|
7020
|
+
render: { type: "string", enum: [..._chunk2XS6LTUPcjs.PARTICLE_RENDERS], description: "dot: a mark at each step; line: each particle draws a continuous line; sequence: beads spaced along each path." },
|
|
7022
7021
|
count: { type: "integer", minimum: 1, maximum: 64, description: "Particles (flow: how many are thrown per tip of travel)." },
|
|
7023
7022
|
size: { type: "number", minimum: 0, maximum: 1, description: "Mark size as a fraction of the tip size." },
|
|
7024
7023
|
spread: { type: "number", minimum: 0, maximum: 1, description: "How far apart the particles start, as a fraction of the tip size." },
|
|
@@ -7048,7 +7047,7 @@ var STICKER_BRUSH = {
|
|
|
7048
7047
|
type: "object",
|
|
7049
7048
|
description: "Sticker engine settings: stamps sprayed along the stroke as editable stickers. Missing fields keep their current values.",
|
|
7050
7049
|
properties: {
|
|
7051
|
-
stamps: { type: "array", minItems: 1, maxItems: 9, items: { type: "string", enum: [...
|
|
7050
|
+
stamps: { type: "array", minItems: 1, maxItems: 9, items: { type: "string", enum: [..._chunk2XS6LTUPcjs.STAMP_KINDS], description: "A stamp." }, description: "The stamps to spray (one picked at random per sticker)." },
|
|
7052
7051
|
density: { type: "number", minimum: 0, maximum: 1, description: "Stickers per distance travelled." },
|
|
7053
7052
|
sizeJitter: { type: "number", minimum: 0, maximum: 1, description: "Random size change." },
|
|
7054
7053
|
rotationJitter: { type: "number", minimum: 0, maximum: 1, description: "Random turn as a fraction of \xB1180\xB0." },
|
|
@@ -7059,16 +7058,16 @@ var STICKER_BRUSH = {
|
|
|
7059
7058
|
};
|
|
7060
7059
|
var BRUSH_FIELDS = {
|
|
7061
7060
|
name: { type: "string", minLength: 1, maxLength: 80, description: "Display name." },
|
|
7062
|
-
category: { type: "string", enum: [...
|
|
7061
|
+
category: { type: "string", enum: [..._chunk2XS6LTUPcjs.PAINT_BRUSH_CATEGORIES], description: "Library category." },
|
|
7063
7062
|
engine: {
|
|
7064
7063
|
type: "string",
|
|
7065
|
-
enum: [...
|
|
7064
|
+
enum: [..._chunk2XS6LTUPcjs.PAINT_BRUSH_ENGINES],
|
|
7066
7065
|
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)."
|
|
7067
7066
|
},
|
|
7068
7067
|
tip: TIP,
|
|
7069
7068
|
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." },
|
|
7070
7069
|
pressureSmoothing: { type: "number", minimum: 0, maximum: 0.95, description: "Pressure smoothing, separate from the tip position smoothing." },
|
|
7071
|
-
rotation: { type: "string", enum: [...
|
|
7070
|
+
rotation: { type: "string", enum: [..._chunk2XS6LTUPcjs.BRUSH_ROTATIONS], description: "What turns the tip: fixed (tip.angle), stroke (follows the direction of travel) or barrel (the pen barrel rotation, twist)." },
|
|
7072
7071
|
dynamics: DYNAMICS,
|
|
7073
7072
|
mixer: MIXER,
|
|
7074
7073
|
loadsColor: { type: "boolean", description: "Mixer engine: load the colour each stroke (false for a mixer that only moves paint)." },
|
|
@@ -7118,7 +7117,7 @@ function brushSummary(b) {
|
|
|
7118
7117
|
size: b.tip.size,
|
|
7119
7118
|
grain: b.grain,
|
|
7120
7119
|
rotation: b.rotation,
|
|
7121
|
-
wetCapable:
|
|
7120
|
+
wetCapable: _chunk2XS6LTUPcjs.isWetCapable.call(void 0, b),
|
|
7122
7121
|
pickup: b.behavior.pickup,
|
|
7123
7122
|
dirty: b.behavior.dirty,
|
|
7124
7123
|
multicolor: b.behavior.multicolor.mode,
|
|
@@ -7161,7 +7160,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7161
7160
|
strokes: d.strokes.length,
|
|
7162
7161
|
undo: s.undoLabel,
|
|
7163
7162
|
redo: s.redoLabel,
|
|
7164
|
-
blendModes:
|
|
7163
|
+
blendModes: _chunkO7LUD7MHcjs.BLEND_MODES.map((m) => m.id),
|
|
7165
7164
|
wet: s.wet.wet,
|
|
7166
7165
|
lighting: c.getLighting()
|
|
7167
7166
|
};
|
|
@@ -7210,9 +7209,9 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7210
7209
|
inputSchema: EMPTY3,
|
|
7211
7210
|
annotations: { title: "List papers", ...READ6 },
|
|
7212
7211
|
handler: () => ({
|
|
7213
|
-
papers:
|
|
7214
|
-
families: [...
|
|
7215
|
-
patterns: [...
|
|
7212
|
+
papers: _chunk2XS6LTUPcjs.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 })),
|
|
7213
|
+
families: [..._chunk2XS6LTUPcjs.PAPER_FAMILIES],
|
|
7214
|
+
patterns: [..._chunk2XS6LTUPcjs.GRAIN_PATTERNS]
|
|
7216
7215
|
})
|
|
7217
7216
|
});
|
|
7218
7217
|
add({
|
|
@@ -7243,7 +7242,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7243
7242
|
depth: { type: "number", minimum: 0, maximum: 1, description: "Grain depth 0..1 (0: brushes ignore the grain)." },
|
|
7244
7243
|
scale: { type: "number", minimum: 0.25, maximum: 8, description: "Grain scale: 1 natural, 2 twice as coarse." },
|
|
7245
7244
|
seed: { type: "integer", minimum: 0, description: "Grain seed: another sheet of the same paper." },
|
|
7246
|
-
pattern: { type: "string", enum: [...
|
|
7245
|
+
pattern: { type: "string", enum: [..._chunk2XS6LTUPcjs.GRAIN_PATTERNS], description: "Grain pattern." },
|
|
7247
7246
|
tiling: { type: "string", enum: ["repeat", "mirror"], description: "How the grain tile repeats (mirror hides seams)." },
|
|
7248
7247
|
shading: { type: "number", minimum: 0, maximum: 1, description: "How much the grain shades the paper colour." },
|
|
7249
7248
|
dry: { ...tuning, description: "Height map tuning for dry media." },
|
|
@@ -7297,7 +7296,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7297
7296
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0..1." },
|
|
7298
7297
|
blend: {
|
|
7299
7298
|
type: "string",
|
|
7300
|
-
enum: [...
|
|
7299
|
+
enum: [..._chunkO7LUD7MHcjs.BLEND_MODES.map((m) => m.id), "pass-through"],
|
|
7301
7300
|
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."
|
|
7302
7301
|
},
|
|
7303
7302
|
clipped: { type: "boolean", description: "Clip to the layer below (paint only shows where it has paint)." },
|
|
@@ -7326,12 +7325,12 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7326
7325
|
inputSchema: EMPTY3,
|
|
7327
7326
|
annotations: { title: "List blend modes", ...READ6 },
|
|
7328
7327
|
handler: () => ({
|
|
7329
|
-
modes:
|
|
7328
|
+
modes: _chunkO7LUD7MHcjs.BLEND_MODES.map((m) => ({
|
|
7330
7329
|
id: m.id,
|
|
7331
7330
|
label: m.label,
|
|
7332
7331
|
group: m.painterly ? "painterly" : m.id === "pigment" ? "pigment" : "standard",
|
|
7333
7332
|
...m.description ? { description: m.description } : {},
|
|
7334
|
-
psd:
|
|
7333
|
+
psd: _chunkO7LUD7MHcjs.standardBlendMode.call(void 0, m.id)
|
|
7335
7334
|
}))
|
|
7336
7335
|
})
|
|
7337
7336
|
});
|
|
@@ -7399,7 +7398,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7399
7398
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Opacity 0..1 (default 1)." },
|
|
7400
7399
|
grain: { type: "number", minimum: 0, maximum: 1, description: "Paper grain response 0..1 (default 0: flat)." },
|
|
7401
7400
|
pressure: { type: "number", minimum: 0, maximum: 1, description: "With grain: how far into the valleys, 0..1 (default 0.5)." },
|
|
7402
|
-
blend: { type: "string", enum:
|
|
7401
|
+
blend: { type: "string", enum: _chunkO7LUD7MHcjs.BLEND_MODES.map((m) => m.id), description: "Blend mode (default normal; pigment mixes like paint, watercolor glazes; see list_blend_modes)." }
|
|
7403
7402
|
},
|
|
7404
7403
|
additionalProperties: false
|
|
7405
7404
|
},
|
|
@@ -7433,10 +7432,10 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7433
7432
|
annotations: { title: "Get a brush", ...READ6 },
|
|
7434
7433
|
handler: ({ id }) => {
|
|
7435
7434
|
const st = c.getState();
|
|
7436
|
-
if (id === void 0) return { ...
|
|
7435
|
+
if (id === void 0) return { ..._chunk2XS6LTUPcjs.brushToJSON.call(void 0, st.brush), strokePaint: _nullishCoalesce(st.brush.paint, () => ( st.paint)) };
|
|
7437
7436
|
const b = c.getBrush(id);
|
|
7438
7437
|
if (!b) throw new Error(`Unknown brush "${id}". Call list_brushes for the ids.`);
|
|
7439
|
-
return { ...
|
|
7438
|
+
return { ..._chunk2XS6LTUPcjs.brushToJSON.call(void 0, b), builtin: Boolean(b.builtin), strokePaint: _nullishCoalesce(b.paint, () => ( st.paint)) };
|
|
7440
7439
|
}
|
|
7441
7440
|
});
|
|
7442
7441
|
add({
|
|
@@ -7445,7 +7444,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7445
7444
|
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.",
|
|
7446
7445
|
inputSchema: { type: "object", properties: { id: { type: "string", description: "Brush id from list_brushes to start from." }, ...BRUSH_FIELDS }, additionalProperties: false },
|
|
7447
7446
|
annotations: { title: "Set the brush", ...SET4 },
|
|
7448
|
-
handler: (a) =>
|
|
7447
|
+
handler: (a) => _chunk2XS6LTUPcjs.brushToJSON.call(void 0, c.setBrush(a))
|
|
7449
7448
|
});
|
|
7450
7449
|
add({
|
|
7451
7450
|
name: "save_brush",
|
|
@@ -7461,7 +7460,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7461
7460
|
additionalProperties: false
|
|
7462
7461
|
},
|
|
7463
7462
|
annotations: { title: "Save a brush", ...SET4 },
|
|
7464
|
-
handler: ({ id, name }) =>
|
|
7463
|
+
handler: ({ id, name }) => _chunk2XS6LTUPcjs.brushToJSON.call(void 0, c.saveBrush({ id, name }))
|
|
7465
7464
|
});
|
|
7466
7465
|
add({
|
|
7467
7466
|
name: "remove_brush",
|
|
@@ -7521,7 +7520,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7521
7520
|
const t = c.brushThumbnail(_nullishCoalesce(id, () => ( c.getState().brush.id)), { width, height, color });
|
|
7522
7521
|
return {
|
|
7523
7522
|
content: [
|
|
7524
|
-
{ type: "image", data:
|
|
7523
|
+
{ type: "image", data: _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, _chunkO7LUD7MHcjs.encodePng.call(void 0, t.width, t.height, t.data)), mimeType: "image/png" },
|
|
7525
7524
|
{ type: "text", text: `Brush ${_nullishCoalesce(id, () => ( c.getState().brush.id))} ${t.width}\xD7${t.height}` }
|
|
7526
7525
|
]
|
|
7527
7526
|
};
|
|
@@ -7548,7 +7547,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7548
7547
|
name: "set_paint",
|
|
7549
7548
|
title: "Set the paint (colour or gradient)",
|
|
7550
7549
|
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. set_color goes back to one colour. Editor state, not an undo step. Returns paint, color and secondaryColor.',
|
|
7551
|
-
inputSchema: { type: "object", properties: { paint:
|
|
7550
|
+
inputSchema: { type: "object", properties: { paint: _chunkQBWEH3IMcjs.PAINT_SOURCE_JSON_SCHEMA }, required: ["paint"], additionalProperties: false },
|
|
7552
7551
|
annotations: { title: "Set the paint (colour or gradient)", ...SET4 },
|
|
7553
7552
|
handler: ({ paint }) => {
|
|
7554
7553
|
const p = c.setPaint(paint);
|
|
@@ -7609,7 +7608,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7609
7608
|
brushId: { type: "string", description: "Brush id from list_brushes (default the active brush)." },
|
|
7610
7609
|
brush: { type: "object", description: "Brush changes for this stroke only.", properties: BRUSH_FIELDS, additionalProperties: false },
|
|
7611
7610
|
color: { ...COLOR2, description: "Paint colour #rrggbb (default the paint colour)." },
|
|
7612
|
-
paint: { ...
|
|
7611
|
+
paint: { ..._chunkQBWEH3IMcjs.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." },
|
|
7613
7612
|
seed: { type: "integer", minimum: 0, description: "Jitter seed (default a new one); the same seed and points give the same marks." },
|
|
7614
7613
|
snapToPerspective: { type: "boolean", description: "Snap the points to the perspective guide, as a pen stroke would (default false)." }
|
|
7615
7614
|
},
|
|
@@ -7790,7 +7789,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7790
7789
|
annotations: { title: "Export the painting", ...READ6 },
|
|
7791
7790
|
handler: async ({ format, quality, scale, paper }) => {
|
|
7792
7791
|
const bytes = await c.exportImage({ format, quality, scale, paper });
|
|
7793
|
-
return { mimeType: _nullishCoalesce(format, () => ( "image/png")), bytes: bytes.length, data:
|
|
7792
|
+
return { mimeType: _nullishCoalesce(format, () => ( "image/png")), bytes: bytes.length, data: _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, bytes) };
|
|
7794
7793
|
}
|
|
7795
7794
|
});
|
|
7796
7795
|
add({
|
|
@@ -7801,7 +7800,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7801
7800
|
annotations: { title: "Export as PSD", ...READ6 },
|
|
7802
7801
|
handler: () => {
|
|
7803
7802
|
const r = c.exportPsd();
|
|
7804
|
-
return { data:
|
|
7803
|
+
return { data: _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, r.bytes), bytes: r.bytes.length, psb: r.psb, warnings: r.warnings };
|
|
7805
7804
|
}
|
|
7806
7805
|
});
|
|
7807
7806
|
add({
|
|
@@ -7829,7 +7828,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7829
7828
|
tools.push(...createPaintThickTools(c));
|
|
7830
7829
|
tools.push(...createPaintReplayTools(c));
|
|
7831
7830
|
tools.push(...createPaintStickerTools(c));
|
|
7832
|
-
tools.push(...
|
|
7831
|
+
tools.push(..._chunkF2Y4E4GUcjs.createPigmentTools.call(void 0, ));
|
|
7833
7832
|
return { id: _nullishCoalesce(options.id, () => ( "paint-editor")), namespace: options.namespace, tools };
|
|
7834
7833
|
}
|
|
7835
7834
|
|
|
@@ -8024,11 +8023,11 @@ var PaintCanvasPresenter = (_class12 = class {
|
|
|
8024
8023
|
const key = `${tx},${ty}`;
|
|
8025
8024
|
if (this.uploaded.get(key) === data) return;
|
|
8026
8025
|
this.uploaded.set(key, data);
|
|
8027
|
-
if (!this.scratch) this.scratch = ctx.createImageData(
|
|
8026
|
+
if (!this.scratch) this.scratch = ctx.createImageData(_chunkO7LUD7MHcjs.TILE, _chunkO7LUD7MHcjs.TILE);
|
|
8028
8027
|
this.scratch.data.set(data);
|
|
8029
|
-
const ox = tx *
|
|
8030
|
-
const oy = ty *
|
|
8031
|
-
ctx.putImageData(this.scratch, ox, oy, 0, 0, Math.min(
|
|
8028
|
+
const ox = tx * _chunkO7LUD7MHcjs.TILE;
|
|
8029
|
+
const oy = ty * _chunkO7LUD7MHcjs.TILE;
|
|
8030
|
+
ctx.putImageData(this.scratch, ox, oy, 0, 0, Math.min(_chunkO7LUD7MHcjs.TILE, width - ox), Math.min(_chunkO7LUD7MHcjs.TILE, height - oy));
|
|
8032
8031
|
drawn++;
|
|
8033
8032
|
}, { dirty });
|
|
8034
8033
|
return drawn;
|
|
@@ -8116,8 +8115,8 @@ function wheelPick(dx, dy, wheel, color) {
|
|
|
8116
8115
|
return rgbToHexColor(nr, ng, nb);
|
|
8117
8116
|
}
|
|
8118
8117
|
var BLEND_MENU_GROUPS = [
|
|
8119
|
-
{ label: "Standard", modes:
|
|
8120
|
-
{ label: "Paint", modes:
|
|
8118
|
+
{ label: "Standard", modes: _chunkO7LUD7MHcjs.BLEND_MODES.filter((m) => !m.painterly && m.id !== "pigment") },
|
|
8119
|
+
{ label: "Paint", modes: _chunkO7LUD7MHcjs.BLEND_MODES.filter((m) => m.painterly || m.id === "pigment") }
|
|
8121
8120
|
];
|
|
8122
8121
|
var PICKUP_SLIDERS = [
|
|
8123
8122
|
{ path: "behavior.pickup", label: "Pick-up", min: 0, max: 1, step: 0.01 },
|
|
@@ -8338,10 +8337,10 @@ function drawWaterOverlay(controller, ctx) {
|
|
|
8338
8337
|
if (!controller.getState().wet.overlay) return 0;
|
|
8339
8338
|
const tiles = controller.waterOverlayTiles({ x: 0, y: 0, width, height });
|
|
8340
8339
|
if (!tiles.length) return 0;
|
|
8341
|
-
const img = ctx.createImageData(
|
|
8340
|
+
const img = ctx.createImageData(_chunkO7LUD7MHcjs.TILE, _chunkO7LUD7MHcjs.TILE);
|
|
8342
8341
|
for (const t of tiles) {
|
|
8343
8342
|
img.data.set(t.data);
|
|
8344
|
-
ctx.putImageData(img, t.tx *
|
|
8343
|
+
ctx.putImageData(img, t.tx * _chunkO7LUD7MHcjs.TILE, t.ty * _chunkO7LUD7MHcjs.TILE, 0, 0, Math.min(_chunkO7LUD7MHcjs.TILE, width - t.tx * _chunkO7LUD7MHcjs.TILE), Math.min(_chunkO7LUD7MHcjs.TILE, height - t.ty * _chunkO7LUD7MHcjs.TILE));
|
|
8345
8344
|
}
|
|
8346
8345
|
return tiles.length;
|
|
8347
8346
|
}
|
|
@@ -8508,7 +8507,7 @@ function createPaintEffectsToolProvider(controller, options = {}) {
|
|
|
8508
8507
|
name: { type: "string", minLength: 1, description: "The layer name (default: the effect's name)." },
|
|
8509
8508
|
aboveId: { type: "string", minLength: 1, description: "Put it directly above this layer (default: above the active layer, else on top)." },
|
|
8510
8509
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0\u20131 (default 1)." },
|
|
8511
|
-
blend: { type: "string", enum:
|
|
8510
|
+
blend: { type: "string", enum: _chunkO7LUD7MHcjs.BLEND_MODES.map((m) => m.id), description: "Layer blend mode (default normal); screen or linear-dodge for light, multiply for textures." },
|
|
8512
8511
|
time: { type: "number", minimum: 0, description: "Which moment of an animated effect to draw, in ms (default 0)." }
|
|
8513
8512
|
},
|
|
8514
8513
|
required: ["effect"],
|
|
@@ -8848,5 +8847,5 @@ function createPaintEffectsToolProvider(controller, options = {}) {
|
|
|
8848
8847
|
|
|
8849
8848
|
|
|
8850
8849
|
|
|
8851
|
-
exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkJ5BA3BQ6cjs.BLEND_MODES; exports.BRUSH_ID = _chunkW4LNKTHTcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunkW4LNKTHTcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunkW4LNKTHTcjs.BUILTIN_BRUSHES; exports.BristleStroke = _chunkW4LNKTHTcjs.BristleStroke; exports.DEFAULT_BEHAVIOR = _chunkW4LNKTHTcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunkW4LNKTHTcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunkW4LNKTHTcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunkW4LNKTHTcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkFHPVDTI2cjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunkW4LNKTHTcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunkW4LNKTHTcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunk6GFRKLLScjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunk6GFRKLLScjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunkW4LNKTHTcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunkW4LNKTHTcjs.DEFAULT_PARTICLE; exports.DEFAULT_STICKER = _chunkW4LNKTHTcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunkW4LNKTHTcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkFHPVDTI2cjs.DEFAULT_WET_PARAMS; exports.DryStroke = _chunkW4LNKTHTcjs.DryStroke; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunkW4LNKTHTcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunkW4LNKTHTcjs.GRAIN_TILE; exports.HARMONY_KINDS = HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunkW4LNKTHTcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunkW4LNKTHTcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunk6GFRKLLScjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; 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 = _chunkW4LNKTHTcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkJ5BA3BQ6cjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunkW4LNKTHTcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunkW4LNKTHTcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunk6GFRKLLScjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunk6GFRKLLScjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunk6GFRKLLScjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunk6GFRKLLScjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunk6GFRKLLScjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunk6GFRKLLScjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunk6GFRKLLScjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunk6GFRKLLScjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunk6GFRKLLScjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunk6GFRKLLScjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunk6GFRKLLScjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SOURCE_JSON_SCHEMA = _chunk6GFRKLLScjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunkW4LNKTHTcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunkW4LNKTHTcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunkW4LNKTHTcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunkW4LNKTHTcjs.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 = _chunk6GFRKLLScjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunk6GFRKLLScjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunkW4LNKTHTcjs.PaperGrain; exports.ParticleStroke = _chunkW4LNKTHTcjs.ParticleStroke; exports.PenDabWalker = _chunkW4LNKTHTcjs.PenDabWalker; exports.PenSmoother = _chunkW4LNKTHTcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunkW4LNKTHTcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerSpray = _chunkW4LNKTHTcjs.StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunkW4LNKTHTcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkFHPVDTI2cjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunkW4LNKTHTcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkFHPVDTI2cjs.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 = _chunkW4LNKTHTcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunk6GFRKLLScjs.addPaintGradientStop; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunkW4LNKTHTcjs.brushTakesPaint; exports.brushToJSON = _chunkW4LNKTHTcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunkW4LNKTHTcjs.clonePaper; exports.colorHarmony = colorHarmony; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; 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 = _chunkW4LNKTHTcjs.drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectLayersToJSON = effectLayersToJSON; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunkW4LNKTHTcjs.grainCatch; exports.grainHeights = _chunkW4LNKTHTcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunk6GFRKLLScjs.hash2; exports.hexToPaintRgb = _chunk6GFRKLLScjs.hexToPaintRgb; exports.hexToRgb8 = _chunkW4LNKTHTcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkJ5BA3BQ6cjs.isBlendMode; exports.isGradientPaint = _chunk6GFRKLLScjs.isGradientPaint; exports.isPainterlyBlendMode = _chunkJ5BA3BQ6cjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunkW4LNKTHTcjs.isWetBrush; exports.isWetCapable = _chunkW4LNKTHTcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunk6GFRKLLScjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunkW4LNKTHTcjs.mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.multiColorToPaint = _chunkW4LNKTHTcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunkW4LNKTHTcjs.normalizeBehavior; exports.normalizeBristle = _chunkW4LNKTHTcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunkW4LNKTHTcjs.normalizeDynamics; exports.normalizeFlow = _chunkFHPVDTI2cjs.normalizeFlow; exports.normalizeHexColor = _chunk6GFRKLLScjs.normalizeHexColor; exports.normalizeImpasto = _chunkW4LNKTHTcjs.normalizeImpasto; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunkW4LNKTHTcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunkW4LNKTHTcjs.normalizePaintBrush; exports.normalizePaper = _chunkW4LNKTHTcjs.normalizePaper; exports.normalizeParticle = _chunkW4LNKTHTcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunkW4LNKTHTcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = _chunkW4LNKTHTcjs.normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunkW4LNKTHTcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkFHPVDTI2cjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintGradientMappingFor = _chunk6GFRKLLScjs.paintGradientMappingFor; exports.paintSourceColor = _chunk6GFRKLLScjs.paintSourceColor; exports.paintSourceCss = _chunk6GFRKLLScjs.paintSourceCss; exports.paintToMultiColor = _chunkW4LNKTHTcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunkW4LNKTHTcjs.paperPreset; exports.parseBrushLibrary = _chunkW4LNKTHTcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunk6GFRKLLScjs.parsePaintSource; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunkW4LNKTHTcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunk6GFRKLLScjs.rand01; exports.randSigned = _chunkW4LNKTHTcjs.randSigned; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunk6GFRKLLScjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunk6GFRKLLScjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunkW4LNKTHTcjs.renderPaper; exports.renderStickers = _chunkW4LNKTHTcjs.renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunk6GFRKLLScjs.resolvePaintGradient; exports.reversePaintGradient = _chunk6GFRKLLScjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunk6GFRKLLScjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunkW4LNKTHTcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunk6GFRKLLScjs.solidPaint; exports.stampCoverage = _chunkW4LNKTHTcjs.stampCoverage; exports.standardBlendMode = _chunkJ5BA3BQ6cjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerRect = _chunkW4LNKTHTcjs.stickerRect; exports.stickerSurface = _chunkW4LNKTHTcjs.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 = _chunkW4LNKTHTcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunkW4LNKTHTcjs.toStrokePoint; exports.toggleStamp = toggleStamp; exports.updatePaintGradientStop = _chunk6GFRKLLScjs.updatePaintGradientStop; exports.usesPaintExchange = _chunkW4LNKTHTcjs.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 = _chunkFHPVDTI2cjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = wheelToHue;
|
|
8850
|
+
exports.BLEND_MENU_GROUPS = BLEND_MENU_GROUPS; exports.BLEND_MODES = _chunkO7LUD7MHcjs.BLEND_MODES; exports.BRUSH_ID = _chunk2XS6LTUPcjs.BRUSH_ID; exports.BRUSH_ROTATIONS = _chunk2XS6LTUPcjs.BRUSH_ROTATIONS; exports.BRUSH_SLIDERS = BRUSH_SLIDERS; exports.BUILTIN_BRUSHES = _chunk2XS6LTUPcjs.BUILTIN_BRUSHES; exports.BristleStroke = _chunk2XS6LTUPcjs.BristleStroke; exports.DEFAULT_BEHAVIOR = _chunk2XS6LTUPcjs.DEFAULT_BEHAVIOR; exports.DEFAULT_BRISTLE = _chunk2XS6LTUPcjs.DEFAULT_BRISTLE; exports.DEFAULT_BRUSH_ID = _chunk2XS6LTUPcjs.DEFAULT_BRUSH_ID; exports.DEFAULT_DPI = DEFAULT_DPI; exports.DEFAULT_DYNAMICS = _chunk2XS6LTUPcjs.DEFAULT_DYNAMICS; exports.DEFAULT_FLOW = _chunkF2Y4E4GUcjs.DEFAULT_FLOW; exports.DEFAULT_IMPASTO = _chunk2XS6LTUPcjs.DEFAULT_IMPASTO; exports.DEFAULT_LIGHTING = DEFAULT_LIGHTING; exports.DEFAULT_MULTI_COLOR = _chunk2XS6LTUPcjs.DEFAULT_MULTI_COLOR; exports.DEFAULT_PAINT_GRADIENT = _chunkQBWEH3IMcjs.DEFAULT_PAINT_GRADIENT; exports.DEFAULT_PAINT_GRADIENT_MAPPING = _chunkQBWEH3IMcjs.DEFAULT_PAINT_GRADIENT_MAPPING; exports.DEFAULT_PAPER = _chunk2XS6LTUPcjs.DEFAULT_PAPER; exports.DEFAULT_PARTICLE = _chunk2XS6LTUPcjs.DEFAULT_PARTICLE; exports.DEFAULT_STICKER = _chunk2XS6LTUPcjs.DEFAULT_STICKER; exports.DEFAULT_SWATCHES = DEFAULT_SWATCHES; exports.DEFAULT_VIEW = DEFAULT_VIEW; exports.DEFAULT_WET_BRUSH = _chunk2XS6LTUPcjs.DEFAULT_WET_BRUSH; exports.DEFAULT_WET_PARAMS = _chunkF2Y4E4GUcjs.DEFAULT_WET_PARAMS; exports.DryStroke = _chunk2XS6LTUPcjs.DryStroke; exports.GPU_LEAD = GPU_LEAD; exports.GRAIN_PATTERNS = _chunk2XS6LTUPcjs.GRAIN_PATTERNS; exports.GRAIN_TILE = _chunk2XS6LTUPcjs.GRAIN_TILE; exports.HARMONY_KINDS = HARMONY_KINDS; exports.IDENTITY_AFFINE = IDENTITY_AFFINE; exports.IDENTITY_COPY = _chunk2XS6LTUPcjs.IDENTITY_COPY; exports.IMPASTO_TOOLS = _chunk2XS6LTUPcjs.IMPASTO_TOOLS; exports.IMPASTO_TOOL_LABELS = IMPASTO_TOOL_LABELS; exports.LIGHT_SLIDERS = LIGHT_SLIDERS; exports.LitCache = LitCache; exports.MAX_BRUSH_SIZE = _chunkQBWEH3IMcjs.MAX_BRUSH_SIZE; exports.MAX_CANVAS_SIDE = MAX_CANVAS_SIDE; exports.MAX_COORDINATE = MAX_COORDINATE; exports.MAX_IMAGE_SIDE = MAX_IMAGE_SIDE; 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 = _chunk2XS6LTUPcjs.MULTI_COLOR_MODES; exports.MixingPad = MixingPad; exports.PAD_SAMPLE_SIZES = PAD_SAMPLE_SIZES; exports.PAINTERLY_BLEND_MODES = _chunkO7LUD7MHcjs.PAINTERLY_BLEND_MODES; exports.PAINT_BRUSH_CATEGORIES = _chunk2XS6LTUPcjs.PAINT_BRUSH_CATEGORIES; exports.PAINT_BRUSH_ENGINES = _chunk2XS6LTUPcjs.PAINT_BRUSH_ENGINES; exports.PAINT_COLOR_JSON_SCHEMA = _chunkQBWEH3IMcjs.PAINT_COLOR_JSON_SCHEMA; exports.PAINT_EFFECT_PLACES = PAINT_EFFECT_PLACES; exports.PAINT_FORMAT = PAINT_FORMAT; exports.PAINT_GRADIENT_FULL_SPEED = _chunkQBWEH3IMcjs.PAINT_GRADIENT_FULL_SPEED; exports.PAINT_GRADIENT_JSON_SCHEMA = _chunkQBWEH3IMcjs.PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_GRADIENT_KIT = _chunkQBWEH3IMcjs.PAINT_GRADIENT_KIT; exports.PAINT_GRADIENT_MAPPINGS = _chunkQBWEH3IMcjs.PAINT_GRADIENT_MAPPINGS; exports.PAINT_GRADIENT_MAPPING_LABELS = _chunkQBWEH3IMcjs.PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_PRESETS = _chunkQBWEH3IMcjs.PAINT_GRADIENT_PRESETS; exports.PAINT_GRADIENT_REPEATS = _chunkQBWEH3IMcjs.PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_REPEAT_LABELS = _chunkQBWEH3IMcjs.PAINT_GRADIENT_REPEAT_LABELS; exports.PAINT_GRADIENT_SPACES = _chunkQBWEH3IMcjs.PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_SPACE_LABELS = _chunkQBWEH3IMcjs.PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_SCHEMA_VERSION = PAINT_SCHEMA_VERSION; exports.PAINT_SOURCE_JSON_SCHEMA = _chunkQBWEH3IMcjs.PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_TOOLS = PAINT_TOOLS; exports.PAPER_EFFECT_BLENDS = PAPER_EFFECT_BLENDS; exports.PAPER_EFFECT_NODE_ID = PAPER_EFFECT_NODE_ID; exports.PAPER_FAMILIES = _chunk2XS6LTUPcjs.PAPER_FAMILIES; exports.PAPER_LIBRARY = _chunk2XS6LTUPcjs.PAPER_LIBRARY; exports.PAPER_NODE_ID = PAPER_NODE_ID; exports.PAPER_SLIDERS = PAPER_SLIDERS; exports.PAPER_TARGET = PAPER_TARGET; exports.PARTICLE_KINDS = _chunk2XS6LTUPcjs.PARTICLE_KINDS; exports.PARTICLE_KIND_LABELS = PARTICLE_KIND_LABELS; exports.PARTICLE_RENDERS = _chunk2XS6LTUPcjs.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 = _chunkQBWEH3IMcjs.PaintGradientSampler; exports.PaintPresence = PaintPresence; exports.PaintSourceError = _chunkQBWEH3IMcjs.PaintSourceError; exports.PaintStrokeSession = PaintStrokeSession; exports.PaintWetLayers = PaintWetLayers; exports.PaperGrain = _chunk2XS6LTUPcjs.PaperGrain; exports.ParticleStroke = _chunk2XS6LTUPcjs.ParticleStroke; exports.PenDabWalker = _chunk2XS6LTUPcjs.PenDabWalker; exports.PenSmoother = _chunk2XS6LTUPcjs.PenSmoother; exports.PerspectiveSnapper = PerspectiveSnapper; exports.SNAP_DECIDE_DISTANCE = SNAP_DECIDE_DISTANCE; exports.STAMP_KINDS = _chunk2XS6LTUPcjs.STAMP_KINDS; exports.STAMP_LABELS = STAMP_LABELS; exports.STENCIL_KINDS = STENCIL_KINDS; exports.STENCIL_SHAPES = STENCIL_SHAPES; exports.STICKER_SLIDERS = STICKER_SLIDERS; exports.SYMMETRY_MODES = SYMMETRY_MODES; exports.StencilSnapper = StencilSnapper; exports.StickerSpray = _chunk2XS6LTUPcjs.StickerSpray; exports.TRACING_NODE_ID = TRACING_NODE_ID; exports.ThickStrokeDriver = ThickStrokeDriver; exports.TileableNoise = _chunk2XS6LTUPcjs.TileableNoise; exports.WET_FLOW_KINDS = _chunkF2Y4E4GUcjs.WET_FLOW_KINDS; exports.WET_GPU_MODES = WET_GPU_MODES; exports.WET_GPU_OPTIONS = WET_GPU_OPTIONS; exports.WET_MEDIA = _chunk2XS6LTUPcjs.WET_MEDIA; exports.WET_MEDIUM_LABELS = WET_MEDIUM_LABELS; exports.WET_MEDIUM_PARAMS = WET_MEDIUM_PARAMS; exports.WET_PARAM_KEYS = _chunkF2Y4E4GUcjs.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 = _chunk2XS6LTUPcjs.WET_TOOLS; exports.WET_TOOL_LABELS = WET_TOOL_LABELS; exports.WetStrokeDriver = WetStrokeDriver; exports.addPaintGradientStop = _chunkQBWEH3IMcjs.addPaintGradientStop; exports.affineCopy = affineCopy; exports.applyAffine = applyAffine; exports.brushEngineControls = brushEngineControls; exports.brushLoadColor = brushLoadColor; exports.brushLoadForStroke = brushLoadForStroke; exports.brushTakesPaint = _chunk2XS6LTUPcjs.brushTakesPaint; exports.brushToJSON = _chunk2XS6LTUPcjs.brushToJSON; exports.buildTimeLapse = buildTimeLapse; exports.checkPaintEffectPlace = checkPaintEffectPlace; exports.clonePaper = _chunk2XS6LTUPcjs.clonePaper; exports.colorHarmony = colorHarmony; exports.composeAffine = composeAffine; exports.contactSheet = contactSheet; exports.createPaintCompositor = createPaintCompositor; exports.createPaintDocument = createPaintDocument; 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 = _chunk2XS6LTUPcjs.drawSticker; exports.drawWaterOverlay = drawWaterOverlay; exports.effectLayersToJSON = effectLayersToJSON; exports.emptiedLayers = emptiedLayers; exports.emptyThickChannels = emptyThickChannels; exports.fitZoom = fitZoom; exports.grainCatch = _chunk2XS6LTUPcjs.grainCatch; exports.grainHeights = _chunk2XS6LTUPcjs.grainHeights; exports.guideOverlay = guideOverlay; exports.handlePaintShortcut = handlePaintShortcut; exports.hash2 = _chunkQBWEH3IMcjs.hash2; exports.hexToPaintRgb = _chunkQBWEH3IMcjs.hexToPaintRgb; exports.hexToRgb8 = _chunk2XS6LTUPcjs.hexToRgb8; exports.hslToRgb = hslToRgb; exports.hsvToRgb = hsvToRgb; exports.hueToWheel = hueToWheel; exports.invertAffine = invertAffine; exports.isBlendMode = _chunkO7LUD7MHcjs.isBlendMode; exports.isGradientPaint = _chunkQBWEH3IMcjs.isGradientPaint; exports.isPainterlyBlendMode = _chunkO7LUD7MHcjs.isPainterlyBlendMode; exports.isPalmTouch = isPalmTouch; exports.isWetBrush = _chunk2XS6LTUPcjs.isWetBrush; exports.isWetCapable = _chunk2XS6LTUPcjs.isWetCapable; exports.lightTile = lightTile; exports.lightingKey = lightingKey; exports.mapPenPoint = mapPenPoint; exports.mix32 = _chunkQBWEH3IMcjs.mix32; exports.mixPixels = mixPixels; exports.mixerLoadForStroke = mixerLoadForStroke; exports.mixerTip = _chunk2XS6LTUPcjs.mixerTip; exports.multiColorForDab = multiColorForDab; exports.multiColorGradient = multiColorGradient; exports.multiColorPalette = multiColorPalette; exports.multiColorSliders = multiColorSliders; exports.multiColorToPaint = _chunk2XS6LTUPcjs.multiColorToPaint; exports.newPaintLayerId = newPaintLayerId; exports.nextPaperEffectVersion = nextPaperEffectVersion; exports.normalizeBehavior = _chunk2XS6LTUPcjs.normalizeBehavior; exports.normalizeBristle = _chunk2XS6LTUPcjs.normalizeBristle; exports.normalizeBrushStroke = normalizeBrushStroke; exports.normalizeCanvas = normalizeCanvas; exports.normalizeDynamics = _chunk2XS6LTUPcjs.normalizeDynamics; exports.normalizeFlow = _chunkF2Y4E4GUcjs.normalizeFlow; exports.normalizeHexColor = _chunkQBWEH3IMcjs.normalizeHexColor; exports.normalizeImpasto = _chunk2XS6LTUPcjs.normalizeImpasto; exports.normalizeLighting = normalizeLighting; exports.normalizeMultiColor = _chunk2XS6LTUPcjs.normalizeMultiColor; exports.normalizePaintBrush = _chunk2XS6LTUPcjs.normalizePaintBrush; exports.normalizePaper = _chunk2XS6LTUPcjs.normalizePaper; exports.normalizeParticle = _chunk2XS6LTUPcjs.normalizeParticle; exports.normalizePerspective = normalizePerspective; exports.normalizeRotation = normalizeRotation; exports.normalizeStencil = normalizeStencil; exports.normalizeStickerSettings = _chunk2XS6LTUPcjs.normalizeStickerSettings; exports.normalizeStickerUpdate = _chunk2XS6LTUPcjs.normalizeStickerUpdate; exports.normalizeSymmetry = normalizeSymmetry; exports.normalizeView = normalizeView; exports.normalizeWetBrush = _chunk2XS6LTUPcjs.normalizeWetBrush; exports.normalizeWetParams = _chunkF2Y4E4GUcjs.normalizeWetParams; exports.overPixels = overPixels; exports.padSampleRadius = padSampleRadius; exports.paintGradientMappingFor = _chunkQBWEH3IMcjs.paintGradientMappingFor; exports.paintSourceColor = _chunkQBWEH3IMcjs.paintSourceColor; exports.paintSourceCss = _chunkQBWEH3IMcjs.paintSourceCss; exports.paintToMultiColor = _chunk2XS6LTUPcjs.paintToMultiColor; exports.paperEffectFromJSON = paperEffectFromJSON; exports.paperEffectToJSON = paperEffectToJSON; exports.paperGrain = paperGrain; exports.paperKey = paperKey; exports.paperNode = paperNode; exports.paperPreset = _chunk2XS6LTUPcjs.paperPreset; exports.parseBrushLibrary = _chunk2XS6LTUPcjs.parseBrushLibrary; exports.parseHexColor = parseHexColor; exports.parsePaintSource = _chunkQBWEH3IMcjs.parsePaintSource; exports.patchBrushValue = patchBrushValue; exports.patchPath = patchPath; exports.penOrientation = _chunk2XS6LTUPcjs.penOrientation; exports.perspectiveDirections = perspectiveDirections; exports.perspectiveGuideLines = perspectiveGuideLines; exports.pointerToPenPoint = pointerToPenPoint; exports.quickStencil = quickStencil; exports.rand01 = _chunkQBWEH3IMcjs.rand01; exports.randSigned = _chunk2XS6LTUPcjs.randSigned; exports.readPaintEffectSource = readPaintEffectSource; exports.readPaintSource = _chunkQBWEH3IMcjs.readPaintSource; exports.readPath = readPath; exports.readSwatch = readSwatch; exports.reliefInfo = reliefInfo; exports.removePaintGradientStop = _chunkQBWEH3IMcjs.removePaintGradientStop; exports.renderBrushThumbnail = renderBrushThumbnail; exports.renderColorWheel = renderColorWheel; exports.renderPaper = _chunk2XS6LTUPcjs.renderPaper; exports.renderStickers = _chunk2XS6LTUPcjs.renderStickers; exports.replayFrame = replayFrame; exports.replayItems = replayItems; exports.replayPainting = replayPainting; exports.resolvePaintGradient = _chunkQBWEH3IMcjs.resolvePaintGradient; exports.reversePaintGradient = _chunkQBWEH3IMcjs.reversePaintGradient; exports.rgbToHexColor = rgbToHexColor; exports.rgbToHsl = rgbToHsl; exports.rgbToHsv = rgbToHsv; exports.samplePressure = samplePressure; exports.scalePaintGradient = _chunkQBWEH3IMcjs.scalePaintGradient; exports.scaleStencil = scaleStencil; exports.screenToDocument = screenToDocument; exports.seedFromString = _chunk2XS6LTUPcjs.seedFromString; exports.serializePaintDocument = serializePaintDocument; exports.serializePaintDocumentExternal = serializePaintDocumentExternal; exports.solidPaint = _chunkQBWEH3IMcjs.solidPaint; exports.stampCoverage = _chunk2XS6LTUPcjs.stampCoverage; exports.standardBlendMode = _chunkO7LUD7MHcjs.standardBlendMode; exports.startWetClock = startWetClock; exports.stencilMask = stencilMask; exports.stencilOutline = stencilOutline; exports.stickerRect = _chunk2XS6LTUPcjs.stickerRect; exports.stickerSurface = _chunk2XS6LTUPcjs.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 = _chunk2XS6LTUPcjs.tiltToOrientation; exports.timeLapseVideo = timeLapseVideo; exports.timeLapseZip = timeLapseZip; exports.toStrokePoint = _chunk2XS6LTUPcjs.toStrokePoint; exports.toggleStamp = toggleStamp; exports.updatePaintGradientStop = _chunkQBWEH3IMcjs.updatePaintGradientStop; exports.usesPaintExchange = _chunk2XS6LTUPcjs.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 = _chunkF2Y4E4GUcjs.wetSupport; exports.wheelAngle = wheelAngle; exports.wheelPick = wheelPick; exports.wheelPoint = wheelPoint; exports.wheelToHue = wheelToHue;
|
|
8852
8851
|
//# sourceMappingURL=index.cjs.map
|