@pixerate/editor 0.135.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 +63 -55
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +8 -5
- package/dist/animation-editor/index.d.ts +8 -5
- package/dist/animation-editor/index.js +10 -2
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/{bezier-J8i4uqSH.d.cts → bezier-CZ2AhjID.d.cts} +1 -1
- package/dist/{bezier-lNEOp0Jx.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 +10 -7
- package/dist/canvas/index.d.ts +10 -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-HHTCDFZC.js → chunk-3D77LOBM.js} +234 -136
- 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-Z2H7KECK.cjs → chunk-5OOIUXNJ.cjs} +345 -247
- package/dist/chunk-5OOIUXNJ.cjs.map +1 -0
- package/dist/{chunk-7RJ6P7MI.js → chunk-6S6362D2.js} +2 -2
- package/dist/chunk-A3BVTI3G.js +150 -0
- package/dist/chunk-A3BVTI3G.js.map +1 -0
- 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-ECCXGELC.cjs +727 -0
- package/dist/chunk-ECCXGELC.cjs.map +1 -0
- 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-OXSV64JX.js → chunk-G6IKY6PL.js} +4 -4
- package/dist/{chunk-UYQUPUR6.js → chunk-HUO3TI4C.js} +3 -3
- package/dist/chunk-I52DRGGJ.js +727 -0
- package/dist/chunk-I52DRGGJ.js.map +1 -0
- 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-FWEO3HSL.js → chunk-PQQF5KOW.js} +8 -8
- package/dist/{chunk-T6TV6HY6.cjs → chunk-PRSRYHQD.cjs} +36 -36
- package/dist/{chunk-T6TV6HY6.cjs.map → chunk-PRSRYHQD.cjs.map} +1 -1
- package/dist/chunk-Q6OUXEK3.cjs +150 -0
- package/dist/chunk-Q6OUXEK3.cjs.map +1 -0
- package/dist/{chunk-6GFRKLLS.cjs → chunk-QBWEH3IM.cjs} +429 -112
- package/dist/chunk-QBWEH3IM.cjs.map +1 -0
- package/dist/{chunk-ESIWZMMK.js → chunk-SYT2TLQF.js} +35 -37
- package/dist/{chunk-ESIWZMMK.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-P3RQ5UJE.cjs → chunk-UTQKC66X.cjs} +4 -4
- package/dist/{chunk-P3RQ5UJE.cjs.map → chunk-UTQKC66X.cjs.map} +1 -1
- package/dist/{chunk-J3B45HTA.cjs → chunk-XB25WOC2.cjs} +6 -6
- package/dist/{chunk-J3B45HTA.cjs.map → chunk-XB25WOC2.cjs.map} +1 -1
- package/dist/{chunk-YAFS2QFZ.cjs → chunk-XN2NBLV5.cjs} +313 -315
- package/dist/chunk-XN2NBLV5.cjs.map +1 -0
- package/dist/effects/index.d.cts +7 -4
- package/dist/effects/index.d.ts +7 -4
- package/dist/{export-DMeG6E06.d.ts → export-41rL6Cne.d.ts} +1 -1
- package/dist/{export-AZSwX087.d.cts → export-CyJdfP_Z.d.cts} +5 -4
- package/dist/{export-KzubBKo7.d.cts → export-D9mXp05Q.d.cts} +1 -1
- package/dist/{export-BDkyDNM8.d.ts → export-DwnZ_hvQ.d.ts} +5 -4
- package/dist/extensions/index.cjs +3 -3
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.js +2 -2
- package/dist/generation/index.cjs +150 -945
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.d.cts +3 -423
- package/dist/generation/index.d.ts +3 -423
- package/dist/generation/index.js +59 -854
- package/dist/generation/index.js.map +1 -1
- package/dist/grammar/index.cjs +3 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.js +2 -2
- package/dist/{helpers-Coa4e2j_.d.ts → helpers-C-RgeyvH.d.ts} +25 -8
- package/dist/{helpers-DHl28yLO.d.cts → helpers-v6GMazzg.d.cts} +25 -8
- package/dist/image-editor/index.cjs +986 -986
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +15 -11
- package/dist/image-editor/index.d.ts +15 -11
- package/dist/image-editor/index.js +94 -94
- package/dist/index.cjs +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -36
- package/dist/{opentype-BWR7Qv8W.d.cts → opentype-KR_jj6b_.d.cts} +1 -1
- package/dist/{opentype-Dfcx6wFx.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 +405 -403
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +15 -748
- package/dist/paint-editor/index.d.ts +15 -748
- package/dist/paint-editor/index.js +79 -77
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/{pathfinder-D8KQ6blQ.d.cts → pathfinder-BHS4vQNm.d.cts} +1 -1
- package/dist/{pathfinder-Celbi3e6.d.ts → pathfinder-BVvTIBMo.d.ts} +1 -1
- package/dist/{pool-8JZGWHvR.d.ts → pool-CZQOrSXZ.d.ts} +1 -1
- package/dist/{pool-BfuxBKTd.d.cts → pool-FjZZmZ80.d.cts} +1 -1
- package/dist/provenance-DmlcgdzT.d.cts +426 -0
- package/dist/provenance-uh5r2TQ8.d.ts +426 -0
- 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-CxxqG3_W.d.ts → svg-CSz3mzkw.d.ts} +2 -2
- package/dist/{svg-pwXWq6s2.d.cts → svg-DTb40ICU.d.cts} +2 -2
- package/dist/{tools-y1M6O3UT.d.ts → tools-B0wXP5cF.d.ts} +1 -1
- package/dist/{tools-3EBjR91b.d.cts → tools-Ca0kI1qo.d.cts} +1 -1
- package/dist/vector/index.cjs +2698 -1674
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +390 -72
- package/dist/vector/index.d.ts +390 -72
- package/dist/vector/index.js +1665 -641
- package/dist/vector/index.js.map +1 -1
- package/dist/video-editor/index.d.cts +7 -4
- package/dist/video-editor/index.d.ts +7 -4
- package/dist/{warp-Ceqdz7kj.d.cts → warp-DTOp0lON.d.cts} +1 -1
- package/dist/{warp-C1gwu2G_.d.ts → warp-pd7hrH4T.d.ts} +1 -1
- package/package.json +1 -1
- package/skills/pixerate-vector/SKILL.md +22 -0
- package/dist/brushstrokeRender-JNHVEUFG.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-HHTCDFZC.js.map +0 -1
- package/dist/chunk-J5BA3BQ6.cjs.map +0 -1
- package/dist/chunk-YAFS2QFZ.cjs.map +0 -1
- package/dist/chunk-Z2H7KECK.cjs.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-7RJ6P7MI.js.map → chunk-6S6362D2.js.map} +0 -0
- /package/dist/{chunk-SVYE5HIM.js.map → chunk-EQQMGO42.js.map} +0 -0
- /package/dist/{chunk-OXSV64JX.js.map → chunk-G6IKY6PL.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
- /package/dist/{chunk-FWEO3HSL.js.map → chunk-PQQF5KOW.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 _chunkYAFS2QFZcjs = require('../chunk-YAFS2QFZ.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,23 @@ 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-Z2H7KECK.cjs');
|
|
215
|
-
require('../chunk-BJTCSLF6.cjs');
|
|
216
|
-
require('../chunk-IZ4WRXZA.cjs');
|
|
217
217
|
|
|
218
218
|
|
|
219
219
|
|
|
220
220
|
|
|
221
221
|
|
|
222
|
-
var
|
|
223
|
-
require('../chunk-
|
|
222
|
+
var _chunkO7LUD7MHcjs = require('../chunk-O7LUD7MH.cjs');
|
|
223
|
+
require('../chunk-643B2HKC.cjs');
|
|
224
|
+
require('../chunk-FD4LPFAE.cjs');
|
|
224
225
|
require('../chunk-EMQWJA3G.cjs');
|
|
226
|
+
require('../chunk-MKA3AHLV.cjs');
|
|
225
227
|
require('../chunk-MR3Z4OQI.cjs');
|
|
226
228
|
require('../chunk-A6PHCAGX.cjs');
|
|
227
229
|
|
|
@@ -234,7 +236,7 @@ function newPaintLayerId() {
|
|
|
234
236
|
return `pl${Date.now().toString(36)}${(nextId++).toString(36)}`;
|
|
235
237
|
}
|
|
236
238
|
function createPaintLayer(name, id = newPaintLayerId()) {
|
|
237
|
-
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 } };
|
|
238
240
|
}
|
|
239
241
|
var PaintDocumentError = class extends Error {
|
|
240
242
|
constructor(message) {
|
|
@@ -256,7 +258,7 @@ function normalizeCanvas(raw) {
|
|
|
256
258
|
function createPaintDocument(options = {}) {
|
|
257
259
|
const canvas = normalizeCanvas({ width: _nullishCoalesce(options.width, () => ( 2048)), height: _nullishCoalesce(options.height, () => ( 1536)), dpi: options.dpi });
|
|
258
260
|
const layer = createPaintLayer("Layer 1");
|
|
259
|
-
return { canvas, paper:
|
|
261
|
+
return { canvas, paper: _chunk2XS6LTUPcjs.normalizePaper.call(void 0, _nullishCoalesce(options.paper, () => ( {}))), layers: [layer], activeLayerId: layer.id, strokes: [] };
|
|
260
262
|
}
|
|
261
263
|
|
|
262
264
|
// src/paint-editor/dab-stroke.ts
|
|
@@ -281,7 +283,7 @@ function mixRgb(a, b, t, mixing) {
|
|
|
281
283
|
if (mixing === "pigment") {
|
|
282
284
|
const o = [0, 0, 0];
|
|
283
285
|
const q = (v) => Math.round(Math.min(1, Math.max(0, v)) * 255);
|
|
284
|
-
|
|
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);
|
|
285
287
|
return [o[0], o[1], o[2]];
|
|
286
288
|
}
|
|
287
289
|
return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t, a[2] + (b[2] - a[2]) * t];
|
|
@@ -300,7 +302,7 @@ function multiColorForDab(mc, palette, index, seed, mixing) {
|
|
|
300
302
|
const n = palette.length;
|
|
301
303
|
if (mc.order === "random") {
|
|
302
304
|
const run = Math.floor(index / mc.length);
|
|
303
|
-
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))]];
|
|
304
306
|
}
|
|
305
307
|
const f = index / mc.length % n;
|
|
306
308
|
const i = Math.floor(f);
|
|
@@ -310,24 +312,24 @@ var PaintDabStroke = (_class = class {
|
|
|
310
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);
|
|
311
313
|
this.brush = brush;
|
|
312
314
|
this.options = options;
|
|
313
|
-
this.smoother = new (0,
|
|
314
|
-
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];
|
|
315
317
|
const exchanging = brush.engine === "mixer" || brush.engine === "dab";
|
|
316
|
-
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);
|
|
317
319
|
this.mixing = brush.engine === "mixer" ? brush.mixer.mixing : brush.behavior.mixing;
|
|
318
320
|
this.states = this.copies.map((c, i) => ({
|
|
319
|
-
walker: new (0,
|
|
320
|
-
exchange: exchanging ? new (0,
|
|
321
|
-
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
|
|
322
324
|
}));
|
|
323
|
-
this.medium = new (0,
|
|
325
|
+
this.medium = new (0, _chunkQBWEH3IMcjs.TileMedium)(options.target, brush.engine === "dab" ? { blend: brush.tip.blend } : {});
|
|
324
326
|
this.depth = options.grain && !options.grain.flat ? Math.min(1, Math.max(0, options.paperDepth * brush.grain)) : 0;
|
|
325
|
-
this.coverage = brush.engine === "dab" ? new (0,
|
|
326
|
-
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;
|
|
327
329
|
const table = _optionalChain([this, 'access', _4 => _4.sampler, 'optionalAccess', _5 => _5.acrossTip]) ? this.sampler.tipTable(GRADIENT_STEPS) : null;
|
|
328
330
|
this.gradient = table ? table.map((e) => e.rgb) : null;
|
|
329
331
|
this.gradientAlpha = table && table.some((e) => e.alpha < 1) ? table.map((e) => e.alpha) : null;
|
|
330
|
-
this.scratch = brush.engine === "blender" ?
|
|
332
|
+
this.scratch = brush.engine === "blender" ? _chunkQBWEH3IMcjs.createBlenderScratch.call(void 0, ) : null;
|
|
331
333
|
}
|
|
332
334
|
|
|
333
335
|
|
|
@@ -386,7 +388,7 @@ var PaintDabStroke = (_class = class {
|
|
|
386
388
|
}
|
|
387
389
|
paintDabs(copy, dabs, rects) {
|
|
388
390
|
for (const d of dabs) {
|
|
389
|
-
const rect =
|
|
391
|
+
const rect = _chunkQBWEH3IMcjs.dabRect.call(void 0, d, this.brush.tip.hardness);
|
|
390
392
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
391
393
|
this.dab(copy, d, rect);
|
|
392
394
|
rects.push(rect);
|
|
@@ -402,13 +404,13 @@ var PaintDabStroke = (_class = class {
|
|
|
402
404
|
}
|
|
403
405
|
const tip = this.tip.subarray(0, n);
|
|
404
406
|
tip.fill(0);
|
|
405
|
-
|
|
407
|
+
_chunkQBWEH3IMcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.brush.tip.hardness, rect, tip);
|
|
406
408
|
if (!(this.depth > 0 && this.options.grain)) return { tip, cov: tip };
|
|
407
409
|
const cov = this.cov.subarray(0, n);
|
|
408
410
|
const grain = this.options.grain;
|
|
409
411
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
410
412
|
const y = rect.y + yy + 0.5;
|
|
411
|
-
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;
|
|
412
414
|
}
|
|
413
415
|
return { tip, cov };
|
|
414
416
|
}
|
|
@@ -417,7 +419,7 @@ var PaintDabStroke = (_class = class {
|
|
|
417
419
|
const { tip, cov } = this.rasterize(d, rect);
|
|
418
420
|
const st = this.states[copy];
|
|
419
421
|
if (brush.engine === "blender") {
|
|
420
|
-
|
|
422
|
+
_chunkQBWEH3IMcjs.blenderDab.call(void 0, this.medium, rect, cov, d.opacity * d.alpha * brush.tip.opacity, d.radius, brush.blender, this.scratch);
|
|
421
423
|
return;
|
|
422
424
|
}
|
|
423
425
|
if (brush.engine === "smudge") {
|
|
@@ -539,7 +541,7 @@ function normalizeLighting(raw = {}, base = DEFAULT_LIGHTING) {
|
|
|
539
541
|
};
|
|
540
542
|
}
|
|
541
543
|
function emptyThickChannels() {
|
|
542
|
-
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) };
|
|
543
545
|
}
|
|
544
546
|
var RELIEF_PX = 7;
|
|
545
547
|
var AMBIENT = 0.38;
|
|
@@ -563,16 +565,16 @@ function lightTile(color, height, heightAround, material, light) {
|
|
|
563
565
|
const k = RELIEF_PX / 255 * light.relief * 2;
|
|
564
566
|
const flatDiffuse = AMBIENT + (1 - AMBIENT) * lz;
|
|
565
567
|
const read = (x, y) => {
|
|
566
|
-
if (x >= 0 && y >= 0 && x <
|
|
567
|
-
const dx = x < 0 ? -1 : x >=
|
|
568
|
-
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;
|
|
569
571
|
const t = heightAround(dx, dy);
|
|
570
572
|
if (!t) return 0;
|
|
571
|
-
return t[(y - dy *
|
|
573
|
+
return t[(y - dy * _chunkO7LUD7MHcjs.TILE) * _chunkO7LUD7MHcjs.TILE + (x - dx * _chunkO7LUD7MHcjs.TILE)];
|
|
572
574
|
};
|
|
573
|
-
for (let y = 0; y <
|
|
574
|
-
for (let x = 0; x <
|
|
575
|
-
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;
|
|
576
578
|
const i = p * 4;
|
|
577
579
|
if (color[i + 3] === 0) continue;
|
|
578
580
|
const h = height[p];
|
|
@@ -593,10 +595,10 @@ function lightTile(color, height, heightAround, material, light) {
|
|
|
593
595
|
const nh = Math.max(0, nx * hx + ny * hy + nz * hz);
|
|
594
596
|
const spec = Math.max(0, Math.pow(nh, shininess) - Math.pow(hz, shininess)) * (0.25 + 0.75 * gloss) * light.relief;
|
|
595
597
|
for (let c = 0; c < 3; c++) {
|
|
596
|
-
const a =
|
|
598
|
+
const a = _chunkF2Y4E4GUcjs.SRGB_TO_LINEAR[color[i + c]];
|
|
597
599
|
const tint = metal * a + (1 - metal);
|
|
598
600
|
const v = a * shade * (1 - 0.35 * metal) + spec * tint * (1 + metal);
|
|
599
|
-
out[i + c] =
|
|
601
|
+
out[i + c] = _chunkF2Y4E4GUcjs.linearToSrgb8.call(void 0, v);
|
|
600
602
|
}
|
|
601
603
|
}
|
|
602
604
|
}
|
|
@@ -614,14 +616,14 @@ var LitCache = (_class2 = class {constructor() { _class2.prototype.__init11.call
|
|
|
614
616
|
for (const [key, tile] of color.tiles) {
|
|
615
617
|
const tx = key % 65536 - 32768;
|
|
616
618
|
const ty = Math.floor(key / 65536) - 32768;
|
|
617
|
-
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));
|
|
618
620
|
let any = false;
|
|
619
621
|
for (let dy = -1; dy <= 1 && !any; dy++) for (let dx = -1; dx <= 1 && !any; dx++) if (around(dx, dy)) any = true;
|
|
620
622
|
if (!any) continue;
|
|
621
623
|
const h = _nullishCoalesce(ch.height.tiles.get(key), () => ( null));
|
|
622
624
|
const m = _nullishCoalesce(ch.material.tiles.get(key), () => ( null));
|
|
623
625
|
const inputs = [tile, lk, m];
|
|
624
|
-
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)));
|
|
625
627
|
const cached = this.tiles.get(key);
|
|
626
628
|
if (cached && cached.inputs.length === inputs.length && cached.inputs.every((v, i) => v === inputs[i])) {
|
|
627
629
|
out.set(key, cached.tile);
|
|
@@ -630,7 +632,7 @@ var LitCache = (_class2 = class {constructor() { _class2.prototype.__init11.call
|
|
|
630
632
|
const hd = h ? expand(h, 1) : null;
|
|
631
633
|
const md = m ? expand(m, 4) : null;
|
|
632
634
|
const data = lightTile(expand(tile, 4), hd, (dx, dy) => {
|
|
633
|
-
const t = ch.height.tiles.get(
|
|
635
|
+
const t = ch.height.tiles.get(_chunkO7LUD7MHcjs.tileKey.call(void 0, tx + dx, ty + dy));
|
|
634
636
|
return t ? expand(t, 1) : null;
|
|
635
637
|
}, md, light);
|
|
636
638
|
const lit = { data, uniform: null };
|
|
@@ -638,12 +640,12 @@ var LitCache = (_class2 = class {constructor() { _class2.prototype.__init11.call
|
|
|
638
640
|
out.set(key, lit);
|
|
639
641
|
}
|
|
640
642
|
for (const key of [...this.tiles.keys()]) if (!keys.has(key)) this.tiles.delete(key);
|
|
641
|
-
return new (0,
|
|
643
|
+
return new (0, _chunkO7LUD7MHcjs.TiledSurface)(4, out, color.defaultValue);
|
|
642
644
|
}
|
|
643
645
|
}, _class2);
|
|
644
646
|
function expand(t, channels) {
|
|
645
|
-
if (t.data.length ===
|
|
646
|
-
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);
|
|
647
649
|
const u = _nullishCoalesce(t.uniform, () => ( 0));
|
|
648
650
|
if (channels === 1) out.fill(u & 255);
|
|
649
651
|
else {
|
|
@@ -656,19 +658,19 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
656
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);
|
|
657
659
|
this.init = init;
|
|
658
660
|
const b = init.brush;
|
|
659
|
-
this.smoother = new (0,
|
|
660
|
-
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];
|
|
661
663
|
this.copies = copies;
|
|
662
|
-
const rates =
|
|
664
|
+
const rates = _chunkQBWEH3IMcjs.exchangeRates.call(void 0, b.behavior.pickup, b.behavior.mix, 1, b.behavior.mixing);
|
|
663
665
|
this.states = copies.map((c, i) => ({
|
|
664
|
-
walker: new (0,
|
|
665
|
-
exchange: new (0,
|
|
666
|
-
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,
|
|
667
669
|
carried: null,
|
|
668
670
|
amount: 1
|
|
669
671
|
}));
|
|
670
|
-
this.medium = new (0,
|
|
671
|
-
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;
|
|
672
674
|
}
|
|
673
675
|
|
|
674
676
|
__init12() {this.dabCount = 0}
|
|
@@ -694,47 +696,47 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
694
696
|
const h = new Map(this.init.channels.height.tiles);
|
|
695
697
|
const m = new Map(this.init.channels.material.tiles);
|
|
696
698
|
for (const [k, d] of this.height) {
|
|
697
|
-
const t =
|
|
699
|
+
const t = _chunkO7LUD7MHcjs.finishTile.call(void 0, d, 1, 0);
|
|
698
700
|
if (t) h.set(k, t);
|
|
699
701
|
else h.delete(k);
|
|
700
702
|
}
|
|
701
703
|
for (const [k, d] of this.material) {
|
|
702
|
-
const t =
|
|
704
|
+
const t = _chunkO7LUD7MHcjs.finishTile.call(void 0, new Uint8ClampedArray(d), 4, 0);
|
|
703
705
|
if (t) m.set(k, t);
|
|
704
706
|
else m.delete(k);
|
|
705
707
|
}
|
|
706
708
|
void this.version;
|
|
707
|
-
return { height: new (0,
|
|
709
|
+
return { height: new (0, _chunkO7LUD7MHcjs.TiledSurface)(1, h, 0), material: new (0, _chunkO7LUD7MHcjs.TiledSurface)(4, m, 0) };
|
|
708
710
|
}
|
|
709
711
|
heightTile(tx, ty, write) {
|
|
710
|
-
const key =
|
|
712
|
+
const key = _chunkO7LUD7MHcjs.tileKey.call(void 0, tx, ty);
|
|
711
713
|
let t = this.height.get(key);
|
|
712
714
|
if (t) {
|
|
713
715
|
return t;
|
|
714
716
|
}
|
|
715
717
|
const base = this.init.channels.height.tiles.get(key);
|
|
716
718
|
if (!write) return base ? expand(base, 1) : null;
|
|
717
|
-
t = base ? new Uint8ClampedArray(expand(base, 1)) : new Uint8ClampedArray(
|
|
719
|
+
t = base ? new Uint8ClampedArray(expand(base, 1)) : new Uint8ClampedArray(_chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE);
|
|
718
720
|
this.height.set(key, t);
|
|
719
721
|
return t;
|
|
720
722
|
}
|
|
721
723
|
materialTile(tx, ty) {
|
|
722
|
-
const key =
|
|
724
|
+
const key = _chunkO7LUD7MHcjs.tileKey.call(void 0, tx, ty);
|
|
723
725
|
let t = this.material.get(key);
|
|
724
726
|
if (!t) {
|
|
725
727
|
const base = this.init.channels.material.tiles.get(key);
|
|
726
|
-
t = base ? new Uint8ClampedArray(expand(base, 4)) : new Uint8ClampedArray(
|
|
728
|
+
t = base ? new Uint8ClampedArray(expand(base, 4)) : new Uint8ClampedArray(_chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE * 4);
|
|
727
729
|
this.material.set(key, t);
|
|
728
730
|
}
|
|
729
731
|
return t;
|
|
730
732
|
}
|
|
731
733
|
getH(x, y) {
|
|
732
|
-
const t = this.heightTile(Math.floor(x /
|
|
733
|
-
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;
|
|
734
736
|
}
|
|
735
737
|
setH(x, y, v) {
|
|
736
|
-
const t = this.heightTile(Math.floor(x /
|
|
737
|
-
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;
|
|
738
740
|
}
|
|
739
741
|
push(points) {
|
|
740
742
|
const rects = [];
|
|
@@ -764,7 +766,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
764
766
|
}
|
|
765
767
|
applyDabs(copy, dabs, rects) {
|
|
766
768
|
for (const d of dabs) {
|
|
767
|
-
const rect =
|
|
769
|
+
const rect = _chunkQBWEH3IMcjs.dabRect.call(void 0, d, this.init.brush.tip.hardness);
|
|
768
770
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
769
771
|
this.dab(copy, d, rect);
|
|
770
772
|
rects.push(rect);
|
|
@@ -779,7 +781,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
779
781
|
const n = rect.width * rect.height;
|
|
780
782
|
if (this.tip.length < n) this.tip = new Float32Array(n);
|
|
781
783
|
const tip = this.tip.subarray(0, n);
|
|
782
|
-
|
|
784
|
+
_chunkQBWEH3IMcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, b.tip.hardness, rect, tip);
|
|
783
785
|
const sel = this.init.target.selection;
|
|
784
786
|
if (sel) {
|
|
785
787
|
for (let yy = 0, p = 0; yy < rect.height; yy++)
|
|
@@ -833,7 +835,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
833
835
|
const full = 255 * thick * k;
|
|
834
836
|
switch (im.tool) {
|
|
835
837
|
case "brush": {
|
|
836
|
-
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);
|
|
837
839
|
const target = full * c * ridge;
|
|
838
840
|
h = Math.max(h0 * (1 - 0.25 * c * im.drag), Math.min(255, h0 * 0.35 + target));
|
|
839
841
|
break;
|
|
@@ -849,7 +851,7 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
849
851
|
break;
|
|
850
852
|
}
|
|
851
853
|
case "roller": {
|
|
852
|
-
const stipple = 0.75 + 0.5 *
|
|
854
|
+
const stipple = 0.75 + 0.5 * _chunkQBWEH3IMcjs.hash2.call(void 0, lx >> 1, ly >> 1, seed);
|
|
853
855
|
h = h0 + (Math.min(255, full * 0.6 * stipple) - h0) * Math.min(1, c * 1.5);
|
|
854
856
|
break;
|
|
855
857
|
}
|
|
@@ -894,8 +896,8 @@ var ThickStrokeDriver = (_class3 = class {
|
|
|
894
896
|
if (c <= 0) continue;
|
|
895
897
|
const lx = rect.x + xx - off.x;
|
|
896
898
|
const ly = rect.y + yy - off.y;
|
|
897
|
-
const t = this.materialTile(Math.floor(lx /
|
|
898
|
-
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;
|
|
899
901
|
t[i] = Math.round(t[i] + (gloss * 255 - t[i]) * c);
|
|
900
902
|
t[i + 1] = Math.round(t[i + 1] + (metal * 255 - t[i + 1]) * c);
|
|
901
903
|
t[i + 3] = 255;
|
|
@@ -914,28 +916,28 @@ function reliefInfo(ch) {
|
|
|
914
916
|
function thickToJSON(ch) {
|
|
915
917
|
const b = ch.height.bounds;
|
|
916
918
|
if (!b) return null;
|
|
917
|
-
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) };
|
|
918
920
|
}
|
|
919
921
|
function thickFromJSON(raw) {
|
|
920
922
|
const r = raw;
|
|
921
923
|
if (!r || typeof r !== "object" || !r.rect || typeof r.height !== "string" || typeof r.material !== "string") throw new Error("not saved thick-paint channels");
|
|
922
924
|
const decode = (url, gray) => {
|
|
923
|
-
const parsed =
|
|
925
|
+
const parsed = _chunkO7LUD7MHcjs.parseDataUrl.call(void 0, url);
|
|
924
926
|
if (!parsed) throw new Error("a channel is not a PNG data URL");
|
|
925
|
-
return
|
|
927
|
+
return _chunkO7LUD7MHcjs.decodePng.call(void 0, parsed.bytes, { keepGray: gray });
|
|
926
928
|
};
|
|
927
929
|
const h = decode(r.height, true);
|
|
928
930
|
const m = decode(r.material, false);
|
|
929
931
|
const hd = h.channels === 1 ? h.data : Uint8ClampedArray.from({ length: h.width * h.height }, (_, i) => h.data[i * 4]);
|
|
930
932
|
return {
|
|
931
|
-
height:
|
|
932
|
-
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)
|
|
933
935
|
};
|
|
934
936
|
}
|
|
935
937
|
|
|
936
938
|
// src/paint-editor/stroke.ts
|
|
937
939
|
function defaultTile(surface) {
|
|
938
|
-
const data = new Uint8ClampedArray(
|
|
940
|
+
const data = new Uint8ClampedArray(_chunkO7LUD7MHcjs.TILE * _chunkO7LUD7MHcjs.TILE * surface.channels);
|
|
939
941
|
if (surface.defaultValue) data.fill(surface.defaultValue);
|
|
940
942
|
return data;
|
|
941
943
|
}
|
|
@@ -959,7 +961,7 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
959
961
|
this.layerId = init.layerId;
|
|
960
962
|
this.base = init.surface;
|
|
961
963
|
this.live = new Map(this.base.tiles);
|
|
962
|
-
this.copies = init.copies.length ? init.copies : [
|
|
964
|
+
this.copies = init.copies.length ? init.copies : [_chunk2XS6LTUPcjs.IDENTITY_COPY];
|
|
963
965
|
const brush = init.brush;
|
|
964
966
|
if (init.wet) this.wetDriver = init.wet.driver;
|
|
965
967
|
this.apply = {
|
|
@@ -974,11 +976,11 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
974
976
|
};
|
|
975
977
|
if (this.wetDriver) {
|
|
976
978
|
} else if (init.sticker) {
|
|
977
|
-
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)) });
|
|
978
980
|
} else if (init.thick) {
|
|
979
981
|
const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
|
|
980
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)) });
|
|
981
|
-
} 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))) {
|
|
982
984
|
const rgb = (c) => [c[0] / 255, c[1] / 255, c[2] / 255];
|
|
983
985
|
this.wet = new PaintDabStroke(brush, {
|
|
984
986
|
target: this.tileTarget(),
|
|
@@ -993,7 +995,7 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
993
995
|
});
|
|
994
996
|
} else {
|
|
995
997
|
const opts = { grain: init.grain, paperDepth: init.paperDepth, seed: init.seed, copies: this.copies, paint: _nullishCoalesce(init.paint, () => ( null)) };
|
|
996
|
-
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);
|
|
997
999
|
}
|
|
998
1000
|
}
|
|
999
1001
|
|
|
@@ -1025,9 +1027,9 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1025
1027
|
offset: this.init.offset,
|
|
1026
1028
|
lockTransparency: this.init.lockTransparency,
|
|
1027
1029
|
selection: _nullishCoalesce(this.init.selection, () => ( null)),
|
|
1028
|
-
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)),
|
|
1029
1031
|
writeTile: (tx, ty) => {
|
|
1030
|
-
const key =
|
|
1032
|
+
const key = _chunkO7LUD7MHcjs.tileKey.call(void 0, tx, ty);
|
|
1031
1033
|
if (!this.touched.has(key)) {
|
|
1032
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)));
|
|
1033
1035
|
this.live.set(key, { data: new Uint8ClampedArray(src), uniform: null });
|
|
@@ -1083,7 +1085,7 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1083
1085
|
const changed = d.dabCount > 0;
|
|
1084
1086
|
this.result = { layerId: this.layerId, bounds: changed ? d.bounds : null, dabs: d.dabCount, strokeId: null, wet: true };
|
|
1085
1087
|
const carried = d.load;
|
|
1086
|
-
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);
|
|
1087
1089
|
this.host.commit(this, changed ? this.init.wet.surface() : null, false);
|
|
1088
1090
|
}
|
|
1089
1091
|
update(rects) {
|
|
@@ -1093,14 +1095,14 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1093
1095
|
if (!this.dry) {
|
|
1094
1096
|
for (const key of this.fresh) this.live.set(key, { data: this.live.get(key).data, uniform: null });
|
|
1095
1097
|
this.fresh.clear();
|
|
1096
|
-
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);
|
|
1097
1099
|
return;
|
|
1098
1100
|
}
|
|
1099
1101
|
const off = this.init.offset;
|
|
1100
1102
|
const regions = /* @__PURE__ */ new Map();
|
|
1101
1103
|
for (const r of rects) {
|
|
1102
|
-
for (const t of
|
|
1103
|
-
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);
|
|
1104
1106
|
const cur = regions.get(key);
|
|
1105
1107
|
regions.set(key, { tx: t.tx, ty: t.ty, r: cur ? union(cur.r, r) : r });
|
|
1106
1108
|
}
|
|
@@ -1109,10 +1111,10 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1109
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)));
|
|
1110
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;
|
|
1111
1113
|
this.touched.add(key);
|
|
1112
|
-
const data =
|
|
1114
|
+
const data = _chunkQBWEH3IMcjs.applyStrokeToTile.call(void 0, this.dry.coverage, src, ch, tx, ty, this.apply, prev ? { into: prev, region: r } : {});
|
|
1113
1115
|
this.live.set(key, { data, uniform: null });
|
|
1114
1116
|
}
|
|
1115
|
-
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);
|
|
1116
1118
|
}
|
|
1117
1119
|
/** Ends the stroke (one undo step) and returns what changed. */
|
|
1118
1120
|
end() {
|
|
@@ -1133,18 +1135,18 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1133
1135
|
const tiles = new Map(this.base.tiles);
|
|
1134
1136
|
let changed = false;
|
|
1135
1137
|
for (const key of this.touched) {
|
|
1136
|
-
const tile =
|
|
1138
|
+
const tile = _chunkO7LUD7MHcjs.finishTile.call(void 0, this.live.get(key).data, ch, this.base.defaultValue);
|
|
1137
1139
|
const prev = this.base.tiles.get(key);
|
|
1138
1140
|
if (tile) tiles.set(key, tile);
|
|
1139
1141
|
else tiles.delete(key);
|
|
1140
1142
|
if (!sameTile(prev, tile)) changed = true;
|
|
1141
1143
|
}
|
|
1142
1144
|
if (this.thickDriver && this.thickDriver.dabCount > 0) changed = true;
|
|
1143
|
-
const surface = changed ? new (0,
|
|
1145
|
+
const surface = changed ? new (0, _chunkO7LUD7MHcjs.TiledSurface)(ch, tiles, this.base.defaultValue) : null;
|
|
1144
1146
|
const dabs = this.dry ? this.dry.dabCount : this.thickDriver ? this.thickDriver.dabCount : this.stickerSpray ? this.stickerSpray.dabCount : this.wet.dabCount;
|
|
1145
1147
|
this.result = { layerId: this.layerId, bounds: changed ? this.bounds : null, dabs, strokeId: null };
|
|
1146
1148
|
const carried = _nullishCoalesce(_optionalChain([this, 'access', _36 => _36.wet, 'optionalAccess', _37 => _37.load]), () => ( _optionalChain([this, 'access', _38 => _38.thickDriver, 'optionalAccess', _39 => _39.load])));
|
|
1147
|
-
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);
|
|
1148
1150
|
this.host.commit(this, surface, false);
|
|
1149
1151
|
return this.result;
|
|
1150
1152
|
}
|
|
@@ -1157,15 +1159,15 @@ var PaintStrokeSession = (_class4 = class {
|
|
|
1157
1159
|
}, _class4);
|
|
1158
1160
|
function mixerLoadForStroke(brush, current, color) {
|
|
1159
1161
|
if (!brush.loadsColor) return { reservoir: null, amount: 0, pickup: brush.mixer.cleanEachStroke ? null : current.pickup };
|
|
1160
|
-
if (brush.mixer.loadEachStroke || !current.reservoir) return
|
|
1162
|
+
if (brush.mixer.loadEachStroke || !current.reservoir) return _chunkQBWEH3IMcjs.loadMixer.call(void 0, current, color);
|
|
1161
1163
|
return current;
|
|
1162
1164
|
}
|
|
1163
1165
|
function brushLoadForStroke(brush, current, color) {
|
|
1164
1166
|
if (brush.engine === "mixer") return mixerLoadForStroke(brush, current, color);
|
|
1165
1167
|
if (brush.engine === "impasto") return { reservoir: [color[0], color[1], color[2]], amount: 1, pickup: brush.behavior.dirty ? current.pickup : null };
|
|
1166
|
-
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 } :
|
|
1167
|
-
if (
|
|
1168
|
-
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;
|
|
1169
1171
|
}
|
|
1170
1172
|
|
|
1171
1173
|
// src/paint-editor/stencils.ts
|
|
@@ -1421,7 +1423,7 @@ function normalizeBrushStroke(raw) {
|
|
|
1421
1423
|
const out = {
|
|
1422
1424
|
id: r.id,
|
|
1423
1425
|
layerId: r.layerId,
|
|
1424
|
-
brush:
|
|
1426
|
+
brush: _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, _nullishCoalesce(r.brush, () => ( {}))),
|
|
1425
1427
|
color: typeof r.color === "string" && /^#[0-9a-f]{6}$/i.test(r.color) ? r.color.toLowerCase() : "#000000",
|
|
1426
1428
|
points,
|
|
1427
1429
|
seed: finite2(r.seed) ? r.seed | 0 : 0
|
|
@@ -1440,7 +1442,7 @@ function normalizeBrushStroke(raw) {
|
|
|
1440
1442
|
}
|
|
1441
1443
|
if (st.length) out.stencils = st;
|
|
1442
1444
|
}
|
|
1443
|
-
const paint =
|
|
1445
|
+
const paint = _chunkQBWEH3IMcjs.readPaintSource.call(void 0, r.paint);
|
|
1444
1446
|
if (paint && paint.type === "gradient") out.paint = paint;
|
|
1445
1447
|
if (Array.isArray(r.steps) && r.steps.length === points.length && r.steps.every((v) => Number.isInteger(v) && v >= 0)) out.steps = [...r.steps];
|
|
1446
1448
|
return out;
|
|
@@ -1477,9 +1479,9 @@ function varyStroke(stroke, m, v) {
|
|
|
1477
1479
|
if (ps !== 1) q.pressure = Math.min(1, Math.max(0, (_nullishCoalesce(p.pressure, () => ( 1))) * ps));
|
|
1478
1480
|
return q;
|
|
1479
1481
|
});
|
|
1480
|
-
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;
|
|
1481
1483
|
const out = { ...stroke, brush, points };
|
|
1482
|
-
if (stroke.paint && s !== 1) out.paint =
|
|
1484
|
+
if (stroke.paint && s !== 1) out.paint = _chunkQBWEH3IMcjs.scalePaintGradient.call(void 0, stroke.paint, s);
|
|
1483
1485
|
if (_optionalChain([stroke, 'access', _57 => _57.copies, 'optionalAccess', _58 => _58.length])) {
|
|
1484
1486
|
const inv = invertAffine(m);
|
|
1485
1487
|
out.copies = stroke.copies.map((c) => composeAffine(m, composeAffine(c, inv)));
|
|
@@ -1511,7 +1513,7 @@ function paperGrain(paper) {
|
|
|
1511
1513
|
const key = JSON.stringify([paper.pattern, paper.seed, paper.scale, paper.tiling, paper.dry]);
|
|
1512
1514
|
let g = grainCache.get(key);
|
|
1513
1515
|
if (!g) {
|
|
1514
|
-
g = new (0,
|
|
1516
|
+
g = new (0, _chunk2XS6LTUPcjs.PaperGrain)(paper, "dry");
|
|
1515
1517
|
if (grainCache.size > 16) grainCache.delete(grainCache.keys().next().value);
|
|
1516
1518
|
grainCache.set(key, g);
|
|
1517
1519
|
}
|
|
@@ -1521,7 +1523,7 @@ function paperTile(paper, r, light) {
|
|
|
1521
1523
|
const key = `${paperKey(paper, light)}|${r.x},${r.y},${r.width},${r.height}`;
|
|
1522
1524
|
let t = tileCache.get(key);
|
|
1523
1525
|
if (!t) {
|
|
1524
|
-
t =
|
|
1526
|
+
t = _chunk2XS6LTUPcjs.renderPaper.call(void 0, paper, r, paperGrain(paper), light);
|
|
1525
1527
|
if (tileCache.size > 512) tileCache.delete(tileCache.keys().next().value);
|
|
1526
1528
|
tileCache.set(key, t);
|
|
1527
1529
|
}
|
|
@@ -1550,7 +1552,7 @@ var PROFILE = {
|
|
|
1550
1552
|
}
|
|
1551
1553
|
};
|
|
1552
1554
|
function createPaintCompositor() {
|
|
1553
|
-
return new (0,
|
|
1555
|
+
return new (0, _chunkAEAAN4ADcjs.RasterCompositor)(PROFILE);
|
|
1554
1556
|
}
|
|
1555
1557
|
function downsampleRgba(data, width, height, tw, th) {
|
|
1556
1558
|
tw = Math.max(1, Math.round(tw));
|
|
@@ -1625,11 +1627,11 @@ function header(state, options) {
|
|
|
1625
1627
|
return out;
|
|
1626
1628
|
}
|
|
1627
1629
|
function serializePaintDocument(state, options = {}) {
|
|
1628
|
-
const { layers, assets } =
|
|
1630
|
+
const { layers, assets } = _chunkXN2NBLV5cjs.serializeLayers.call(void 0, state.layers);
|
|
1629
1631
|
return { ...header(state, options), layers, assets };
|
|
1630
1632
|
}
|
|
1631
1633
|
async function serializePaintDocumentExternal(state, store, options = {}) {
|
|
1632
|
-
const { layers, assets } = await
|
|
1634
|
+
const { layers, assets } = await _chunkXN2NBLV5cjs.serializeLayersExternal.call(void 0, state.layers, store);
|
|
1633
1635
|
return { ...header(state, options), layers, assets };
|
|
1634
1636
|
}
|
|
1635
1637
|
function paintLayersOnly(layers, problems) {
|
|
@@ -1664,11 +1666,11 @@ function deserializePaintDocument(raw) {
|
|
|
1664
1666
|
}
|
|
1665
1667
|
const problems = [];
|
|
1666
1668
|
const canvas = normalizeCanvas({ width: r.width, height: r.height, dpi: _nullishCoalesce(r.dpi, () => ( void 0)) });
|
|
1667
|
-
const paper =
|
|
1669
|
+
const paper = _chunk2XS6LTUPcjs.normalizePaper.call(void 0, _nullishCoalesce(r.paper, () => ( {})));
|
|
1668
1670
|
const assets = r.assets && typeof r.assets === "object" ? r.assets : {};
|
|
1669
|
-
const layers = paintLayersOnly(
|
|
1671
|
+
const layers = paintLayersOnly(_chunkXN2NBLV5cjs.deserializeLayers.call(void 0, r.layers, { assets, problems }), problems);
|
|
1670
1672
|
const wanted = typeof r.activeLayerId === "string" ? r.activeLayerId : null;
|
|
1671
|
-
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));
|
|
1672
1674
|
const wetEvents = Array.isArray(r.wetEvents) ? r.wetEvents.filter((e) => e && typeof e === "object" && Number.isInteger(e.clock) && typeof e.kind === "string") : [];
|
|
1673
1675
|
const state = { canvas, paper, layers, activeLayerId, strokes: readStrokes(r.strokes, problems) };
|
|
1674
1676
|
if (wetEvents.length) state.wetEvents = wetEvents;
|
|
@@ -1680,7 +1682,7 @@ async function deserializePaintDocumentAsync(raw, store) {
|
|
|
1680
1682
|
if (!raw || typeof raw !== "object") throw new Error("Not a paint document: expected a JSON object.");
|
|
1681
1683
|
const r = raw;
|
|
1682
1684
|
const problems = [];
|
|
1683
|
-
const assets = await
|
|
1685
|
+
const assets = await _chunkXN2NBLV5cjs.resolveExternalAssets.call(void 0, _nullishCoalesce(r.assets, () => ( {})), store, problems);
|
|
1684
1686
|
const loaded = deserializePaintDocument({ ...r, assets });
|
|
1685
1687
|
return { ...loaded, problems: [...problems, ...loaded.problems] };
|
|
1686
1688
|
}
|
|
@@ -1757,13 +1759,13 @@ function viewPenToDocument(view, p) {
|
|
|
1757
1759
|
|
|
1758
1760
|
// src/paint-editor/input.ts
|
|
1759
1761
|
function samplePressure(e) {
|
|
1760
|
-
return
|
|
1762
|
+
return _chunkF2Y4E4GUcjs.pointerPressure.call(void 0, e);
|
|
1761
1763
|
}
|
|
1762
1764
|
function pointerToPenPoint(e, x, y, view) {
|
|
1763
1765
|
const p = { x, y, pressure: samplePressure(e) };
|
|
1764
1766
|
if (typeof e.timeStamp === "number" && Number.isFinite(e.timeStamp)) p.t = e.timeStamp;
|
|
1765
1767
|
if (e.pointerType !== "pen") return p;
|
|
1766
|
-
const o =
|
|
1768
|
+
const o = _chunk2XS6LTUPcjs.penOrientation.call(void 0, {
|
|
1767
1769
|
x,
|
|
1768
1770
|
y,
|
|
1769
1771
|
altitude: typeof e.altitudeAngle === "number" ? e.altitudeAngle : void 0,
|
|
@@ -1827,7 +1829,7 @@ function downloadBytes(bytes, fileName, mimeType) {
|
|
|
1827
1829
|
|
|
1828
1830
|
// src/paint-editor/wet.ts
|
|
1829
1831
|
var STROKE_WATER = 0.9;
|
|
1830
|
-
var STROKE_MASS =
|
|
1832
|
+
var STROKE_MASS = _chunkF2Y4E4GUcjs.PIGMENT_UNIT * 2.5;
|
|
1831
1833
|
var COVERAGE_STEPS = 4096;
|
|
1832
1834
|
function union2(a, b) {
|
|
1833
1835
|
if (!a) return { ...b };
|
|
@@ -1836,13 +1838,13 @@ function union2(a, b) {
|
|
|
1836
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 };
|
|
1837
1839
|
}
|
|
1838
1840
|
function wetPaperInput(paper) {
|
|
1839
|
-
const grain = new (0,
|
|
1841
|
+
const grain = new (0, _chunk2XS6LTUPcjs.PaperGrain)(paper, "wet");
|
|
1840
1842
|
const flat = grain.flat;
|
|
1841
1843
|
return {
|
|
1842
1844
|
absorption: paper.absorption,
|
|
1843
1845
|
permeability: paper.permeability,
|
|
1844
1846
|
roughness: flat ? 0 : paper.roughness,
|
|
1845
|
-
color:
|
|
1847
|
+
color: _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, paper.color),
|
|
1846
1848
|
heightAt: flat ? () => 0.5 : (x, y) => grain.at(x, y)
|
|
1847
1849
|
};
|
|
1848
1850
|
}
|
|
@@ -1850,27 +1852,27 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
1850
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);
|
|
1851
1853
|
this.init = init;
|
|
1852
1854
|
const brush = init.brush;
|
|
1853
|
-
this.smoother = new (0,
|
|
1854
|
-
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];
|
|
1855
1857
|
const wet = brush.wet;
|
|
1856
1858
|
const spacing = Math.max(0.02, brush.tip.spacing);
|
|
1857
1859
|
const perDab = Math.min(1, spacing * 1.2);
|
|
1858
1860
|
const thin = wet.thinner;
|
|
1859
|
-
this.medium = new (0,
|
|
1861
|
+
this.medium = new (0, _chunkF2Y4E4GUcjs.WetMedium)(init.world, init.laneId, {
|
|
1860
1862
|
water: STROKE_WATER * Math.min(1, wet.water * (1 + thin)) * perDab,
|
|
1861
1863
|
mass: STROKE_MASS * wet.pigment * (1 - 0.6 * thin) * perDab,
|
|
1862
1864
|
body: wet.body * (1 - thin)
|
|
1863
1865
|
});
|
|
1864
|
-
const rates =
|
|
1866
|
+
const rates = _chunkQBWEH3IMcjs.exchangeRates.call(void 0, brush.behavior.pickup, brush.behavior.mix, wet.load, brush.behavior.mixing);
|
|
1865
1867
|
this.states = copies.map((c, i) => ({
|
|
1866
|
-
walker: new (0,
|
|
1867
|
-
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,
|
|
1868
1870
|
last: null
|
|
1869
1871
|
}));
|
|
1870
1872
|
this.copies = copies;
|
|
1871
1873
|
this.depth = init.grain && !init.grain.flat ? Math.min(1, Math.max(0, init.paperDepth * brush.grain)) : 0;
|
|
1872
1874
|
const g = _nullishCoalesce(init.paint, () => ( null));
|
|
1873
|
-
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;
|
|
1874
1876
|
}
|
|
1875
1877
|
|
|
1876
1878
|
__init35() {this.dabCount = 0}
|
|
@@ -1942,7 +1944,7 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
1942
1944
|
}
|
|
1943
1945
|
applyDabs(copy, dabs, rects) {
|
|
1944
1946
|
for (const d of dabs) {
|
|
1945
|
-
const rect =
|
|
1947
|
+
const rect = _chunkQBWEH3IMcjs.dabRect.call(void 0, d, this.init.brush.tip.hardness);
|
|
1946
1948
|
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
1947
1949
|
this.dab(copy, d, rect);
|
|
1948
1950
|
rects.push(rect);
|
|
@@ -1959,7 +1961,7 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
1959
1961
|
const tip = this.tip.subarray(0, n);
|
|
1960
1962
|
const cov = this.cov.subarray(0, n);
|
|
1961
1963
|
tip.fill(0);
|
|
1962
|
-
|
|
1964
|
+
_chunkQBWEH3IMcjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.init.brush.tip.hardness, rect, tip);
|
|
1963
1965
|
const grain = this.depth > 0 ? this.init.grain : null;
|
|
1964
1966
|
const mask = this.init.mask;
|
|
1965
1967
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
@@ -1970,7 +1972,7 @@ var WetStrokeDriver = (_class5 = class {
|
|
|
1970
1972
|
tip[k] *= mx >= 0 && my >= 0 && mx < mask.width && my < mask.height ? mask.data[my * mask.width + mx] / 255 : 0;
|
|
1971
1973
|
}
|
|
1972
1974
|
let v = tip[k];
|
|
1973
|
-
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);
|
|
1974
1976
|
tip[k] = Math.round(tip[k] * COVERAGE_STEPS) / COVERAGE_STEPS;
|
|
1975
1977
|
cov[k] = Math.round(v * COVERAGE_STEPS) / COVERAGE_STEPS;
|
|
1976
1978
|
}
|
|
@@ -2048,7 +2050,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2048
2050
|
|
|
2049
2051
|
|
|
2050
2052
|
__init47() {this.world = null}
|
|
2051
|
-
__init48() {this.tilt = { ...
|
|
2053
|
+
__init48() {this.tilt = { ..._chunkF2Y4E4GUcjs.FLAT }}
|
|
2052
2054
|
__init49() {this.settings = /* @__PURE__ */ new Map()}
|
|
2053
2055
|
__init50() {this.paused = false}
|
|
2054
2056
|
/** Wet strokes dry as soon as they end (one undo step with the stroke). */
|
|
@@ -2072,8 +2074,8 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2072
2074
|
/** Starts the GPU engine for the world (once; it may turn out unavailable). */
|
|
2073
2075
|
startGpu() {
|
|
2074
2076
|
if (this.gpuMode === "off" || this.gpu || this.gpuStarting || this.gpuSupport) return;
|
|
2075
|
-
const provider = this.options.gpuProvider === void 0 ?
|
|
2076
|
-
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 }) => {
|
|
2077
2079
|
this.gpuSupport = support;
|
|
2078
2080
|
if (!engine) return;
|
|
2079
2081
|
if (this.gpuMode === "off" || !this.world) {
|
|
@@ -2126,7 +2128,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2126
2128
|
const { width, height } = this.host.canvas();
|
|
2127
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.");
|
|
2128
2130
|
if (!this.world) {
|
|
2129
|
-
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 });
|
|
2130
2132
|
this.world.setTilt(this.tilt);
|
|
2131
2133
|
this.world.gpuMinTiles = this.gpuMinTiles;
|
|
2132
2134
|
if (this.gpu) this.world.attachGpu(this.gpu);
|
|
@@ -2156,7 +2158,7 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2156
2158
|
settingsOf(layerId, medium = "watercolor") {
|
|
2157
2159
|
let s = this.settings.get(layerId);
|
|
2158
2160
|
if (!s) {
|
|
2159
|
-
s = { params:
|
|
2161
|
+
s = { params: _chunkF2Y4E4GUcjs.normalizeWetParams.call(void 0, WET_MEDIUM_PARAMS[medium], _chunkF2Y4E4GUcjs.DEFAULT_WET_PARAMS), flow: { ..._chunkF2Y4E4GUcjs.DEFAULT_FLOW } };
|
|
2160
2162
|
this.settings.set(layerId, s);
|
|
2161
2163
|
}
|
|
2162
2164
|
return s;
|
|
@@ -2165,31 +2167,31 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2165
2167
|
ensureLane(layerId, medium) {
|
|
2166
2168
|
const w = this.ensureWorld();
|
|
2167
2169
|
if (!w.hasLane(layerId)) {
|
|
2168
|
-
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)));
|
|
2169
2171
|
const s = this.settingsOf(layerId, medium);
|
|
2170
2172
|
w.ensureLane(layerId, { params: s.params, base });
|
|
2171
2173
|
const { width, height } = this.host.canvas();
|
|
2172
|
-
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);
|
|
2173
2175
|
}
|
|
2174
2176
|
return w;
|
|
2175
2177
|
}
|
|
2176
2178
|
setParams(layerId, update) {
|
|
2177
2179
|
const s = this.settingsOf(layerId);
|
|
2178
|
-
s.params =
|
|
2180
|
+
s.params = _chunkF2Y4E4GUcjs.normalizeWetParams.call(void 0, update, s.params);
|
|
2179
2181
|
if (_optionalChain([this, 'access', _100 => _100.world, 'optionalAccess', _101 => _101.hasLane, 'call', _102 => _102(layerId)])) this.world.setParams(layerId, s.params);
|
|
2180
2182
|
return { ...s.params };
|
|
2181
2183
|
}
|
|
2182
2184
|
setFlow(layerId, update) {
|
|
2183
2185
|
const s = this.settingsOf(layerId);
|
|
2184
|
-
s.flow =
|
|
2186
|
+
s.flow = _chunkF2Y4E4GUcjs.normalizeFlow.call(void 0, update, s.flow);
|
|
2185
2187
|
if (_optionalChain([this, 'access', _103 => _103.world, 'optionalAccess', _104 => _104.hasLane, 'call', _105 => _105(layerId)])) {
|
|
2186
2188
|
const { width, height } = this.host.canvas();
|
|
2187
|
-
this.world.setFlow(layerId,
|
|
2189
|
+
this.world.setFlow(layerId, _chunkF2Y4E4GUcjs.flowField.call(void 0, s.flow, width, height), s.flow.strength);
|
|
2188
2190
|
}
|
|
2189
2191
|
return { ...s.flow };
|
|
2190
2192
|
}
|
|
2191
2193
|
setTilt(update) {
|
|
2192
|
-
this.tilt =
|
|
2194
|
+
this.tilt = _chunkF2Y4E4GUcjs.normalizeTilt.call(void 0, update, this.tilt);
|
|
2193
2195
|
_optionalChain([this, 'access', _106 => _106.world, 'optionalAccess', _107 => _107.setTilt, 'call', _108 => _108(this.tilt)]);
|
|
2194
2196
|
return { ...this.tilt };
|
|
2195
2197
|
}
|
|
@@ -2404,10 +2406,10 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2404
2406
|
const w = this.world;
|
|
2405
2407
|
if (!w) return [];
|
|
2406
2408
|
const out = [];
|
|
2407
|
-
const tx0 = Math.max(0, Math.floor(rect.x /
|
|
2408
|
-
const ty0 = Math.max(0, Math.floor(rect.y /
|
|
2409
|
-
const tx1 = Math.floor((rect.x + rect.width - 1) /
|
|
2410
|
-
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);
|
|
2411
2413
|
for (let ty = ty0; ty <= ty1; ty++)
|
|
2412
2414
|
for (let tx = tx0; tx <= tx1; tx++) {
|
|
2413
2415
|
let merged = null;
|
|
@@ -2429,8 +2431,8 @@ var PaintWetLayers = (_class6 = class {
|
|
|
2429
2431
|
}
|
|
2430
2432
|
}, _class6);
|
|
2431
2433
|
function wetPigmentOf(hex, body) {
|
|
2432
|
-
const [r, g, b] =
|
|
2433
|
-
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));
|
|
2434
2436
|
}
|
|
2435
2437
|
|
|
2436
2438
|
// src/paint-editor/thumbnails.ts
|
|
@@ -2438,28 +2440,28 @@ var thumbWorld = null;
|
|
|
2438
2440
|
function paintWetTestStroke(brush, paper, color, width, height) {
|
|
2439
2441
|
if (!thumbWorld || thumbWorld.width !== width || thumbWorld.height !== height) {
|
|
2440
2442
|
_optionalChain([thumbWorld, 'optionalAccess', _137 => _137.destroy, 'call', _138 => _138()]);
|
|
2441
|
-
thumbWorld = new (0,
|
|
2443
|
+
thumbWorld = new (0, _chunkF2Y4E4GUcjs.WetWorld)(width, height, wetPaperInput(paper), { kernel: "typescript", threads: 0 });
|
|
2442
2444
|
} else thumbWorld.setPaper(wetPaperInput(paper));
|
|
2443
2445
|
const w = thumbWorld;
|
|
2444
2446
|
if (w.hasLane("thumb")) w.removeLane("thumb");
|
|
2445
2447
|
w.ensureLane("thumb");
|
|
2446
|
-
const [r, g, b] =
|
|
2448
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, color);
|
|
2447
2449
|
if (brush.wet.tool !== "paint" && brush.wet.tool !== "water") {
|
|
2448
2450
|
const half = Math.ceil(height / 2);
|
|
2449
|
-
w.paint("thumb", { x: 0, y: 0, width, height: half }, null, 0.4, Array.from(
|
|
2450
|
-
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));
|
|
2451
2453
|
}
|
|
2452
2454
|
const driver = new WetStrokeDriver({
|
|
2453
2455
|
world: w,
|
|
2454
2456
|
laneId: "thumb",
|
|
2455
2457
|
brush,
|
|
2456
2458
|
color: [r / 255, g / 255, b / 255],
|
|
2457
|
-
load: brushLoadForStroke(brush,
|
|
2459
|
+
load: brushLoadForStroke(brush, _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255]),
|
|
2458
2460
|
grain: paperGrain(paper),
|
|
2459
2461
|
paperDepth: paper.depth,
|
|
2460
|
-
paperColor:
|
|
2462
|
+
paperColor: _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, paper.color),
|
|
2461
2463
|
seed: 7,
|
|
2462
|
-
copies: [
|
|
2464
|
+
copies: [_chunk2XS6LTUPcjs.IDENTITY_COPY]
|
|
2463
2465
|
});
|
|
2464
2466
|
driver.push(thumbnailStroke(width, height));
|
|
2465
2467
|
driver.finish();
|
|
@@ -2479,7 +2481,7 @@ function thumbnailStroke(width, height) {
|
|
|
2479
2481
|
return pts;
|
|
2480
2482
|
}
|
|
2481
2483
|
function paintTestStroke(surface, brush, paper, color, width, height) {
|
|
2482
|
-
const [r, g, b] =
|
|
2484
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, color);
|
|
2483
2485
|
let result = surface;
|
|
2484
2486
|
let thick = null;
|
|
2485
2487
|
const session = new PaintStrokeSession(
|
|
@@ -2498,14 +2500,14 @@ function paintTestStroke(surface, brush, paper, color, width, height) {
|
|
|
2498
2500
|
lockTransparency: false,
|
|
2499
2501
|
brush,
|
|
2500
2502
|
color: [r, g, b, 255],
|
|
2501
|
-
background: [...
|
|
2503
|
+
background: [..._chunk2XS6LTUPcjs.hexToRgb8.call(void 0, paper.color), 255],
|
|
2502
2504
|
grain: paperGrain(paper),
|
|
2503
2505
|
paperDepth: paper.depth,
|
|
2504
2506
|
seed: 7,
|
|
2505
2507
|
colorHex: color,
|
|
2506
2508
|
affineCopies: [],
|
|
2507
|
-
copies: [
|
|
2508
|
-
mixerLoad: brushLoadForStroke(brush,
|
|
2509
|
+
copies: [_chunk2XS6LTUPcjs.IDENTITY_COPY],
|
|
2510
|
+
mixerLoad: brushLoadForStroke(brush, _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255]),
|
|
2509
2511
|
thick: brush.engine === "impasto" ? { channels: emptyThickChannels() } : void 0,
|
|
2510
2512
|
sticker: brush.engine === "sticker" ? { nextId: 1 } : void 0
|
|
2511
2513
|
}
|
|
@@ -2518,16 +2520,16 @@ function renderBrushThumbnail(brush, options) {
|
|
|
2518
2520
|
const width = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.width, () => ( 160)))));
|
|
2519
2521
|
const height = Math.max(16, Math.min(512, Math.round(_nullishCoalesce(options.height, () => ( 48)))));
|
|
2520
2522
|
const maxSize = height * 0.42;
|
|
2521
|
-
const b = brush.tip.size > maxSize ?
|
|
2522
|
-
const rgba = [...
|
|
2523
|
-
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);
|
|
2524
2526
|
if (b.engine === "eraser") {
|
|
2525
|
-
surface =
|
|
2527
|
+
surface = _chunkO7LUD7MHcjs.fillRect.call(void 0, surface, { x: 0, y: 0, width, height }, rgba);
|
|
2526
2528
|
} else if (b.engine === "wet") {
|
|
2527
2529
|
} else if (b.engine === "blender" || b.engine === "smudge" || b.engine === "mixer" && !b.loadsColor || b.behavior.pickup > 0) {
|
|
2528
2530
|
const half = Math.ceil(height / 2);
|
|
2529
|
-
surface =
|
|
2530
|
-
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]);
|
|
2531
2533
|
}
|
|
2532
2534
|
surface = b.engine === "wet" ? paintWetTestStroke(b, options.paper, options.color, width, height) : paintTestStroke(surface, b, options.paper, options.color, width, height);
|
|
2533
2535
|
const layer = { type: "pixel", id: "thumbnail", name: "thumbnail", visible: true, opacity: 1, blend: "normal", surface, offset: { x: 0, y: 0 } };
|
|
@@ -2823,8 +2825,8 @@ function colorHarmony(base, kind, options = {}) {
|
|
|
2823
2825
|
function readSwatch(raw) {
|
|
2824
2826
|
if (!raw || typeof raw !== "object") return null;
|
|
2825
2827
|
const r = raw;
|
|
2826
|
-
const g =
|
|
2827
|
-
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;
|
|
2828
2830
|
if (!color) return null;
|
|
2829
2831
|
const out = { color };
|
|
2830
2832
|
if (typeof r.name === "string" && r.name.trim()) out.name = r.name.trim().slice(0, 80);
|
|
@@ -2847,7 +2849,7 @@ var DEFAULT_SWATCHES = [
|
|
|
2847
2849
|
// src/paint-editor/mixing-pad.ts
|
|
2848
2850
|
var MIXING_PAD_WIDTH = 360;
|
|
2849
2851
|
var MIXING_PAD_HEIGHT = 220;
|
|
2850
|
-
var PAD_PAINT =
|
|
2852
|
+
var PAD_PAINT = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, {
|
|
2851
2853
|
id: "pad-paint",
|
|
2852
2854
|
name: "Pad paint",
|
|
2853
2855
|
category: "mixer",
|
|
@@ -2855,7 +2857,7 @@ var PAD_PAINT = _chunkW4LNKTHTcjs.normalizePaintBrush.call(void 0, {
|
|
|
2855
2857
|
tip: { size: 28, hardness: 0.75, spacing: 0.1, opacity: 1, flow: 0.7, pressureSize: false, pressureOpacity: false },
|
|
2856
2858
|
mixer: { wet: 0.45, load: 1, mix: 0.4, loadEachStroke: true, cleanEachStroke: true, mixing: "pigment" }
|
|
2857
2859
|
});
|
|
2858
|
-
var PAD_KNIFE =
|
|
2860
|
+
var PAD_KNIFE = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, {
|
|
2859
2861
|
id: "pad-knife",
|
|
2860
2862
|
name: "Palette knife",
|
|
2861
2863
|
category: "smudge",
|
|
@@ -2865,7 +2867,7 @@ var PAD_KNIFE = _chunkW4LNKTHTcjs.normalizePaintBrush.call(void 0, {
|
|
|
2865
2867
|
// A knife drags streaks of paint and folds them into each other, mixing them as pigment.
|
|
2866
2868
|
smudge: { strength: 0.6, length: 0.8, mixing: "pigment" }
|
|
2867
2869
|
});
|
|
2868
|
-
var PAD_BLOB =
|
|
2870
|
+
var PAD_BLOB = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, {
|
|
2869
2871
|
id: "pad-blob",
|
|
2870
2872
|
name: "Pad blob",
|
|
2871
2873
|
category: "custom",
|
|
@@ -2875,7 +2877,7 @@ var PAD_BLOB = _chunkW4LNKTHTcjs.normalizePaintBrush.call(void 0, {
|
|
|
2875
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); }
|
|
2876
2878
|
__init65() {this.width = MIXING_PAD_WIDTH}
|
|
2877
2879
|
__init66() {this.height = MIXING_PAD_HEIGHT}
|
|
2878
|
-
__init67() {this.surface =
|
|
2880
|
+
__init67() {this.surface = _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4)}
|
|
2879
2881
|
/** Increments on every change (for redrawing). */
|
|
2880
2882
|
__init68() {this.version = 0}
|
|
2881
2883
|
/** Paints (`paint`, with `color`) or smears (`knife`) through `points` in pad pixels. */
|
|
@@ -2887,12 +2889,12 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2887
2889
|
}
|
|
2888
2890
|
}
|
|
2889
2891
|
let brush = options.tool === "knife" ? PAD_KNIFE : PAD_PAINT;
|
|
2890
|
-
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);
|
|
2891
2893
|
return this.run(brush, points, options.color);
|
|
2892
2894
|
}
|
|
2893
2895
|
/** Paints `points` with `brush` in `color` on the pad. */
|
|
2894
2896
|
run(brush, points, color) {
|
|
2895
|
-
const [r, g, b] =
|
|
2897
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, color);
|
|
2896
2898
|
let result = null;
|
|
2897
2899
|
const session = new PaintStrokeSession(
|
|
2898
2900
|
{ update: () => {
|
|
@@ -2910,8 +2912,8 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2910
2912
|
seed: 1,
|
|
2911
2913
|
colorHex: color,
|
|
2912
2914
|
affineCopies: [],
|
|
2913
|
-
copies: [
|
|
2914
|
-
mixerLoad: brushLoadForStroke(brush,
|
|
2915
|
+
copies: [_chunk2XS6LTUPcjs.IDENTITY_COPY],
|
|
2916
|
+
mixerLoad: brushLoadForStroke(brush, _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD, [r / 255, g / 255, b / 255])
|
|
2915
2917
|
}
|
|
2916
2918
|
);
|
|
2917
2919
|
session.push(points);
|
|
@@ -2930,7 +2932,7 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2930
2932
|
const y0 = Math.max(0, Math.floor(y) - r);
|
|
2931
2933
|
const x1 = Math.min(this.width, Math.floor(x) + r + 1);
|
|
2932
2934
|
const y1 = Math.min(this.height, Math.floor(y) + r + 1);
|
|
2933
|
-
const px =
|
|
2935
|
+
const px = _chunkO7LUD7MHcjs.readRegion.call(void 0, this.surface, { x: x0, y: y0, width: x1 - x0, height: y1 - y0 });
|
|
2934
2936
|
let R = 0;
|
|
2935
2937
|
let G = 0;
|
|
2936
2938
|
let B = 0;
|
|
@@ -2947,7 +2949,7 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2947
2949
|
return `#${hex(R)}${hex(G)}${hex(B)}`;
|
|
2948
2950
|
}
|
|
2949
2951
|
clear() {
|
|
2950
|
-
this.surface =
|
|
2952
|
+
this.surface = _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4);
|
|
2951
2953
|
this.version++;
|
|
2952
2954
|
}
|
|
2953
2955
|
/**
|
|
@@ -2977,7 +2979,7 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2977
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.`);
|
|
2978
2980
|
}
|
|
2979
2981
|
const bounds = { x: Math.floor(cx - R), y: Math.floor(cy - R), width: Math.ceil(2 * R), height: Math.ceil(2 * R) };
|
|
2980
|
-
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));
|
|
2981
2983
|
const used = paints.filter((p) => p.parts > 0);
|
|
2982
2984
|
const area = Math.PI * (0.7 * R) ** 2;
|
|
2983
2985
|
used.forEach((p, i) => {
|
|
@@ -2986,10 +2988,10 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
2986
2988
|
const off = used.length === 1 ? 0 : 0.45 * R;
|
|
2987
2989
|
const x = Math.min(cx + R - r, Math.max(cx - R + r, cx + Math.cos(a) * off));
|
|
2988
2990
|
const y = Math.min(cy + R - r, Math.max(cy - R + r, cy + Math.sin(a) * off));
|
|
2989
|
-
const blob =
|
|
2991
|
+
const blob = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: Math.max(2, 2 * r) } }, PAD_BLOB);
|
|
2990
2992
|
this.run(blob, [{ x, y }], p.color.toLowerCase());
|
|
2991
2993
|
});
|
|
2992
|
-
const knife =
|
|
2994
|
+
const knife = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_KNIFE.tip, size: Math.max(12, R * 0.5) } }, PAD_KNIFE);
|
|
2993
2995
|
for (let k = 0; k < passes; k++) {
|
|
2994
2996
|
const stir = [];
|
|
2995
2997
|
const turns = 1.6;
|
|
@@ -3000,26 +3002,26 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
3000
3002
|
}
|
|
3001
3003
|
this.run(knife, stir, "#000000");
|
|
3002
3004
|
}
|
|
3003
|
-
const mixed =
|
|
3004
|
-
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)),
|
|
3005
3007
|
paints.map((p) => p.parts)
|
|
3006
3008
|
);
|
|
3007
|
-
const core =
|
|
3009
|
+
const core = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...PAD_BLOB.tip, size: R * 1.1, hardness: 0.55 } }, PAD_BLOB);
|
|
3008
3010
|
const hex = "#" + mixed.map((v) => Math.round(v * 255).toString(16).padStart(2, "0")).join("");
|
|
3009
3011
|
this.run(core, [{ x: cx, y: cy }], hex);
|
|
3010
3012
|
return { color: this.pick(cx, cy, 2), bounds };
|
|
3011
3013
|
}
|
|
3012
3014
|
/** The pad's pixels as a PNG data URL (with alpha), for saving. */
|
|
3013
3015
|
toPng() {
|
|
3014
|
-
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 }));
|
|
3015
3017
|
}
|
|
3016
3018
|
/** Replaces the pad with a PNG (data URL or base64) of the pad's size, as `toPng` writes. */
|
|
3017
3019
|
fromPng(png) {
|
|
3018
|
-
const bytes = png.startsWith("data:") ? _optionalChain([
|
|
3019
|
-
if (!bytes || !
|
|
3020
|
-
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);
|
|
3021
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}.`);
|
|
3022
|
-
this.surface =
|
|
3024
|
+
this.surface = _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, { width: img.width, height: img.height, data: img.data }, 4);
|
|
3023
3025
|
this.version++;
|
|
3024
3026
|
}
|
|
3025
3027
|
/** Whether nothing is on the pad. */
|
|
@@ -3028,7 +3030,7 @@ var MixingPad = (_class8 = class {constructor() { _class8.prototype.__init65.cal
|
|
|
3028
3030
|
}
|
|
3029
3031
|
/** The pad over white, `width × height` RGBA. */
|
|
3030
3032
|
pixels() {
|
|
3031
|
-
const px =
|
|
3033
|
+
const px = _chunkO7LUD7MHcjs.readRegion.call(void 0, this.surface, { x: 0, y: 0, width: this.width, height: this.height });
|
|
3032
3034
|
for (let i = 0; i < px.length; i += 4) {
|
|
3033
3035
|
const a = px[i + 3] / 255;
|
|
3034
3036
|
px[i] = Math.round(px[i] * a + 255 * (1 - a));
|
|
@@ -3052,7 +3054,7 @@ function replayItems(doc) {
|
|
|
3052
3054
|
}
|
|
3053
3055
|
function emptiedLayers(layers) {
|
|
3054
3056
|
let out = [...layers];
|
|
3055
|
-
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 } }));
|
|
3056
3058
|
return out;
|
|
3057
3059
|
}
|
|
3058
3060
|
async function replayPainting(source, target, options = {}) {
|
|
@@ -3184,7 +3186,7 @@ async function buildTimeLapse(source, target, options = {}) {
|
|
|
3184
3186
|
const f = replayFrame(target, maxSide, stroke);
|
|
3185
3187
|
width = f.width;
|
|
3186
3188
|
height = f.height;
|
|
3187
|
-
frames.push(
|
|
3189
|
+
frames.push(_chunkO7LUD7MHcjs.encodePng.call(void 0, f.width, f.height, f.data));
|
|
3188
3190
|
};
|
|
3189
3191
|
shoot(0);
|
|
3190
3192
|
await replayPainting(source, target, {
|
|
@@ -3328,15 +3330,15 @@ function readPaintEffectSource(raw) {
|
|
|
3328
3330
|
};
|
|
3329
3331
|
}
|
|
3330
3332
|
function paperEffectToJSON(p) {
|
|
3331
|
-
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) };
|
|
3332
3334
|
}
|
|
3333
3335
|
function paperEffectFromJSON(raw, width, height) {
|
|
3334
3336
|
const source = readPaintEffectSource(raw);
|
|
3335
3337
|
if (!source) throw new Error("it is not an effect (effect id and values)");
|
|
3336
3338
|
const r = raw;
|
|
3337
|
-
const parsed = typeof r.png === "string" ?
|
|
3339
|
+
const parsed = typeof r.png === "string" ? _chunkO7LUD7MHcjs.parseDataUrl.call(void 0, r.png) : null;
|
|
3338
3340
|
if (!parsed) throw new Error("its pixels are missing");
|
|
3339
|
-
const image =
|
|
3341
|
+
const image = _chunkO7LUD7MHcjs.decodePng.call(void 0, parsed.bytes);
|
|
3340
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}`);
|
|
3341
3343
|
const opacity = typeof r.opacity === "number" && r.opacity >= 0 && r.opacity <= 1 ? r.opacity : 1;
|
|
3342
3344
|
const blend = PAPER_EFFECT_BLENDS.includes(r.blend) ? r.blend : "multiply";
|
|
@@ -3361,7 +3363,7 @@ function parseColor(value, what = "color") {
|
|
|
3361
3363
|
return value.trim().toLowerCase();
|
|
3362
3364
|
}
|
|
3363
3365
|
function rgbaOf(hex) {
|
|
3364
|
-
const [r, g, b] =
|
|
3366
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, hex);
|
|
3365
3367
|
return [r, g, b, 255];
|
|
3366
3368
|
}
|
|
3367
3369
|
function rgbToHex(r, g, b) {
|
|
@@ -3389,7 +3391,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3389
3391
|
__init76() {this.secondaryColor = "#ffffff"}
|
|
3390
3392
|
/** Gradient paint chosen with `setPaint` (`null`: the paint colour). */
|
|
3391
3393
|
__init77() {this.gradient = null}
|
|
3392
|
-
__init78() {this.mixerLoad =
|
|
3394
|
+
__init78() {this.mixerLoad = _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD}
|
|
3393
3395
|
__init79() {this.view = { ...DEFAULT_VIEW, pan: { ...DEFAULT_VIEW.pan } }}
|
|
3394
3396
|
|
|
3395
3397
|
|
|
@@ -3430,9 +3432,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3430
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);
|
|
3431
3433
|
this.historyLimit = Math.max(1, _nullishCoalesce(options.historyLimit, () => ( 200)));
|
|
3432
3434
|
this.doc = createPaintDocument({ width: options.width, height: options.height, dpi: options.dpi, paper: this.resolvePaper(options.paper) });
|
|
3433
|
-
this.userBrushes = (_nullishCoalesce(options.brushes, () => ( []))).map((b) =>
|
|
3434
|
-
const start = _nullishCoalesce(this.findBrush(_nullishCoalesce(options.brushId, () => (
|
|
3435
|
-
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);
|
|
3436
3438
|
this.color = options.color ? parseColor(options.color) : "#1f2937";
|
|
3437
3439
|
this.hand = options.hand === "left" ? "left" : "right";
|
|
3438
3440
|
this.encodeImage = options.encodeImage;
|
|
@@ -3443,12 +3445,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3443
3445
|
canvas: () => this.doc.canvas,
|
|
3444
3446
|
paper: () => this.doc.paper,
|
|
3445
3447
|
layerSurface: (id) => {
|
|
3446
|
-
const l = _optionalChain([
|
|
3448
|
+
const l = _optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _159 => _159.layer]);
|
|
3447
3449
|
return isPixelLayer(l) ? l.surface : null;
|
|
3448
3450
|
},
|
|
3449
3451
|
updateSurfaces: (surfaces, rects) => {
|
|
3450
3452
|
let layers = this.doc.layers;
|
|
3451
|
-
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 }));
|
|
3452
3454
|
this.doc = { ...this.doc, layers };
|
|
3453
3455
|
this.emit(rects.length ? rects : "all");
|
|
3454
3456
|
},
|
|
@@ -3479,7 +3481,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3479
3481
|
this.cached = {
|
|
3480
3482
|
document: this.doc,
|
|
3481
3483
|
brush: this.brush,
|
|
3482
|
-
brushes: this.library ??= [...
|
|
3484
|
+
brushes: this.library ??= [..._chunk2XS6LTUPcjs.BUILTIN_BRUSHES, ...this.userBrushes],
|
|
3483
3485
|
color: this.color,
|
|
3484
3486
|
secondaryColor: this.secondaryColor,
|
|
3485
3487
|
paint: _nullishCoalesce(this.gradient, () => ( { type: "color", color: this.color })),
|
|
@@ -3646,7 +3648,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3646
3648
|
// --- Canvas and paper ----------------------------------------------------------
|
|
3647
3649
|
resolvePaper(paper) {
|
|
3648
3650
|
if (typeof paper === "string") {
|
|
3649
|
-
const p =
|
|
3651
|
+
const p = _chunk2XS6LTUPcjs.paperPreset.call(void 0, paper);
|
|
3650
3652
|
if (!p) throw new PaintEditorError(`Unknown paper "${paper}". Call list_papers for the ids.`);
|
|
3651
3653
|
return p;
|
|
3652
3654
|
}
|
|
@@ -3691,23 +3693,23 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3691
3693
|
this.requireIdle("changing the paper");
|
|
3692
3694
|
let base = this.doc.paper;
|
|
3693
3695
|
if (update.preset !== void 0 && update.preset !== this.doc.paper.preset) {
|
|
3694
|
-
const p =
|
|
3696
|
+
const p = _chunk2XS6LTUPcjs.paperPreset.call(void 0, update.preset);
|
|
3695
3697
|
if (!p) throw new PaintEditorError(`Unknown paper "${update.preset}". Call list_papers for the ids.`);
|
|
3696
3698
|
base = p;
|
|
3697
3699
|
}
|
|
3698
3700
|
const { preset: _p, ...rest } = update;
|
|
3699
3701
|
if (rest.color !== void 0) parseColor(rest.color, "paper color");
|
|
3700
|
-
const paper =
|
|
3702
|
+
const paper = _chunk2XS6LTUPcjs.normalizePaper.call(void 0, { ...rest, preset: base.preset }, base);
|
|
3701
3703
|
const changedKeys = Object.keys(rest).filter((k) => k !== "name");
|
|
3702
3704
|
if (changedKeys.length && update.preset === void 0) paper.preset = base.preset;
|
|
3703
3705
|
if (this.wet.world) this.beginWetOp();
|
|
3704
3706
|
this.commit("Paper", { ...this.doc, paper });
|
|
3705
3707
|
this.wet.paperChanged();
|
|
3706
|
-
return
|
|
3708
|
+
return _chunk2XS6LTUPcjs.clonePaper.call(void 0, paper);
|
|
3707
3709
|
}
|
|
3708
3710
|
// --- Layers --------------------------------------------------------------------
|
|
3709
3711
|
getLayer(id) {
|
|
3710
|
-
return _optionalChain([
|
|
3712
|
+
return _optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id), 'optionalAccess', _174 => _174.layer]);
|
|
3711
3713
|
}
|
|
3712
3714
|
/** The active pixel layer (or `undefined`). */
|
|
3713
3715
|
getActiveLayer() {
|
|
@@ -3726,12 +3728,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3726
3728
|
walk(this.doc.layers, null, 0);
|
|
3727
3729
|
return out;
|
|
3728
3730
|
}
|
|
3729
|
-
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))) {
|
|
3730
3732
|
let bounds = null;
|
|
3731
3733
|
if (l.type === "pixel") {
|
|
3732
|
-
const b =
|
|
3734
|
+
const b = _chunkO7LUD7MHcjs.contentBounds.call(void 0, l.surface);
|
|
3733
3735
|
bounds = b ? { ...b, x: b.x + l.offset.x, y: b.y + l.offset.y } : null;
|
|
3734
|
-
} 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);
|
|
3735
3737
|
return {
|
|
3736
3738
|
id: l.id,
|
|
3737
3739
|
name: l.name,
|
|
@@ -3758,7 +3760,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3758
3760
|
if (!id) throw new PaintEditorError(`There is no active layer to ${what}; add one with add_layer.`);
|
|
3759
3761
|
const l = this.requireLayer(id);
|
|
3760
3762
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; ${what} a pixel layer inside it.`);
|
|
3761
|
-
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.`);
|
|
3762
3764
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) before you ${what} it.`);
|
|
3763
3765
|
return l;
|
|
3764
3766
|
}
|
|
@@ -3771,7 +3773,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3771
3773
|
/** Adds an empty pixel layer or group above `aboveId` (default: the active layer) and makes it active. */
|
|
3772
3774
|
addLayer(options = {}) {
|
|
3773
3775
|
this.requireIdle("adding a layer");
|
|
3774
|
-
const count =
|
|
3776
|
+
const count = _chunkAEAAN4ADcjs.flattenLayers.call(void 0, this.doc.layers).length;
|
|
3775
3777
|
const type = _nullishCoalesce(options.type, () => ( "pixel"));
|
|
3776
3778
|
const name = _optionalChain([options, 'access', _179 => _179.name, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181()]) || (type === "group" ? `Group ${count + 1}` : `Layer ${count + 1}`);
|
|
3777
3779
|
const layer = type === "group" ? { type: "group", id: newPaintLayerId(), name, visible: true, opacity: 1, blend: "pass-through", children: [] } : createPaintLayer(name);
|
|
@@ -3783,21 +3785,21 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3783
3785
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
3784
3786
|
parentId = g.id;
|
|
3785
3787
|
} else if (above) {
|
|
3786
|
-
const loc =
|
|
3788
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, above);
|
|
3787
3789
|
if (!loc) throw new PaintEditorError(`Unknown layer "${above}". Call list_layers for the ids.`);
|
|
3788
3790
|
parentId = _nullishCoalesce(_optionalChain([loc, 'access', _182 => _182.parent, 'optionalAccess', _183 => _183.id]), () => ( null));
|
|
3789
3791
|
index = loc.index + 1;
|
|
3790
3792
|
}
|
|
3791
|
-
const layers =
|
|
3793
|
+
const layers = _chunkAEAAN4ADcjs.insertLayer.call(void 0, this.doc.layers, layer, parentId, index);
|
|
3792
3794
|
this.commit(type === "group" ? "Add group" : "Add layer", { ...this.doc, layers, activeLayerId: layer.id });
|
|
3793
3795
|
return this.describeLayer(layer);
|
|
3794
3796
|
}
|
|
3795
3797
|
updateLayer(id, update) {
|
|
3796
3798
|
this.requireIdle("changing a layer");
|
|
3797
3799
|
const l = this.requireLayer(id);
|
|
3798
|
-
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}).`);
|
|
3799
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.`);
|
|
3800
|
-
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")) {
|
|
3801
3803
|
throw new PaintEditorError(`Unknown blend mode "${update.blend}". Call get_canvas_info for the blend modes.`);
|
|
3802
3804
|
}
|
|
3803
3805
|
if (update.name !== void 0 && !update.name.trim()) throw new PaintEditorError("name is empty; give the layer a name.");
|
|
@@ -3811,31 +3813,31 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3811
3813
|
const locks = { ..._nullishCoalesce(l.locks, () => ( {})), ...update.locks };
|
|
3812
3814
|
next.locks = Object.values(locks).some(Boolean) ? locks : void 0;
|
|
3813
3815
|
}
|
|
3814
|
-
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) });
|
|
3815
3817
|
return this.describeLayer(next);
|
|
3816
3818
|
}
|
|
3817
3819
|
removeLayer(id) {
|
|
3818
3820
|
this.requireIdle("removing a layer");
|
|
3819
3821
|
const l = this.requireLayer(id);
|
|
3820
|
-
if (
|
|
3821
|
-
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));
|
|
3822
3824
|
if (wetIds.length) {
|
|
3823
3825
|
this.beginWetOp();
|
|
3824
3826
|
for (const x of wetIds) this.wet.world.removeLane(x);
|
|
3825
3827
|
}
|
|
3826
|
-
const layers =
|
|
3828
|
+
const layers = _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, id, () => null);
|
|
3827
3829
|
let active = this.doc.activeLayerId;
|
|
3828
|
-
if (active && !
|
|
3829
|
-
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)) });
|
|
3830
3832
|
return { removed: id, activeLayerId: active };
|
|
3831
3833
|
}
|
|
3832
3834
|
duplicateLayer(id) {
|
|
3833
3835
|
this.requireIdle("duplicating a layer");
|
|
3834
|
-
if (
|
|
3836
|
+
if (_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id)) {
|
|
3835
3837
|
const inside = (l) => l.type === "group" ? l.children.flatMap(inside) : [l.id];
|
|
3836
|
-
this.dryLayersFirst(inside(
|
|
3838
|
+
this.dryLayersFirst(inside(_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id).layer));
|
|
3837
3839
|
}
|
|
3838
|
-
const loc =
|
|
3840
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3839
3841
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3840
3842
|
const thick = { ..._nullishCoalesce(this.doc.thick, () => ( {})) };
|
|
3841
3843
|
const stickers = { ..._nullishCoalesce(this.doc.stickers, () => ( {})) };
|
|
@@ -3846,53 +3848,53 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3846
3848
|
return l.type === "group" ? { ...l, id: id2, children: l.children.map(copy) } : { ...l, id: id2 };
|
|
3847
3849
|
};
|
|
3848
3850
|
const dup = { ...copy(loc.layer), name: `${loc.layer.name} copy` };
|
|
3849
|
-
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);
|
|
3850
3852
|
this.commit("Duplicate layer", this.withWetEvents({ ...this.doc, layers, activeLayerId: dup.id, ...this.doc.thick ? { thick } : {}, ...this.doc.stickers ? { stickers } : {} }));
|
|
3851
3853
|
return this.describeLayer(dup);
|
|
3852
3854
|
}
|
|
3853
3855
|
/** Moves a layer to `index` (0 = bottom) within `parentId` (default its own parent; `null` = top level). */
|
|
3854
3856
|
moveLayer(id, index, parentId) {
|
|
3855
3857
|
this.requireIdle("moving a layer");
|
|
3856
|
-
const loc =
|
|
3858
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3857
3859
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3858
3860
|
const target = parentId === void 0 ? _nullishCoalesce(_optionalChain([loc, 'access', _191 => _191.parent, 'optionalAccess', _192 => _192.id]), () => ( null)) : parentId;
|
|
3859
3861
|
if (target) {
|
|
3860
3862
|
const g = this.requireLayer(target);
|
|
3861
3863
|
if (g.type !== "group") throw new PaintEditorError(`Layer "${g.name}" is not a group; pass a group id as parentId.`);
|
|
3862
|
-
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.");
|
|
3863
3865
|
}
|
|
3864
|
-
const without =
|
|
3865
|
-
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;
|
|
3866
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).`);
|
|
3867
|
-
const layers =
|
|
3869
|
+
const layers = _chunkAEAAN4ADcjs.insertLayer.call(void 0, without, loc.layer, target, index);
|
|
3868
3870
|
this.commit("Move layer", { ...this.doc, layers });
|
|
3869
3871
|
return this.describeLayer(loc.layer);
|
|
3870
3872
|
}
|
|
3871
3873
|
/** Merges a pixel layer into the pixel layer below it (keeping the lower one's settings). */
|
|
3872
3874
|
mergeDown(id) {
|
|
3873
3875
|
this.requireIdle("merging");
|
|
3874
|
-
const pre =
|
|
3876
|
+
const pre = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3875
3877
|
if (pre) {
|
|
3876
3878
|
const sib = pre.parent ? pre.parent.children : this.doc.layers;
|
|
3877
3879
|
this.dryLayersFirst([id, _optionalChain([sib, 'access', _193 => _193[pre.index - 1], 'optionalAccess', _194 => _194.id])].filter((x) => Boolean(x)));
|
|
3878
3880
|
}
|
|
3879
|
-
const loc =
|
|
3881
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id);
|
|
3880
3882
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
3881
3883
|
const siblings = loc.parent ? loc.parent.children : this.doc.layers;
|
|
3882
3884
|
const below = siblings[loc.index - 1];
|
|
3883
3885
|
const upper = loc.layer;
|
|
3884
3886
|
if (!isPixelLayer(upper) || !isPixelLayer(below)) throw new PaintEditorError("Merge down needs a pixel layer directly above another pixel layer in the same group.");
|
|
3885
|
-
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.`);
|
|
3886
3888
|
const rect = unionRect(this.describeLayer(below).bounds, this.describeLayer(upper).bounds);
|
|
3887
|
-
let surface =
|
|
3889
|
+
let surface = _chunkO7LUD7MHcjs.emptySurface.call(void 0, 4);
|
|
3888
3890
|
if (rect) {
|
|
3889
3891
|
const base = { ...below, opacity: 1, blend: "normal", visible: true, clipped: void 0, mask: void 0 };
|
|
3890
3892
|
const upperLit = this.litLayers([upper])[0];
|
|
3891
3893
|
const px = createPaintCompositor().composite([base, upper.visible ? upperLit : { ...upperLit, opacity: 0 }], rect, this.sources());
|
|
3892
|
-
surface =
|
|
3894
|
+
surface = _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, { width: rect.width, height: rect.height, data: px }, 4, rect.x, rect.y);
|
|
3893
3895
|
}
|
|
3894
3896
|
const merged = { ...below, surface, offset: { x: 0, y: 0 } };
|
|
3895
|
-
const layers =
|
|
3897
|
+
const layers = _chunkAEAAN4ADcjs.mapLayer.call(void 0, _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, upper.id, () => null), below.id, () => merged);
|
|
3896
3898
|
this.commit("Merge down", this.withWetEvents({ ...this.doc, layers, activeLayerId: below.id, ...this.thickWithout([upper.id]), ...this.stickersWithout([upper.id, below.id]) }));
|
|
3897
3899
|
return this.describeLayer(merged);
|
|
3898
3900
|
}
|
|
@@ -3905,7 +3907,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3905
3907
|
this.wet.world.removeLane(l.id);
|
|
3906
3908
|
}
|
|
3907
3909
|
const bounds = this.describeLayer(l).bounds;
|
|
3908
|
-
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 }));
|
|
3909
3911
|
return { layerId: l.id, bounds };
|
|
3910
3912
|
}
|
|
3911
3913
|
/**
|
|
@@ -3925,16 +3927,16 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3925
3927
|
if (!(grainAmount >= 0 && grainAmount <= 1)) throw new PaintEditorError(`grain ${grainAmount} is out of range; use 0..1.`);
|
|
3926
3928
|
const pressure = _nullishCoalesce(options.pressure, () => ( 0.5));
|
|
3927
3929
|
const blend = _nullishCoalesce(options.blend, () => ( "normal"));
|
|
3928
|
-
if (!
|
|
3930
|
+
if (!_chunkO7LUD7MHcjs.isBlendMode.call(void 0, blend)) throw new PaintEditorError(`Unknown blend mode "${blend}".`);
|
|
3929
3931
|
const { width, height } = this.doc.canvas;
|
|
3930
3932
|
const rect = { x: 0, y: 0, width, height };
|
|
3931
|
-
const coverage = new (0,
|
|
3933
|
+
const coverage = new (0, _chunkQBWEH3IMcjs.CoverageMap)();
|
|
3932
3934
|
const depth = grainAmount * this.doc.paper.depth;
|
|
3933
3935
|
const grain = depth > 0 ? paperGrain(this.doc.paper) : null;
|
|
3934
|
-
for (const { tx, ty } of
|
|
3935
|
-
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) };
|
|
3936
3938
|
const vals = new Float32Array(r.width * r.height);
|
|
3937
|
-
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;
|
|
3938
3940
|
coverage.accumulate(r, vals, 1);
|
|
3939
3941
|
}
|
|
3940
3942
|
const apply = {
|
|
@@ -3943,25 +3945,25 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3943
3945
|
background: rgbaOf(this.doc.paper.color),
|
|
3944
3946
|
opacity,
|
|
3945
3947
|
blend,
|
|
3946
|
-
lockTransparency:
|
|
3948
|
+
lockTransparency: _chunkAEAAN4ADcjs.isLayerLocked.call(void 0, l, "transparency"),
|
|
3947
3949
|
selection: null,
|
|
3948
3950
|
offset: l.offset
|
|
3949
3951
|
};
|
|
3950
3952
|
const surface = this.applyCoverage(l, coverage, rect, apply);
|
|
3951
|
-
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 } }));
|
|
3952
3954
|
return { layerId: l.id, bounds: rect };
|
|
3953
3955
|
}
|
|
3954
3956
|
applyCoverage(l, coverage, rect, apply) {
|
|
3955
3957
|
const base = l.surface;
|
|
3956
3958
|
const tiles = new Map(base.tiles);
|
|
3957
|
-
for (const { tx, ty } of
|
|
3958
|
-
const key =
|
|
3959
|
-
const src = _nullishCoalesce(_optionalChain([base, 'access', _199 => _199.tiles, 'access', _200 => _200.get, 'call', _201 => _201(key), 'optionalAccess', _202 => _202.data]), () => ( new Uint8ClampedArray(
|
|
3960
|
-
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);
|
|
3961
3963
|
if (tile) tiles.set(key, tile);
|
|
3962
3964
|
else tiles.delete(key);
|
|
3963
3965
|
}
|
|
3964
|
-
return new (0,
|
|
3966
|
+
return new (0, _chunkO7LUD7MHcjs.TiledSurface)(4, tiles, 0);
|
|
3965
3967
|
}
|
|
3966
3968
|
// --- Provider effects ------------------------------------------------------------
|
|
3967
3969
|
/** The registered effects provider, or `null`. */
|
|
@@ -3989,7 +3991,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
3989
3991
|
}
|
|
3990
3992
|
/** The effect a layer is drawn from, or `undefined` for other layers. */
|
|
3991
3993
|
getEffectLayer(layerId) {
|
|
3992
|
-
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;
|
|
3993
3995
|
}
|
|
3994
3996
|
/** The effect paper (without its pixels), or `null`. */
|
|
3995
3997
|
getPaperEffect() {
|
|
@@ -4110,17 +4112,17 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4110
4112
|
this.requireIdle("adding a layer");
|
|
4111
4113
|
this.checkOpacity(options.opacity);
|
|
4112
4114
|
this.checkTime(options.time);
|
|
4113
|
-
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.`);
|
|
4114
4116
|
if (options.aboveId !== void 0) this.requireLayer(options.aboveId);
|
|
4115
4117
|
const d = await this.describeEffect(effect, "layer");
|
|
4116
4118
|
const values = this.effectValues(d, { ...d.defaults }, options.values);
|
|
4117
4119
|
const pixels = await this.renderEffectCanvas(d, values, options.time);
|
|
4118
4120
|
this.requireIdle("adding a layer");
|
|
4119
4121
|
const above = _nullishCoalesce(options.aboveId, () => ( this.doc.activeLayerId));
|
|
4120
|
-
const loc = above ?
|
|
4122
|
+
const loc = above ? _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, above) : null;
|
|
4121
4123
|
if (options.aboveId !== void 0 && !loc) throw new PaintEditorError(`Layer "${options.aboveId}" was removed while the effect rendered.`);
|
|
4122
|
-
const layer = { ...createPaintLayer(_optionalChain([options, 'access', _212 => _212.name, 'optionalAccess', _213 => _213.trim, 'call', _214 => _214()]) || d.name), surface:
|
|
4123
|
-
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);
|
|
4124
4126
|
const source = this.sourceOf(d, values, options.time);
|
|
4125
4127
|
this.commit("Add effect layer", { ...this.doc, layers, activeLayerId: layer.id, effectLayers: { ..._nullishCoalesce(this.doc.effectLayers, () => ( {})), [layer.id]: source } });
|
|
4126
4128
|
return { layer: this.describeLayer(layer), source };
|
|
@@ -4144,7 +4146,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4144
4146
|
this.requireIdle("changing an effect layer");
|
|
4145
4147
|
if (!isPixelLayer(now)) throw new PaintEditorError(`Layer "${l.name}" was removed while the effect rendered.`);
|
|
4146
4148
|
const source = this.sourceOf(d, values, time);
|
|
4147
|
-
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);
|
|
4148
4150
|
return source;
|
|
4149
4151
|
}
|
|
4150
4152
|
/** Turns an effect layer into a plain pixel layer, keeping its pixels (one undo step). */
|
|
@@ -4170,11 +4172,11 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4170
4172
|
const pixels = await this.renderEffectCanvas(d, values, options.time);
|
|
4171
4173
|
const now = this.sameLayerAfterRender(l);
|
|
4172
4174
|
const rect = this.canvasRectOf(now);
|
|
4173
|
-
const before =
|
|
4175
|
+
const before = _chunkO7LUD7MHcjs.readRegion.call(void 0, now.surface, rect);
|
|
4174
4176
|
let after = overPixels(before, pixels.data, _nullishCoalesce(options.opacity, () => ( 1)));
|
|
4175
|
-
if (options.lockTransparency ||
|
|
4176
|
-
const surface =
|
|
4177
|
-
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 })) });
|
|
4178
4180
|
return { layerId: now.id, source: this.sourceOf(d, values, options.time) };
|
|
4179
4181
|
}
|
|
4180
4182
|
/**
|
|
@@ -4189,16 +4191,16 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4189
4191
|
if (!(amount >= 0 && amount <= 1)) throw new PaintEditorError(`amount ${options.amount} is out of range; use 0..1.`);
|
|
4190
4192
|
this.checkTime(options.time);
|
|
4191
4193
|
const l = this.effectTarget(layerId, "light");
|
|
4192
|
-
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).`);
|
|
4193
4195
|
const d = await this.describeEffect(effect, "light");
|
|
4194
4196
|
const values = this.effectValues(d, { ...d.defaults }, options.values);
|
|
4195
4197
|
const rect = this.canvasRectOf(l);
|
|
4196
|
-
const before =
|
|
4198
|
+
const before = _chunkO7LUD7MHcjs.readRegion.call(void 0, l.surface, rect);
|
|
4197
4199
|
const inputs = { source: { width: rect.width, height: rect.height, data: before } };
|
|
4198
4200
|
const heightInput = d.inputs.find((i) => i.kind === "image" && /^(height|depth|relief)$/i.test(i.name));
|
|
4199
4201
|
const relief = _optionalChain([this, 'access', _217 => _217.doc, 'access', _218 => _218.thick, 'optionalAccess', _219 => _219[l.id]]);
|
|
4200
4202
|
if (heightInput && relief) {
|
|
4201
|
-
const h =
|
|
4203
|
+
const h = _chunkO7LUD7MHcjs.readRegion.call(void 0, relief.height, rect);
|
|
4202
4204
|
const rgba = new Uint8ClampedArray(rect.width * rect.height * 4);
|
|
4203
4205
|
for (let i = 0; i < h.length; i++) rgba.set([h[i], h[i], h[i], 255], i * 4);
|
|
4204
4206
|
inputs[heightInput.name] = { width: rect.width, height: rect.height, data: rgba };
|
|
@@ -4210,18 +4212,18 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4210
4212
|
}
|
|
4211
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 });
|
|
4212
4214
|
const now = this.sameLayerAfterRender(l);
|
|
4213
|
-
const surface =
|
|
4214
|
-
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 })) });
|
|
4215
4217
|
return { layerId: now.id, source: this.sourceOf(d, values, options.time), amount };
|
|
4216
4218
|
}
|
|
4217
4219
|
// --- Brushes -------------------------------------------------------------------
|
|
4218
4220
|
findBrush(id) {
|
|
4219
|
-
return _nullishCoalesce(
|
|
4221
|
+
return _nullishCoalesce(_chunk2XS6LTUPcjs.BUILTIN_BRUSHES.find((b) => b.id === id), () => ( this.userBrushes.find((b) => b.id === id)));
|
|
4220
4222
|
}
|
|
4221
4223
|
/** A library brush by id (`undefined` when unknown). */
|
|
4222
4224
|
getBrush(id) {
|
|
4223
4225
|
const b = this.findBrush(id);
|
|
4224
|
-
return b ?
|
|
4226
|
+
return b ? _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, b, b) : void 0;
|
|
4225
4227
|
}
|
|
4226
4228
|
requireBrush(id) {
|
|
4227
4229
|
const b = this.findBrush(id);
|
|
@@ -4236,7 +4238,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4236
4238
|
const { id, ...changes } = update;
|
|
4237
4239
|
const base = id !== void 0 ? this.requireBrush(id) : this.brush;
|
|
4238
4240
|
if (changes.paint !== void 0 && changes.paint !== null) this.readStrokePaint(changes.paint);
|
|
4239
|
-
const next =
|
|
4241
|
+
const next = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { ...changes, id: base.id }, base);
|
|
4240
4242
|
if (base.builtin && !Object.keys(changes).length) next.builtin = true;
|
|
4241
4243
|
else delete next.builtin;
|
|
4242
4244
|
this.brush = next;
|
|
@@ -4245,10 +4247,10 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4245
4247
|
}
|
|
4246
4248
|
/** Saves the active brush (or `brush`) into the user library under `id` / `name`. */
|
|
4247
4249
|
saveBrush(options) {
|
|
4248
|
-
if (!
|
|
4249
|
-
if (
|
|
4250
|
-
const source = options.brush ?
|
|
4251
|
-
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)) });
|
|
4252
4254
|
delete saved.builtin;
|
|
4253
4255
|
const i = this.userBrushes.findIndex((b) => b.id === options.id);
|
|
4254
4256
|
if (i >= 0) this.userBrushes[i] = saved;
|
|
@@ -4258,7 +4260,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4258
4260
|
return saved;
|
|
4259
4261
|
}
|
|
4260
4262
|
removeBrush(id) {
|
|
4261
|
-
if (
|
|
4263
|
+
if (_chunk2XS6LTUPcjs.BUILTIN_BRUSHES.some((b) => b.id === id)) throw new PaintEditorError(`"${id}" is a built-in brush and cannot be removed.`);
|
|
4262
4264
|
const i = this.userBrushes.findIndex((b) => b.id === id);
|
|
4263
4265
|
if (i < 0) throw new PaintEditorError(`Unknown brush "${id}". Call list_brushes for the ids.`);
|
|
4264
4266
|
this.userBrushes.splice(i, 1);
|
|
@@ -4267,12 +4269,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4267
4269
|
}
|
|
4268
4270
|
/** The user's saved brushes. */
|
|
4269
4271
|
getUserBrushes() {
|
|
4270
|
-
return this.userBrushes.map((b) =>
|
|
4272
|
+
return this.userBrushes.map((b) => _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, b, b));
|
|
4271
4273
|
}
|
|
4272
4274
|
/** A brush library file of the given brushes (default: the user's brushes). */
|
|
4273
4275
|
exportBrushes(ids) {
|
|
4274
4276
|
const list = ids ? ids.map((id) => this.requireBrush(id)) : this.userBrushes;
|
|
4275
|
-
return { format: "pixerate-brushes", version: 1, brushes: list.map(
|
|
4277
|
+
return { format: "pixerate-brushes", version: 1, brushes: list.map(_chunk2XS6LTUPcjs.brushToJSON) };
|
|
4276
4278
|
}
|
|
4277
4279
|
/**
|
|
4278
4280
|
* Adds the brushes of a library file to the user library. A brush whose id is taken is skipped
|
|
@@ -4282,14 +4284,14 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4282
4284
|
const problems = [];
|
|
4283
4285
|
let list;
|
|
4284
4286
|
try {
|
|
4285
|
-
list =
|
|
4287
|
+
list = _chunk2XS6LTUPcjs.parseBrushLibrary.call(void 0, file, problems);
|
|
4286
4288
|
} catch (e) {
|
|
4287
4289
|
throw new PaintEditorError(e.message);
|
|
4288
4290
|
}
|
|
4289
4291
|
const added = [];
|
|
4290
4292
|
const skipped = [];
|
|
4291
4293
|
for (const b of list) {
|
|
4292
|
-
if (
|
|
4294
|
+
if (_chunk2XS6LTUPcjs.BUILTIN_BRUSHES.some((x) => x.id === b.id)) {
|
|
4293
4295
|
skipped.push(b.id);
|
|
4294
4296
|
problems.push(`"${b.id}" is a built-in brush id; rename it to import it.`);
|
|
4295
4297
|
continue;
|
|
@@ -4331,9 +4333,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4331
4333
|
setPaint(paint) {
|
|
4332
4334
|
let p;
|
|
4333
4335
|
try {
|
|
4334
|
-
p =
|
|
4336
|
+
p = _chunkQBWEH3IMcjs.parsePaintSource.call(void 0, paint);
|
|
4335
4337
|
} catch (e) {
|
|
4336
|
-
if (e instanceof
|
|
4338
|
+
if (e instanceof _chunkQBWEH3IMcjs.PaintSourceError) throw new PaintEditorError(e.message);
|
|
4337
4339
|
throw e;
|
|
4338
4340
|
}
|
|
4339
4341
|
if (p.type === "color") {
|
|
@@ -4350,19 +4352,19 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4350
4352
|
* brush's gradient, else the editor's gradient paint. Erasers, blenders and smudges take none.
|
|
4351
4353
|
*/
|
|
4352
4354
|
strokeGradient(init, brush, color) {
|
|
4353
|
-
if (!
|
|
4355
|
+
if (!_chunk2XS6LTUPcjs.brushTakesPaint.call(void 0, brush)) return null;
|
|
4354
4356
|
let g = null;
|
|
4355
4357
|
if (init.paint !== void 0) {
|
|
4356
4358
|
const p = this.readStrokePaint(init.paint);
|
|
4357
4359
|
g = p.type === "gradient" ? p : null;
|
|
4358
4360
|
} else g = _nullishCoalesce(brush.paint, () => ( (init.color === void 0 ? this.gradient : null)));
|
|
4359
|
-
return g ?
|
|
4361
|
+
return g ? _chunkQBWEH3IMcjs.resolvePaintGradient.call(void 0, g, { paint: color, secondary: this.secondaryColor }) : null;
|
|
4360
4362
|
}
|
|
4361
4363
|
readStrokePaint(raw) {
|
|
4362
4364
|
try {
|
|
4363
|
-
return
|
|
4365
|
+
return _chunkQBWEH3IMcjs.parsePaintSource.call(void 0, raw);
|
|
4364
4366
|
} catch (e) {
|
|
4365
|
-
if (e instanceof
|
|
4367
|
+
if (e instanceof _chunkQBWEH3IMcjs.PaintSourceError) throw new PaintEditorError(e.message);
|
|
4366
4368
|
throw e;
|
|
4367
4369
|
}
|
|
4368
4370
|
}
|
|
@@ -4384,7 +4386,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4384
4386
|
if (options.layerId !== void 0) {
|
|
4385
4387
|
const l = this.requireLayer(options.layerId);
|
|
4386
4388
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; pick from a pixel layer or the composite.`);
|
|
4387
|
-
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);
|
|
4388
4390
|
return { color: rgbToHex(r, g, b), alpha: Math.round(a / 255 * 1e3) / 1e3 };
|
|
4389
4391
|
}
|
|
4390
4392
|
const d = this.exportCompositor.composite(this.renderLayers({}), { x: px, y: py, width: 1, height: 1 }, this.sources());
|
|
@@ -4393,14 +4395,14 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4393
4395
|
// --- Mixer Brush ---------------------------------------------------------------
|
|
4394
4396
|
/** Fills the Mixer Brush reservoir with a colour (default the editor colour). */
|
|
4395
4397
|
loadMixerBrush(color) {
|
|
4396
|
-
const [r, g, b] =
|
|
4397
|
-
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]);
|
|
4398
4400
|
this.emit([]);
|
|
4399
4401
|
return this.mixerLoad;
|
|
4400
4402
|
}
|
|
4401
4403
|
/** Empties the pickup well (and with `emptyReservoir` the loaded paint too). */
|
|
4402
4404
|
cleanMixerBrush(emptyReservoir = false) {
|
|
4403
|
-
this.mixerLoad = emptyReservoir ?
|
|
4405
|
+
this.mixerLoad = emptyReservoir ? _chunkQBWEH3IMcjs.EMPTY_MIXER_LOAD : _chunkQBWEH3IMcjs.cleanMixer.call(void 0, this.mixerLoad);
|
|
4404
4406
|
this.emit([]);
|
|
4405
4407
|
return this.mixerLoad;
|
|
4406
4408
|
}
|
|
@@ -4423,7 +4425,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4423
4425
|
// --- Strokes -------------------------------------------------------------------
|
|
4424
4426
|
strokeBrush(init) {
|
|
4425
4427
|
let brush = init.brushId !== void 0 ? this.requireBrush(init.brushId) : this.brush;
|
|
4426
|
-
if (init.brush) brush =
|
|
4428
|
+
if (init.brush) brush = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { ...init.brush, id: brush.id }, brush);
|
|
4427
4429
|
return brush;
|
|
4428
4430
|
}
|
|
4429
4431
|
/**
|
|
@@ -4447,41 +4449,41 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4447
4449
|
let layer = (() => {
|
|
4448
4450
|
const id = _nullishCoalesce(init.layerId, () => ( doc.activeLayerId));
|
|
4449
4451
|
if (!id) throw new PaintEditorError("There is no active layer to paint on; add one with add_layer.");
|
|
4450
|
-
const loc =
|
|
4452
|
+
const loc = _chunkAEAAN4ADcjs.findLayer.call(void 0, doc.layers, id);
|
|
4451
4453
|
if (!loc) throw new PaintEditorError(`Unknown layer "${id}". Call list_layers for the ids.`);
|
|
4452
4454
|
const l = loc.layer;
|
|
4453
4455
|
if (!isPixelLayer(l)) throw new PaintEditorError(`Layer "${l.name}" is a group; paint on a pixel layer inside it.`);
|
|
4454
|
-
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.`);
|
|
4455
4457
|
if (!l.visible) throw new PaintEditorError(`Layer "${l.name}" is hidden; show it (update_layer visible true) to paint on it.`);
|
|
4456
4458
|
return l;
|
|
4457
4459
|
})();
|
|
4458
4460
|
const brush = this.strokeBrush(init);
|
|
4459
4461
|
const stickerLayer = Boolean(_optionalChain([doc, 'access', _225 => _225.stickers, 'optionalAccess', _226 => _226[layer.id], 'optionalAccess', _227 => _227.length]));
|
|
4460
4462
|
if (brush.engine === "sticker") {
|
|
4461
|
-
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.`);
|
|
4462
4464
|
} else if (stickerLayer) {
|
|
4463
4465
|
throw new PaintEditorError(`Layer "${layer.name}" is a sticker layer (its pixels are drawn from its stickers); paint on another layer (add_layer).`);
|
|
4464
4466
|
}
|
|
4465
4467
|
let wet;
|
|
4466
|
-
if (
|
|
4468
|
+
if (_chunk2XS6LTUPcjs.isWetBrush.call(void 0, brush)) {
|
|
4467
4469
|
this.requireWetIdle("painting");
|
|
4468
4470
|
if (layer.offset.x || layer.offset.y) {
|
|
4469
|
-
const moved = { ...layer, surface:
|
|
4470
|
-
this.doc = { ...this.doc, layers:
|
|
4471
|
-
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) };
|
|
4472
4474
|
layer = moved;
|
|
4473
4475
|
}
|
|
4474
|
-
if (!this.wet.wetLayerIds().includes(layer.id) && this.wet.wetLayerIds().length >=
|
|
4475
|
-
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).`);
|
|
4476
4478
|
}
|
|
4477
4479
|
this.beginWetOp();
|
|
4478
4480
|
const world = this.wet.ensureLane(layer.id, brush.wet.medium);
|
|
4479
4481
|
const id = layer.id;
|
|
4480
4482
|
const wetColor = init.color === void 0 ? this.color : parseColor(init.color);
|
|
4481
|
-
const [r, g, b] =
|
|
4483
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, wetColor);
|
|
4482
4484
|
const wetGradient = this.strokeGradient(init, brush, wetColor);
|
|
4483
4485
|
const load = _nullishCoalesce(init.load, () => ( brushLoadForStroke(brush, this.mixerLoad, [r / 255, g / 255, b / 255])));
|
|
4484
|
-
const seedW = _nullishCoalesce(init.seed, () => (
|
|
4486
|
+
const seedW = _nullishCoalesce(init.seed, () => ( _chunkQBWEH3IMcjs.mix32.call(void 0, this.seedCounter * 2654435761 >>> 0) & 2147483647));
|
|
4485
4487
|
const copiesW = (_nullishCoalesce(init.copies, () => ( this.strokeCopies()))).filter((m) => m.some((v, i) => v !== IDENTITY_AFFINE[i]));
|
|
4486
4488
|
const driver = new WetStrokeDriver({
|
|
4487
4489
|
world,
|
|
@@ -4491,7 +4493,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4491
4493
|
load,
|
|
4492
4494
|
grain: paperGrain(doc.paper),
|
|
4493
4495
|
paperDepth: doc.paper.depth,
|
|
4494
|
-
paperColor:
|
|
4496
|
+
paperColor: _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, doc.paper.color),
|
|
4495
4497
|
seed: seedW,
|
|
4496
4498
|
copies: [IDENTITY_AFFINE, ...copiesW].map(affineCopy),
|
|
4497
4499
|
mask: init.maskStencils ? this.stencilSelection(init.maskStencils) : init.stencils !== false ? this.stencilSelection() : null,
|
|
@@ -4501,7 +4503,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4501
4503
|
wet = { driver, surface: () => world.display(id).surface };
|
|
4502
4504
|
} else if (this.wet.wetLayerIds().includes(layer.id)) {
|
|
4503
4505
|
this.dryLayersFirst([layer.id]);
|
|
4504
|
-
const dried =
|
|
4506
|
+
const dried = _chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, layer.id).layer;
|
|
4505
4507
|
layer = dried;
|
|
4506
4508
|
}
|
|
4507
4509
|
let color = init.color === void 0 ? this.color : parseColor(init.color);
|
|
@@ -4514,13 +4516,13 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4514
4516
|
const selection = init.maskStencils ? this.stencilSelection(init.maskStencils) : useStencils ? this.stencilSelection() : null;
|
|
4515
4517
|
const inputFilter = snapper || stencilSnapper ? (p) => stencilSnapper ? stencilSnapper.snap(snapper ? snapper.snap(p) : p) : snapper.snap(p) : void 0;
|
|
4516
4518
|
const rgba = rgbaOf(color);
|
|
4517
|
-
const seed = _nullishCoalesce(init.seed, () => (
|
|
4519
|
+
const seed = _nullishCoalesce(init.seed, () => ( _chunkQBWEH3IMcjs.mix32.call(void 0, this.seedCounter++ * 2654435761 >>> 0) & 2147483647));
|
|
4518
4520
|
const copies = (_nullishCoalesce(init.copies, () => ( this.strokeCopies()))).filter((m) => m.some((v, i) => v !== IDENTITY_AFFINE[i]));
|
|
4519
4521
|
const session = new PaintStrokeSession(host, {
|
|
4520
4522
|
layerId: layer.id,
|
|
4521
4523
|
surface: layer.surface,
|
|
4522
4524
|
offset: layer.offset,
|
|
4523
|
-
lockTransparency:
|
|
4525
|
+
lockTransparency: _chunkAEAAN4ADcjs.isLayerLocked.call(void 0, layer, "transparency"),
|
|
4524
4526
|
brush,
|
|
4525
4527
|
color: rgba,
|
|
4526
4528
|
background: rgbaOf(doc.paper.color),
|
|
@@ -4548,7 +4550,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4548
4550
|
const stroke = {
|
|
4549
4551
|
id: `s${this.strokeCounter++}`,
|
|
4550
4552
|
layerId: session.layerId,
|
|
4551
|
-
brush:
|
|
4553
|
+
brush: _chunk2XS6LTUPcjs.brushToJSON.call(void 0, init.brush),
|
|
4552
4554
|
color: init.colorHex,
|
|
4553
4555
|
points: session.points.map((p) => ({ ...p })),
|
|
4554
4556
|
seed: init.seed
|
|
@@ -4615,7 +4617,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4615
4617
|
const thick = ch ? { ..._nullishCoalesce(this.doc.thick, () => ( {})), [l.id]: ch } : this.doc.thick;
|
|
4616
4618
|
const sprayed = s.stickers();
|
|
4617
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;
|
|
4618
|
-
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);
|
|
4619
4621
|
}
|
|
4620
4622
|
};
|
|
4621
4623
|
let session;
|
|
@@ -4643,13 +4645,13 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4643
4645
|
if (cancelled || !surface) return;
|
|
4644
4646
|
const stroke = this.record(s);
|
|
4645
4647
|
s.result.strokeId = stroke.id;
|
|
4646
|
-
const l =
|
|
4648
|
+
const l = _chunkAEAAN4ADcjs.findLayer.call(void 0, out.layers, s.layerId).layer;
|
|
4647
4649
|
const offset = s.init.wet ? { x: 0, y: 0 } : l.offset;
|
|
4648
4650
|
const ch = s.thickChannels();
|
|
4649
4651
|
const sprayed = s.stickers();
|
|
4650
4652
|
out = {
|
|
4651
4653
|
...out,
|
|
4652
|
-
layers:
|
|
4654
|
+
layers: _chunkAEAAN4ADcjs.mapLayer.call(void 0, out.layers, l.id, () => ({ ...l, surface, offset })),
|
|
4653
4655
|
strokes: [...out.strokes, stroke],
|
|
4654
4656
|
...ch ? { thick: { ..._nullishCoalesce(out.thick, () => ( {})), [l.id]: ch } } : {},
|
|
4655
4657
|
...sprayed ? { stickers: { ..._nullishCoalesce(out.stickers, () => ( {})), [l.id]: [..._nullishCoalesce(_optionalChain([out, 'access', _242 => _242.stickers, 'optionalAccess', _243 => _243[l.id]]), () => ( [])), ...sprayed] } } : {}
|
|
@@ -4664,8 +4666,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4664
4666
|
if (this.wet.instantDry && result.strokeId) {
|
|
4665
4667
|
this.wet.dry(session.layerId);
|
|
4666
4668
|
this.logWet({ kind: "dry", layerId: session.layerId, at: out.strokes.length });
|
|
4667
|
-
const dried =
|
|
4668
|
-
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 })) };
|
|
4669
4671
|
}
|
|
4670
4672
|
result.wet = this.wet.isWet(session.layerId);
|
|
4671
4673
|
}
|
|
@@ -4740,13 +4742,13 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4740
4742
|
let brush = v.brush;
|
|
4741
4743
|
if (options.brushId !== void 0) {
|
|
4742
4744
|
const b = this.requireBrush(options.brushId);
|
|
4743
|
-
brush =
|
|
4745
|
+
brush = _chunk2XS6LTUPcjs.normalizePaintBrush.call(void 0, { tip: { ...b.tip, size: b.tip.size * (v.brush.tip.size / s.brush.tip.size) } }, b);
|
|
4744
4746
|
}
|
|
4745
4747
|
const layerId = _nullishCoalesce(options.layerId, () => ( s.layerId));
|
|
4746
|
-
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.`);
|
|
4747
4749
|
let load = s.load;
|
|
4748
4750
|
if (load && options.color !== void 0 && load.reservoir) {
|
|
4749
|
-
const [r, g, b] =
|
|
4751
|
+
const [r, g, b] = _chunk2XS6LTUPcjs.hexToRgb8.call(void 0, options.color);
|
|
4750
4752
|
load = { ...load, reservoir: [r / 255, g / 255, b / 255] };
|
|
4751
4753
|
}
|
|
4752
4754
|
const paint = v.paint && options.color === void 0 ? { paint: v.paint } : {};
|
|
@@ -4839,7 +4841,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4839
4841
|
/** `renderHighRes` as PNG bytes. */
|
|
4840
4842
|
async exportHighResPng(options) {
|
|
4841
4843
|
const img = await this.renderHighRes(options);
|
|
4842
|
-
return
|
|
4844
|
+
return _chunkO7LUD7MHcjs.encodePng.call(void 0, img.width, img.height, img.data);
|
|
4843
4845
|
}
|
|
4844
4846
|
async renderHighRes(options) {
|
|
4845
4847
|
const target = this.createReplayTarget(options.scale);
|
|
@@ -4891,7 +4893,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4891
4893
|
wetState() {
|
|
4892
4894
|
const st = this.getState().wet;
|
|
4893
4895
|
const backend = this.wet.backend();
|
|
4894
|
-
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() };
|
|
4895
4897
|
}
|
|
4896
4898
|
/**
|
|
4897
4899
|
* Engine B, the WebGPU accelerator for large wet areas: whether it may run, its state (`off`,
|
|
@@ -4960,11 +4962,11 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
4960
4962
|
wetPaper(options = {}) {
|
|
4961
4963
|
this.requireIdle("wetting the paper");
|
|
4962
4964
|
const l = this.wetLayer(options.layerId, "wet the paper of");
|
|
4963
|
-
if (
|
|
4965
|
+
if (_chunkAEAAN4ADcjs.isLayerLocked.call(void 0, l, "pixels")) throw new PaintEditorError(`Layer "${l.name}" has its pixels locked; unlock it first.`);
|
|
4964
4966
|
const amount = _nullishCoalesce(options.amount, () => ( 1));
|
|
4965
4967
|
if (!(amount > 0 && amount <= 1)) throw new PaintEditorError(`amount ${amount} is out of range; use above 0 up to 1.`);
|
|
4966
4968
|
const rect = _nullishCoalesce(this.checkRect(options.rect), () => ( { x: 0, y: 0, width: this.doc.canvas.width, height: this.doc.canvas.height }));
|
|
4967
|
-
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).`);
|
|
4968
4970
|
const before = this.doc;
|
|
4969
4971
|
this.beginWetOp();
|
|
4970
4972
|
const world = this.wet.ensureLane(l.id);
|
|
@@ -5044,7 +5046,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5044
5046
|
const live = this.live;
|
|
5045
5047
|
if (!live) return this.doc.layers;
|
|
5046
5048
|
if (_optionalChain([this, 'access', _253 => _253.liveLayers, 'optionalAccess', _254 => _254.key]) === live.surface) return this.liveLayers.layers;
|
|
5047
|
-
const layers =
|
|
5049
|
+
const layers = _chunkAEAAN4ADcjs.mapLayer.call(void 0, this.doc.layers, live.layerId, (l) => ({ ...l, surface: live.surface }));
|
|
5048
5050
|
this.liveLayers = { key: live.surface, layers };
|
|
5049
5051
|
return layers;
|
|
5050
5052
|
}
|
|
@@ -5081,7 +5083,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5081
5083
|
let out = layers;
|
|
5082
5084
|
for (const id of ids) {
|
|
5083
5085
|
const baked = this.wet.bakedSurface(id);
|
|
5084
|
-
if (baked &&
|
|
5086
|
+
if (baked && _chunkAEAAN4ADcjs.findLayer.call(void 0, out, id)) out = _chunkAEAAN4ADcjs.mapLayer.call(void 0, out, id, (l) => ({ ...l, surface: baked }));
|
|
5085
5087
|
}
|
|
5086
5088
|
return out;
|
|
5087
5089
|
}
|
|
@@ -5094,12 +5096,12 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5094
5096
|
const ids = /* @__PURE__ */ new Set([...Object.keys(_nullishCoalesce(thick, () => ( {}))), ...live ? [live.layerId] : []]);
|
|
5095
5097
|
for (const id of ids) {
|
|
5096
5098
|
const ch = _optionalChain([live, 'optionalAccess', _257 => _257.layerId]) === id ? live.channels : _optionalChain([thick, 'optionalAccess', _258 => _258[id]]);
|
|
5097
|
-
const l = ch && _optionalChain([
|
|
5099
|
+
const l = ch && _optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, out, id), 'optionalAccess', _259 => _259.layer]);
|
|
5098
5100
|
if (!ch || !isPixelLayer(l)) continue;
|
|
5099
5101
|
let cache = this.litCaches.get(id);
|
|
5100
5102
|
if (!cache) this.litCaches.set(id, cache = new LitCache());
|
|
5101
5103
|
const lit = cache.lit(l.surface, ch, this.lighting);
|
|
5102
|
-
if (lit !== l.surface) out =
|
|
5104
|
+
if (lit !== l.surface) out = _chunkAEAAN4ADcjs.mapLayer.call(void 0, out, id, () => ({ ...l, surface: lit }));
|
|
5103
5105
|
}
|
|
5104
5106
|
return out;
|
|
5105
5107
|
}
|
|
@@ -5107,7 +5109,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5107
5109
|
let layers = this.litLayers((_nullishCoalesce(options.wet, () => ( "display"))) === "dried" ? this.driedLayers() : this.currentLayers());
|
|
5108
5110
|
if (options.layerIds) {
|
|
5109
5111
|
const picked = [];
|
|
5110
|
-
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))));
|
|
5111
5113
|
layers = picked.map((l) => ({ ...l, visible: true }));
|
|
5112
5114
|
}
|
|
5113
5115
|
const under = options.paper === false ? [] : [paperNode(this.doc.paper, this.lighting)];
|
|
@@ -5150,7 +5152,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5150
5152
|
/** Wet settings saved with the document (`null` when they are all defaults). */
|
|
5151
5153
|
wetJSON() {
|
|
5152
5154
|
const layers = {};
|
|
5153
|
-
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 } };
|
|
5154
5156
|
const flat = this.wet.tilt.angle === 0;
|
|
5155
5157
|
if (!Object.keys(layers).length && flat) return void 0;
|
|
5156
5158
|
return { tilt: { ...this.wet.tilt }, layers };
|
|
@@ -5159,7 +5161,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5159
5161
|
this.wet.reset();
|
|
5160
5162
|
if (!raw || typeof raw !== "object") return;
|
|
5161
5163
|
const r = raw;
|
|
5162
|
-
this.wet.setTilt(
|
|
5164
|
+
this.wet.setTilt(_chunkF2Y4E4GUcjs.normalizeTilt.call(void 0, _nullishCoalesce(r.tilt, () => ( {}))));
|
|
5163
5165
|
if (r.layers && typeof r.layers === "object") {
|
|
5164
5166
|
for (const [id, v] of Object.entries(r.layers)) {
|
|
5165
5167
|
if (!v || typeof v !== "object") {
|
|
@@ -5167,7 +5169,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5167
5169
|
continue;
|
|
5168
5170
|
}
|
|
5169
5171
|
const x = v;
|
|
5170
|
-
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, () => ( {}))) });
|
|
5171
5173
|
}
|
|
5172
5174
|
}
|
|
5173
5175
|
}
|
|
@@ -5176,17 +5178,17 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5176
5178
|
const ext = { ...this.extensions };
|
|
5177
5179
|
const channels = {};
|
|
5178
5180
|
for (const [id, ch] of Object.entries(_nullishCoalesce(this.doc.thick, () => ( {})))) {
|
|
5179
|
-
if (!
|
|
5181
|
+
if (!_chunkAEAAN4ADcjs.findLayer.call(void 0, this.doc.layers, id)) continue;
|
|
5180
5182
|
const saved = thickToJSON(ch);
|
|
5181
5183
|
if (saved) channels[id] = saved;
|
|
5182
5184
|
}
|
|
5183
5185
|
if (Object.keys(channels).length) ext.layerChannels = channels;
|
|
5184
5186
|
else delete ext.layerChannels;
|
|
5185
5187
|
const stickers = {};
|
|
5186
|
-
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 }));
|
|
5187
5189
|
if (Object.keys(stickers).length) ext.stickers = stickers;
|
|
5188
5190
|
else delete ext.stickers;
|
|
5189
|
-
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])));
|
|
5190
5192
|
if (effectLayers) ext.effectLayers = effectLayers;
|
|
5191
5193
|
else delete ext.effectLayers;
|
|
5192
5194
|
if (this.doc.paperEffect) ext.paperEffect = paperEffectToJSON(this.doc.paperEffect);
|
|
@@ -5202,8 +5204,8 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5202
5204
|
if (ext.stickers && typeof ext.stickers === "object") {
|
|
5203
5205
|
const stickers = {};
|
|
5204
5206
|
for (const [id, list] of Object.entries(ext.stickers)) {
|
|
5205
|
-
if (!
|
|
5206
|
-
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);
|
|
5207
5209
|
if (ok.length !== list.length) problems.push(`Some stickers of layer "${id}" could not be read; they were dropped.`);
|
|
5208
5210
|
stickers[id] = ok.map((x) => ({ ...x }));
|
|
5209
5211
|
}
|
|
@@ -5212,7 +5214,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5212
5214
|
if (ext.effectLayers && typeof ext.effectLayers === "object") {
|
|
5213
5215
|
const effectLayers = {};
|
|
5214
5216
|
for (const [id, v] of Object.entries(ext.effectLayers)) {
|
|
5215
|
-
if (!isPixelLayer(_optionalChain([
|
|
5217
|
+
if (!isPixelLayer(_optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, state.layers, id), 'optionalAccess', _264 => _264.layer]))) continue;
|
|
5216
5218
|
const source = readPaintEffectSource(v);
|
|
5217
5219
|
if (source) effectLayers[id] = source;
|
|
5218
5220
|
else problems.push(`The effect of layer "${id}" could not be read; it loads as a plain layer.`);
|
|
@@ -5230,7 +5232,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5230
5232
|
if (!raw || typeof raw !== "object") return state;
|
|
5231
5233
|
const thick = {};
|
|
5232
5234
|
for (const [id, v] of Object.entries(raw)) {
|
|
5233
|
-
if (!
|
|
5235
|
+
if (!_chunkAEAAN4ADcjs.findLayer.call(void 0, state.layers, id)) continue;
|
|
5234
5236
|
try {
|
|
5235
5237
|
thick[id] = thickFromJSON(v);
|
|
5236
5238
|
} catch (e) {
|
|
@@ -5289,7 +5291,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5289
5291
|
/** The canvas as PNG bytes (paper included by default; `scale` below 1 shrinks it). */
|
|
5290
5292
|
exportPng(options = {}) {
|
|
5291
5293
|
const img = this.scaled(options);
|
|
5292
|
-
return
|
|
5294
|
+
return _chunkO7LUD7MHcjs.encodePng.call(void 0, img.width, img.height, img.data);
|
|
5293
5295
|
}
|
|
5294
5296
|
scaled(options) {
|
|
5295
5297
|
const full = this.compositePixels(options);
|
|
@@ -5332,22 +5334,22 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5332
5334
|
opacity: 1,
|
|
5333
5335
|
blend: "normal",
|
|
5334
5336
|
locks: { all: true },
|
|
5335
|
-
surface:
|
|
5337
|
+
surface: _chunkO7LUD7MHcjs.surfaceFromPixels.call(void 0, paperPixels, 4),
|
|
5336
5338
|
offset: { x: 0, y: 0 }
|
|
5337
5339
|
};
|
|
5338
5340
|
const merged = this.compositePixels({ paper: true }).data;
|
|
5339
5341
|
const changed = /* @__PURE__ */ new Map();
|
|
5340
5342
|
const toStandard = (layers2) => layers2.map((l) => {
|
|
5341
|
-
const blend = l.blend === "pass-through" ? l.blend :
|
|
5343
|
+
const blend = l.blend === "pass-through" ? l.blend : _chunkO7LUD7MHcjs.standardBlendMode.call(void 0, l.blend);
|
|
5342
5344
|
if (blend !== l.blend) changed.set(l.blend, [..._nullishCoalesce(changed.get(l.blend), () => ( [])), l.name]);
|
|
5343
5345
|
const next = blend === l.blend ? l : { ...l, blend };
|
|
5344
5346
|
return next.type === "group" ? { ...next, children: toStandard(next.children) } : next;
|
|
5345
5347
|
});
|
|
5346
5348
|
const layers = toStandard(dried);
|
|
5347
|
-
const result =
|
|
5349
|
+
const result = _chunkXN2NBLV5cjs.exportPsd.call(void 0, { width, height, layers: [paperLayer, ...layers], merged, resolution: dpi });
|
|
5348
5350
|
for (const [mode, names] of changed) {
|
|
5349
|
-
const label = _nullishCoalesce(_optionalChain([
|
|
5350
|
-
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)));
|
|
5351
5353
|
const list = names.map((n) => `"${n}"`).join(", ");
|
|
5352
5354
|
const one = names.length === 1;
|
|
5353
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).`);
|
|
@@ -5357,7 +5359,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5357
5359
|
/** `render_preview` as a base64 PNG. */
|
|
5358
5360
|
previewPngBase64(options = {}) {
|
|
5359
5361
|
const img = this.renderPreview(options);
|
|
5360
|
-
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 };
|
|
5361
5363
|
}
|
|
5362
5364
|
// --- Guides --------------------------------------------------------------------
|
|
5363
5365
|
setGuides(next) {
|
|
@@ -5395,17 +5397,17 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5395
5397
|
pixels = this.decodeImage(input.png.trim().startsWith("data:") ? input.png.trim() : `data:image/png;base64,${input.png.trim()}`, what);
|
|
5396
5398
|
} else throw new PaintEditorError(`${what}: pass png (a PNG as base64 or a data URL) or pixels.`);
|
|
5397
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.`);
|
|
5398
|
-
const src =
|
|
5400
|
+
const src = _chunkO7LUD7MHcjs.pngDataUrl.call(void 0, pixels.width, pixels.height, pixels.data);
|
|
5399
5401
|
this.imagePixels.set(src, pixels);
|
|
5400
5402
|
return { src, pixels };
|
|
5401
5403
|
}
|
|
5402
5404
|
decodeImage(src, what = "Image") {
|
|
5403
5405
|
const cached = this.imagePixels.get(src);
|
|
5404
5406
|
if (cached) return cached;
|
|
5405
|
-
const parsed =
|
|
5407
|
+
const parsed = _chunkO7LUD7MHcjs.parseDataUrl.call(void 0, src);
|
|
5406
5408
|
if (!parsed) throw new PaintEditorError(`${what} is not a data URL or base64 PNG.`);
|
|
5407
5409
|
try {
|
|
5408
|
-
const png =
|
|
5410
|
+
const png = _chunkO7LUD7MHcjs.decodePng.call(void 0, parsed.bytes);
|
|
5409
5411
|
const px = { width: png.width, height: png.height, data: png.data };
|
|
5410
5412
|
this.imagePixels.set(src, px);
|
|
5411
5413
|
return px;
|
|
@@ -5594,9 +5596,9 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5594
5596
|
}
|
|
5595
5597
|
/** Replaces a layer's stickers and redraws its pixels from them (one undo step). */
|
|
5596
5598
|
commitStickers(label, layer, stickers) {
|
|
5597
|
-
if (
|
|
5598
|
-
const surface =
|
|
5599
|
-
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 } };
|
|
5600
5602
|
this.commit(label, this.withPaintEvent(doc, { kind: "stickers", layerId: layer.id, data: { stickers: stickers.map((s) => ({ ...s })) } }));
|
|
5601
5603
|
}
|
|
5602
5604
|
/** Moves, turns, resizes, recolours or restamps one sticker (one undo step). Returns it. */
|
|
@@ -5606,7 +5608,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5606
5608
|
if (i < 0) throw new PaintEditorError(`Layer "${layer.name}" has no sticker "${id}". Call list_stickers for the ids.`);
|
|
5607
5609
|
let u;
|
|
5608
5610
|
try {
|
|
5609
|
-
u =
|
|
5611
|
+
u = _chunk2XS6LTUPcjs.normalizeStickerUpdate.call(void 0, update);
|
|
5610
5612
|
} catch (e) {
|
|
5611
5613
|
throw new PaintEditorError(e.message);
|
|
5612
5614
|
}
|
|
@@ -5707,7 +5709,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5707
5709
|
}
|
|
5708
5710
|
makeSwatch(color, name) {
|
|
5709
5711
|
const p = typeof color === "string" ? { type: "color", color: parseColor(color) } : this.readStrokePaint(color);
|
|
5710
|
-
const out = { color:
|
|
5712
|
+
const out = { color: _chunkQBWEH3IMcjs.paintSourceColor.call(void 0, p, { paint: this.color, secondary: this.secondaryColor }) };
|
|
5711
5713
|
if (_optionalChain([name, 'optionalAccess', _292 => _292.trim, 'call', _293 => _293()])) out.name = name.trim();
|
|
5712
5714
|
if (p.type === "gradient") out.paint = p;
|
|
5713
5715
|
return out;
|
|
@@ -5849,7 +5851,7 @@ var PaintEditorController = (_class10 = class _PaintEditorController {
|
|
|
5849
5851
|
}
|
|
5850
5852
|
/** A layer's tile surface (live while stroking), for thumbnails. */
|
|
5851
5853
|
layerSurface(id) {
|
|
5852
|
-
const l = _optionalChain([
|
|
5854
|
+
const l = _optionalChain([_chunkAEAAN4ADcjs.findLayer.call(void 0, this.currentLayers(), id), 'optionalAccess', _296 => _296.layer]);
|
|
5853
5855
|
return isPixelLayer(l) ? l.surface : null;
|
|
5854
5856
|
}
|
|
5855
5857
|
}, _class10);
|
|
@@ -6073,7 +6075,7 @@ function createPaintStickerTools(c) {
|
|
|
6073
6075
|
properties: {
|
|
6074
6076
|
layerId: LAYER_ID,
|
|
6075
6077
|
id: { type: "string", description: "Sticker id from list_stickers." },
|
|
6076
|
-
stamp: { type: "string", enum: [...
|
|
6078
|
+
stamp: { type: "string", enum: [..._chunk2XS6LTUPcjs.STAMP_KINDS], description: "Another stamp." },
|
|
6077
6079
|
x: { type: "number", description: "Centre x in document pixels." },
|
|
6078
6080
|
y: { type: "number", description: "Centre y in document pixels." },
|
|
6079
6081
|
size: { type: "number", minimum: 2, maximum: 2048, description: "Diameter in pixels." },
|
|
@@ -6370,7 +6372,7 @@ function createPaintGuideTools(c) {
|
|
|
6370
6372
|
type: "object",
|
|
6371
6373
|
properties: {
|
|
6372
6374
|
color: { ...COLOR, description: "A colour #rrggbb." },
|
|
6373
|
-
paint: { ...
|
|
6375
|
+
paint: { ..._chunkQBWEH3IMcjs.PAINT_SOURCE_JSON_SCHEMA, description: "Gradient paint (or a colour) for the swatch, instead of color." },
|
|
6374
6376
|
name: { type: "string", minLength: 1, description: "Optional name." }
|
|
6375
6377
|
},
|
|
6376
6378
|
additionalProperties: false
|
|
@@ -6524,7 +6526,7 @@ function createPaintGuideTools(c) {
|
|
|
6524
6526
|
const pad = c.mixingPad;
|
|
6525
6527
|
return {
|
|
6526
6528
|
content: [
|
|
6527
|
-
{ 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" },
|
|
6528
6530
|
{ type: "text", text: `Mixing pad ${pad.width}\xD7${pad.height}` }
|
|
6529
6531
|
]
|
|
6530
6532
|
};
|
|
@@ -6661,7 +6663,7 @@ function createPaintWetTools(c) {
|
|
|
6661
6663
|
type: "object",
|
|
6662
6664
|
properties: {
|
|
6663
6665
|
layerId: LAYER_ID2,
|
|
6664
|
-
kind: { type: "string", enum: [...
|
|
6666
|
+
kind: { type: "string", enum: [..._chunkF2Y4E4GUcjs.WET_FLOW_KINDS], description: "none, linear, swirl, radial or turbulent." },
|
|
6665
6667
|
strength: UNIT("How hard it pushes, 0..1 (1 is about a 25\xB0 tilt; default 0.5)."),
|
|
6666
6668
|
angle: { type: "number", minimum: -360, maximum: 360, description: "linear: direction in degrees clockwise from canvas down (default 0)." },
|
|
6667
6669
|
center: {
|
|
@@ -6825,7 +6827,7 @@ function createPaintReplayTools(c) {
|
|
|
6825
6827
|
await c.wetIdle();
|
|
6826
6828
|
const tl = await c.timeLapse({ frames: a.frames, fps: a.fps, maxSide: a.maxSide, wetStepsPerFrame: a.wetStepsPerFrame, holdMs: a.holdMs });
|
|
6827
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);
|
|
6828
|
-
const sheet = contactSheet(pick.map((i) =>
|
|
6830
|
+
const sheet = contactSheet(pick.map((i) => _chunkO7LUD7MHcjs.decodePng.call(void 0, tl.frames[i])), pick.length, 160);
|
|
6829
6831
|
const info = {
|
|
6830
6832
|
frames: tl.frames.length,
|
|
6831
6833
|
fps: tl.fps,
|
|
@@ -6834,9 +6836,9 @@ function createPaintReplayTools(c) {
|
|
|
6834
6836
|
durationMs: tl.durationMs,
|
|
6835
6837
|
ffmpeg: tl.ffmpeg.command,
|
|
6836
6838
|
video: tl.video,
|
|
6837
|
-
...a.includeFrames ? { framesPng: tl.frames.map((f) =>
|
|
6839
|
+
...a.includeFrames ? { framesPng: tl.frames.map((f) => _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, f)) } : {}
|
|
6838
6840
|
};
|
|
6839
|
-
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) }] };
|
|
6840
6842
|
}
|
|
6841
6843
|
},
|
|
6842
6844
|
{
|
|
@@ -6856,8 +6858,8 @@ function createPaintReplayTools(c) {
|
|
|
6856
6858
|
handler: async ({ scale, paper }) => {
|
|
6857
6859
|
await c.wetIdle();
|
|
6858
6860
|
const img = await c.renderHighRes({ scale, paper });
|
|
6859
|
-
const bytes =
|
|
6860
|
-
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) };
|
|
6861
6863
|
}
|
|
6862
6864
|
}
|
|
6863
6865
|
];
|
|
@@ -6875,7 +6877,7 @@ var TIP = {
|
|
|
6875
6877
|
type: "object",
|
|
6876
6878
|
description: "The tip (the shared brush engine). Missing fields keep their current values.",
|
|
6877
6879
|
properties: {
|
|
6878
|
-
size: { type: "number", minimum: 1, maximum:
|
|
6880
|
+
size: { type: "number", minimum: 1, maximum: _chunkQBWEH3IMcjs.MAX_BRUSH_SIZE, description: "Diameter in document pixels." },
|
|
6879
6881
|
hardness: { type: "number", minimum: 0, maximum: 1, description: "Edge hardness, 0 (soft) .. 1 (hard)." },
|
|
6880
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)." },
|
|
6881
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." },
|
|
@@ -6887,7 +6889,7 @@ var TIP = {
|
|
|
6887
6889
|
pressureOpacity: { type: "boolean", description: "Pressure scales the opacity." },
|
|
6888
6890
|
blend: {
|
|
6889
6891
|
type: "string",
|
|
6890
|
-
enum:
|
|
6892
|
+
enum: _chunkO7LUD7MHcjs.BLEND_MODES.map((m) => m.id),
|
|
6891
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)."
|
|
6892
6894
|
}
|
|
6893
6895
|
},
|
|
@@ -6920,11 +6922,11 @@ var MIXER = {
|
|
|
6920
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." },
|
|
6921
6923
|
loadEachStroke: { type: "boolean", description: "Refill the reservoir with the colour before each stroke." },
|
|
6922
6924
|
cleanEachStroke: { type: "boolean", description: "Empty the pickup well after each stroke." },
|
|
6923
|
-
mixing: { type: "string", enum: [...
|
|
6925
|
+
mixing: { type: "string", enum: [..._chunkQBWEH3IMcjs.MIXING_MODELS], description: "rgb: RGB averages. pigment: mixes like paint (Kubelka-Munk)." }
|
|
6924
6926
|
},
|
|
6925
6927
|
additionalProperties: false
|
|
6926
6928
|
};
|
|
6927
|
-
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." };
|
|
6928
6930
|
var BEHAVIOR = {
|
|
6929
6931
|
type: "object",
|
|
6930
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.",
|
|
@@ -6937,7 +6939,7 @@ var BEHAVIOR = {
|
|
|
6937
6939
|
type: "object",
|
|
6938
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.",
|
|
6939
6941
|
properties: {
|
|
6940
|
-
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." },
|
|
6941
6943
|
colors: { type: "array", maxItems: 8, items: { ...COLOR2 }, description: "2..8 colours #rrggbb; fewer than 2 uses the paint colour and the secondary colour." },
|
|
6942
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)." },
|
|
6943
6945
|
length: { type: "integer", minimum: 1, maximum: 500, description: "dab mode: dabs per colour (default 12)." },
|
|
@@ -6950,7 +6952,7 @@ var BEHAVIOR = {
|
|
|
6950
6952
|
};
|
|
6951
6953
|
var BRUSH_PAINT = {
|
|
6952
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.`,
|
|
6953
|
-
anyOf: [
|
|
6955
|
+
anyOf: [_chunkQBWEH3IMcjs.PAINT_GRADIENT_JSON_SCHEMA, { type: "null", description: "No gradient of its own: the editor's paint." }]
|
|
6954
6956
|
};
|
|
6955
6957
|
var BLENDER = {
|
|
6956
6958
|
type: "object",
|
|
@@ -6978,10 +6980,10 @@ var WET_BRUSH = {
|
|
|
6978
6980
|
properties: {
|
|
6979
6981
|
tool: {
|
|
6980
6982
|
type: "string",
|
|
6981
|
-
enum: [...
|
|
6983
|
+
enum: [..._chunk2XS6LTUPcjs.WET_TOOLS],
|
|
6982
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)."
|
|
6983
6985
|
},
|
|
6984
|
-
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)." },
|
|
6985
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)." },
|
|
6986
6988
|
thinner: { type: "number", minimum: 0, maximum: 1, description: "Thinner (water or solvent): more transparent, runnier paint." },
|
|
6987
6989
|
water: { type: "number", minimum: 0, maximum: 1, description: "Wetness: water laid per stroke, 0.2 a damp brush .. 1 a dripping one." },
|
|
@@ -6998,7 +7000,7 @@ var IMPASTO_BRUSH = {
|
|
|
6998
7000
|
properties: {
|
|
6999
7001
|
tool: {
|
|
7000
7002
|
type: "string",
|
|
7001
|
-
enum: [...
|
|
7003
|
+
enum: [..._chunk2XS6LTUPcjs.IMPASTO_TOOLS],
|
|
7002
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."
|
|
7003
7005
|
},
|
|
7004
7006
|
thickness: { type: "number", minimum: 0, maximum: 1, description: "How far the paint stands up." },
|
|
@@ -7014,8 +7016,8 @@ var PARTICLE_BRUSH = {
|
|
|
7014
7016
|
type: "object",
|
|
7015
7017
|
description: "Particle engine settings (procedural brushes). Missing fields keep their current values.",
|
|
7016
7018
|
properties: {
|
|
7017
|
-
kind: { type: "string", enum: [...
|
|
7018
|
-
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." },
|
|
7019
7021
|
count: { type: "integer", minimum: 1, maximum: 64, description: "Particles (flow: how many are thrown per tip of travel)." },
|
|
7020
7022
|
size: { type: "number", minimum: 0, maximum: 1, description: "Mark size as a fraction of the tip size." },
|
|
7021
7023
|
spread: { type: "number", minimum: 0, maximum: 1, description: "How far apart the particles start, as a fraction of the tip size." },
|
|
@@ -7045,7 +7047,7 @@ var STICKER_BRUSH = {
|
|
|
7045
7047
|
type: "object",
|
|
7046
7048
|
description: "Sticker engine settings: stamps sprayed along the stroke as editable stickers. Missing fields keep their current values.",
|
|
7047
7049
|
properties: {
|
|
7048
|
-
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)." },
|
|
7049
7051
|
density: { type: "number", minimum: 0, maximum: 1, description: "Stickers per distance travelled." },
|
|
7050
7052
|
sizeJitter: { type: "number", minimum: 0, maximum: 1, description: "Random size change." },
|
|
7051
7053
|
rotationJitter: { type: "number", minimum: 0, maximum: 1, description: "Random turn as a fraction of \xB1180\xB0." },
|
|
@@ -7056,16 +7058,16 @@ var STICKER_BRUSH = {
|
|
|
7056
7058
|
};
|
|
7057
7059
|
var BRUSH_FIELDS = {
|
|
7058
7060
|
name: { type: "string", minLength: 1, maxLength: 80, description: "Display name." },
|
|
7059
|
-
category: { type: "string", enum: [...
|
|
7061
|
+
category: { type: "string", enum: [..._chunk2XS6LTUPcjs.PAINT_BRUSH_CATEGORIES], description: "Library category." },
|
|
7060
7062
|
engine: {
|
|
7061
7063
|
type: "string",
|
|
7062
|
-
enum: [...
|
|
7064
|
+
enum: [..._chunk2XS6LTUPcjs.PAINT_BRUSH_ENGINES],
|
|
7063
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)."
|
|
7064
7066
|
},
|
|
7065
7067
|
tip: TIP,
|
|
7066
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." },
|
|
7067
7069
|
pressureSmoothing: { type: "number", minimum: 0, maximum: 0.95, description: "Pressure smoothing, separate from the tip position smoothing." },
|
|
7068
|
-
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)." },
|
|
7069
7071
|
dynamics: DYNAMICS,
|
|
7070
7072
|
mixer: MIXER,
|
|
7071
7073
|
loadsColor: { type: "boolean", description: "Mixer engine: load the colour each stroke (false for a mixer that only moves paint)." },
|
|
@@ -7115,7 +7117,7 @@ function brushSummary(b) {
|
|
|
7115
7117
|
size: b.tip.size,
|
|
7116
7118
|
grain: b.grain,
|
|
7117
7119
|
rotation: b.rotation,
|
|
7118
|
-
wetCapable:
|
|
7120
|
+
wetCapable: _chunk2XS6LTUPcjs.isWetCapable.call(void 0, b),
|
|
7119
7121
|
pickup: b.behavior.pickup,
|
|
7120
7122
|
dirty: b.behavior.dirty,
|
|
7121
7123
|
multicolor: b.behavior.multicolor.mode,
|
|
@@ -7158,7 +7160,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7158
7160
|
strokes: d.strokes.length,
|
|
7159
7161
|
undo: s.undoLabel,
|
|
7160
7162
|
redo: s.redoLabel,
|
|
7161
|
-
blendModes:
|
|
7163
|
+
blendModes: _chunkO7LUD7MHcjs.BLEND_MODES.map((m) => m.id),
|
|
7162
7164
|
wet: s.wet.wet,
|
|
7163
7165
|
lighting: c.getLighting()
|
|
7164
7166
|
};
|
|
@@ -7207,9 +7209,9 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7207
7209
|
inputSchema: EMPTY3,
|
|
7208
7210
|
annotations: { title: "List papers", ...READ6 },
|
|
7209
7211
|
handler: () => ({
|
|
7210
|
-
papers:
|
|
7211
|
-
families: [...
|
|
7212
|
-
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]
|
|
7213
7215
|
})
|
|
7214
7216
|
});
|
|
7215
7217
|
add({
|
|
@@ -7240,7 +7242,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7240
7242
|
depth: { type: "number", minimum: 0, maximum: 1, description: "Grain depth 0..1 (0: brushes ignore the grain)." },
|
|
7241
7243
|
scale: { type: "number", minimum: 0.25, maximum: 8, description: "Grain scale: 1 natural, 2 twice as coarse." },
|
|
7242
7244
|
seed: { type: "integer", minimum: 0, description: "Grain seed: another sheet of the same paper." },
|
|
7243
|
-
pattern: { type: "string", enum: [...
|
|
7245
|
+
pattern: { type: "string", enum: [..._chunk2XS6LTUPcjs.GRAIN_PATTERNS], description: "Grain pattern." },
|
|
7244
7246
|
tiling: { type: "string", enum: ["repeat", "mirror"], description: "How the grain tile repeats (mirror hides seams)." },
|
|
7245
7247
|
shading: { type: "number", minimum: 0, maximum: 1, description: "How much the grain shades the paper colour." },
|
|
7246
7248
|
dry: { ...tuning, description: "Height map tuning for dry media." },
|
|
@@ -7294,7 +7296,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7294
7296
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0..1." },
|
|
7295
7297
|
blend: {
|
|
7296
7298
|
type: "string",
|
|
7297
|
-
enum: [...
|
|
7299
|
+
enum: [..._chunkO7LUD7MHcjs.BLEND_MODES.map((m) => m.id), "pass-through"],
|
|
7298
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."
|
|
7299
7301
|
},
|
|
7300
7302
|
clipped: { type: "boolean", description: "Clip to the layer below (paint only shows where it has paint)." },
|
|
@@ -7323,12 +7325,12 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7323
7325
|
inputSchema: EMPTY3,
|
|
7324
7326
|
annotations: { title: "List blend modes", ...READ6 },
|
|
7325
7327
|
handler: () => ({
|
|
7326
|
-
modes:
|
|
7328
|
+
modes: _chunkO7LUD7MHcjs.BLEND_MODES.map((m) => ({
|
|
7327
7329
|
id: m.id,
|
|
7328
7330
|
label: m.label,
|
|
7329
7331
|
group: m.painterly ? "painterly" : m.id === "pigment" ? "pigment" : "standard",
|
|
7330
7332
|
...m.description ? { description: m.description } : {},
|
|
7331
|
-
psd:
|
|
7333
|
+
psd: _chunkO7LUD7MHcjs.standardBlendMode.call(void 0, m.id)
|
|
7332
7334
|
}))
|
|
7333
7335
|
})
|
|
7334
7336
|
});
|
|
@@ -7396,7 +7398,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7396
7398
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Opacity 0..1 (default 1)." },
|
|
7397
7399
|
grain: { type: "number", minimum: 0, maximum: 1, description: "Paper grain response 0..1 (default 0: flat)." },
|
|
7398
7400
|
pressure: { type: "number", minimum: 0, maximum: 1, description: "With grain: how far into the valleys, 0..1 (default 0.5)." },
|
|
7399
|
-
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)." }
|
|
7400
7402
|
},
|
|
7401
7403
|
additionalProperties: false
|
|
7402
7404
|
},
|
|
@@ -7430,10 +7432,10 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7430
7432
|
annotations: { title: "Get a brush", ...READ6 },
|
|
7431
7433
|
handler: ({ id }) => {
|
|
7432
7434
|
const st = c.getState();
|
|
7433
|
-
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)) };
|
|
7434
7436
|
const b = c.getBrush(id);
|
|
7435
7437
|
if (!b) throw new Error(`Unknown brush "${id}". Call list_brushes for the ids.`);
|
|
7436
|
-
return { ...
|
|
7438
|
+
return { ..._chunk2XS6LTUPcjs.brushToJSON.call(void 0, b), builtin: Boolean(b.builtin), strokePaint: _nullishCoalesce(b.paint, () => ( st.paint)) };
|
|
7437
7439
|
}
|
|
7438
7440
|
});
|
|
7439
7441
|
add({
|
|
@@ -7442,7 +7444,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7442
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.",
|
|
7443
7445
|
inputSchema: { type: "object", properties: { id: { type: "string", description: "Brush id from list_brushes to start from." }, ...BRUSH_FIELDS }, additionalProperties: false },
|
|
7444
7446
|
annotations: { title: "Set the brush", ...SET4 },
|
|
7445
|
-
handler: (a) =>
|
|
7447
|
+
handler: (a) => _chunk2XS6LTUPcjs.brushToJSON.call(void 0, c.setBrush(a))
|
|
7446
7448
|
});
|
|
7447
7449
|
add({
|
|
7448
7450
|
name: "save_brush",
|
|
@@ -7458,7 +7460,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7458
7460
|
additionalProperties: false
|
|
7459
7461
|
},
|
|
7460
7462
|
annotations: { title: "Save a brush", ...SET4 },
|
|
7461
|
-
handler: ({ id, name }) =>
|
|
7463
|
+
handler: ({ id, name }) => _chunk2XS6LTUPcjs.brushToJSON.call(void 0, c.saveBrush({ id, name }))
|
|
7462
7464
|
});
|
|
7463
7465
|
add({
|
|
7464
7466
|
name: "remove_brush",
|
|
@@ -7518,7 +7520,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7518
7520
|
const t = c.brushThumbnail(_nullishCoalesce(id, () => ( c.getState().brush.id)), { width, height, color });
|
|
7519
7521
|
return {
|
|
7520
7522
|
content: [
|
|
7521
|
-
{ 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" },
|
|
7522
7524
|
{ type: "text", text: `Brush ${_nullishCoalesce(id, () => ( c.getState().brush.id))} ${t.width}\xD7${t.height}` }
|
|
7523
7525
|
]
|
|
7524
7526
|
};
|
|
@@ -7545,7 +7547,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7545
7547
|
name: "set_paint",
|
|
7546
7548
|
title: "Set the paint (colour or gradient)",
|
|
7547
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.',
|
|
7548
|
-
inputSchema: { type: "object", properties: { paint:
|
|
7550
|
+
inputSchema: { type: "object", properties: { paint: _chunkQBWEH3IMcjs.PAINT_SOURCE_JSON_SCHEMA }, required: ["paint"], additionalProperties: false },
|
|
7549
7551
|
annotations: { title: "Set the paint (colour or gradient)", ...SET4 },
|
|
7550
7552
|
handler: ({ paint }) => {
|
|
7551
7553
|
const p = c.setPaint(paint);
|
|
@@ -7606,7 +7608,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7606
7608
|
brushId: { type: "string", description: "Brush id from list_brushes (default the active brush)." },
|
|
7607
7609
|
brush: { type: "object", description: "Brush changes for this stroke only.", properties: BRUSH_FIELDS, additionalProperties: false },
|
|
7608
7610
|
color: { ...COLOR2, description: "Paint colour #rrggbb (default the paint colour)." },
|
|
7609
|
-
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." },
|
|
7610
7612
|
seed: { type: "integer", minimum: 0, description: "Jitter seed (default a new one); the same seed and points give the same marks." },
|
|
7611
7613
|
snapToPerspective: { type: "boolean", description: "Snap the points to the perspective guide, as a pen stroke would (default false)." }
|
|
7612
7614
|
},
|
|
@@ -7787,7 +7789,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7787
7789
|
annotations: { title: "Export the painting", ...READ6 },
|
|
7788
7790
|
handler: async ({ format, quality, scale, paper }) => {
|
|
7789
7791
|
const bytes = await c.exportImage({ format, quality, scale, paper });
|
|
7790
|
-
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) };
|
|
7791
7793
|
}
|
|
7792
7794
|
});
|
|
7793
7795
|
add({
|
|
@@ -7798,7 +7800,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7798
7800
|
annotations: { title: "Export as PSD", ...READ6 },
|
|
7799
7801
|
handler: () => {
|
|
7800
7802
|
const r = c.exportPsd();
|
|
7801
|
-
return { data:
|
|
7803
|
+
return { data: _chunkO7LUD7MHcjs.bytesToBase64.call(void 0, r.bytes), bytes: r.bytes.length, psb: r.psb, warnings: r.warnings };
|
|
7802
7804
|
}
|
|
7803
7805
|
});
|
|
7804
7806
|
add({
|
|
@@ -7826,7 +7828,7 @@ function createPaintEditorToolProvider(controller, options = {}) {
|
|
|
7826
7828
|
tools.push(...createPaintThickTools(c));
|
|
7827
7829
|
tools.push(...createPaintReplayTools(c));
|
|
7828
7830
|
tools.push(...createPaintStickerTools(c));
|
|
7829
|
-
tools.push(...
|
|
7831
|
+
tools.push(..._chunkF2Y4E4GUcjs.createPigmentTools.call(void 0, ));
|
|
7830
7832
|
return { id: _nullishCoalesce(options.id, () => ( "paint-editor")), namespace: options.namespace, tools };
|
|
7831
7833
|
}
|
|
7832
7834
|
|
|
@@ -8021,11 +8023,11 @@ var PaintCanvasPresenter = (_class12 = class {
|
|
|
8021
8023
|
const key = `${tx},${ty}`;
|
|
8022
8024
|
if (this.uploaded.get(key) === data) return;
|
|
8023
8025
|
this.uploaded.set(key, data);
|
|
8024
|
-
if (!this.scratch) this.scratch = ctx.createImageData(
|
|
8026
|
+
if (!this.scratch) this.scratch = ctx.createImageData(_chunkO7LUD7MHcjs.TILE, _chunkO7LUD7MHcjs.TILE);
|
|
8025
8027
|
this.scratch.data.set(data);
|
|
8026
|
-
const ox = tx *
|
|
8027
|
-
const oy = ty *
|
|
8028
|
-
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));
|
|
8029
8031
|
drawn++;
|
|
8030
8032
|
}, { dirty });
|
|
8031
8033
|
return drawn;
|
|
@@ -8113,8 +8115,8 @@ function wheelPick(dx, dy, wheel, color) {
|
|
|
8113
8115
|
return rgbToHexColor(nr, ng, nb);
|
|
8114
8116
|
}
|
|
8115
8117
|
var BLEND_MENU_GROUPS = [
|
|
8116
|
-
{ label: "Standard", modes:
|
|
8117
|
-
{ 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") }
|
|
8118
8120
|
];
|
|
8119
8121
|
var PICKUP_SLIDERS = [
|
|
8120
8122
|
{ path: "behavior.pickup", label: "Pick-up", min: 0, max: 1, step: 0.01 },
|
|
@@ -8335,10 +8337,10 @@ function drawWaterOverlay(controller, ctx) {
|
|
|
8335
8337
|
if (!controller.getState().wet.overlay) return 0;
|
|
8336
8338
|
const tiles = controller.waterOverlayTiles({ x: 0, y: 0, width, height });
|
|
8337
8339
|
if (!tiles.length) return 0;
|
|
8338
|
-
const img = ctx.createImageData(
|
|
8340
|
+
const img = ctx.createImageData(_chunkO7LUD7MHcjs.TILE, _chunkO7LUD7MHcjs.TILE);
|
|
8339
8341
|
for (const t of tiles) {
|
|
8340
8342
|
img.data.set(t.data);
|
|
8341
|
-
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));
|
|
8342
8344
|
}
|
|
8343
8345
|
return tiles.length;
|
|
8344
8346
|
}
|
|
@@ -8505,7 +8507,7 @@ function createPaintEffectsToolProvider(controller, options = {}) {
|
|
|
8505
8507
|
name: { type: "string", minLength: 1, description: "The layer name (default: the effect's name)." },
|
|
8506
8508
|
aboveId: { type: "string", minLength: 1, description: "Put it directly above this layer (default: above the active layer, else on top)." },
|
|
8507
8509
|
opacity: { type: "number", minimum: 0, maximum: 1, description: "Layer opacity 0\u20131 (default 1)." },
|
|
8508
|
-
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." },
|
|
8509
8511
|
time: { type: "number", minimum: 0, description: "Which moment of an animated effect to draw, in ms (default 0)." }
|
|
8510
8512
|
},
|
|
8511
8513
|
required: ["effect"],
|
|
@@ -8845,5 +8847,5 @@ function createPaintEffectsToolProvider(controller, options = {}) {
|
|
|
8845
8847
|
|
|
8846
8848
|
|
|
8847
8849
|
|
|
8848
|
-
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;
|
|
8849
8851
|
//# sourceMappingURL=index.cjs.map
|