@pixerate/editor 0.248.0 → 0.250.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/animation-editor/index.cjs +118 -114
- package/dist/animation-editor/index.js +11 -7
- package/dist/{brushstrokeRender-QLCXROJK.js → brushstrokeRender-2FHFLSEG.js} +8 -4
- package/dist/{brushstrokeRender-DTDPFBLC.cjs → brushstrokeRender-QGRXOKDA.cjs} +15 -11
- package/dist/canvas/index.cjs +71 -15
- package/dist/canvas/index.d.cts +1 -0
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +58 -2
- package/dist/canvas/stickers.d.cts +35 -0
- package/dist/canvas/stickers.d.ts +35 -0
- package/dist/{chunk-RXZL4NG5.js → chunk-226QDRO3.js} +1 -1
- package/dist/{chunk-SC2RZ5EF.js → chunk-2VJAVXLI.js} +2 -2
- package/dist/{chunk-OLNIPTB3.cjs → chunk-2VX55NFM.cjs} +1 -320
- package/dist/chunk-3K6HWEXZ.cjs +92 -0
- package/dist/{chunk-UOOK7HTX.js → chunk-3PPJRMIG.js} +1 -1
- package/dist/{chunk-ZFSLEOSQ.js → chunk-3TWOCSCY.js} +11 -9
- package/dist/chunk-4D6KP5BV.js +92 -0
- package/dist/chunk-4JNWA3VT.cjs +302 -0
- package/dist/{chunk-L3JFOTBQ.js → chunk-5E2Q7ZHI.js} +1 -1
- package/dist/{chunk-2ONK3ERD.cjs → chunk-75K3W4D6.cjs} +20 -20
- package/dist/{chunk-AU6MWQKZ.js → chunk-ABL7IWFZ.js} +1 -1
- package/dist/chunk-ATK6ABN3.cjs +303 -0
- package/dist/{chunk-7T7JWTVE.cjs → chunk-BOHDJJ2O.cjs} +8 -8
- package/dist/{chunk-2PBZBRP5.js → chunk-D5KGAO4Z.js} +10 -92
- package/dist/{chunk-HB4ICNNA.cjs → chunk-DPYAO5U6.cjs} +42 -42
- package/dist/{chunk-6G6ZDDDB.cjs → chunk-GT77U7QG.cjs} +303 -149
- package/dist/{chunk-PQ3H2AAN.cjs → chunk-I7NJPHWV.cjs} +122 -204
- package/dist/{chunk-42TWUPNJ.js → chunk-IRSTHLQQ.js} +1 -320
- package/dist/{chunk-GHCSC2WP.cjs → chunk-ISIO63Q5.cjs} +21 -15
- package/dist/{chunk-OFH6Q67U.js → chunk-JA57JIT5.js} +9 -3
- package/dist/{chunk-VMROIWLL.cjs → chunk-KBYB7OWB.cjs} +3 -3
- package/dist/{chunk-Q2HA52V4.js → chunk-KDLBJ6QR.js} +2 -2
- package/dist/{chunk-WVS5KQDH.cjs → chunk-M2VKFE5L.cjs} +246 -244
- package/dist/{chunk-5GLYUSNT.js → chunk-NOHJP5TK.js} +1 -1
- package/dist/{chunk-XNRBMYNB.js → chunk-NTRAVM2I.js} +1 -1
- package/dist/{chunk-VNBUDVD4.js → chunk-OTEPAQJX.js} +228 -74
- package/dist/chunk-OTTT5N3K.js +322 -0
- package/dist/{chunk-QOBCBGGI.cjs → chunk-QKXO6JPP.cjs} +14 -14
- package/dist/{chunk-NZ3O3A5C.js → chunk-SMSGP2HQ.js} +1 -1
- package/dist/chunk-SZTI6EER.js +13 -0
- package/dist/chunk-U4NUOKBT.js +303 -0
- package/dist/chunk-U67EN7GG.cjs +13 -0
- package/dist/chunk-W5M3J7PV.cjs +322 -0
- package/dist/{chunk-4P6H35HU.js → chunk-WA44NKPF.js} +2 -2
- package/dist/chunk-WKH5ZAUA.js +302 -0
- package/dist/{chunk-L6REDLNB.cjs → chunk-WPUXGDH4.cjs} +7 -7
- package/dist/{chunk-P3NIPIKS.js → chunk-WQCNC4DK.js} +1 -1
- package/dist/{chunk-IBDU6EGZ.cjs → chunk-X7WRL5ZZ.cjs} +35 -35
- package/dist/{chunk-XWTRATIM.cjs → chunk-YM6ZBTXG.cjs} +23 -23
- package/dist/{chunk-TPWB4Y6L.cjs → chunk-YW43M56C.cjs} +1 -1
- package/dist/{chunk-K5DS2JTA.cjs → chunk-Z3BRH4JK.cjs} +6 -6
- package/dist/{chunk-XNZFVYC2.cjs → chunk-ZBCT5MEA.cjs} +7 -7
- package/dist/effects/helpers.d.cts +6 -0
- package/dist/effects/helpers.d.ts +6 -0
- package/dist/effects/index.cjs +62 -60
- package/dist/effects/index.js +5 -3
- package/dist/effects/tools.d.cts +6 -0
- package/dist/effects/tools.d.ts +6 -0
- package/dist/image-editor/effects.d.cts +1 -1
- package/dist/image-editor/effects.d.ts +1 -1
- package/dist/image-editor/index.cjs +1097 -1069
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +58 -30
- package/dist/image-editor/stickers.d.cts +9 -0
- package/dist/image-editor/stickers.d.ts +9 -0
- package/dist/paint/index.cjs +8 -5
- package/dist/paint/index.js +13 -10
- package/dist/paint-editor/controller.d.cts +37 -1
- package/dist/paint-editor/controller.d.ts +37 -1
- package/dist/paint-editor/index.cjs +753 -609
- package/dist/paint-editor/index.d.cts +3 -0
- package/dist/paint-editor/index.d.ts +3 -0
- package/dist/paint-editor/index.js +187 -43
- package/dist/paint-editor/sticker-art.d.cts +55 -0
- package/dist/paint-editor/sticker-art.d.ts +55 -0
- package/dist/paint-editor/stickers.d.cts +30 -17
- package/dist/paint-editor/stickers.d.ts +30 -17
- package/dist/paint-editor/stroke.d.cts +4 -0
- package/dist/paint-editor/stroke.d.ts +4 -0
- package/dist/paint-editor/ui.d.cts +10 -2
- package/dist/paint-editor/ui.d.ts +10 -2
- package/dist/raster/index.cjs +6 -4
- package/dist/raster/index.js +12 -10
- package/dist/stickers/browser.d.cts +48 -0
- package/dist/stickers/browser.d.ts +48 -0
- package/dist/stickers/combine.d.cts +10 -0
- package/dist/stickers/combine.d.ts +10 -0
- package/dist/stickers/conformance.d.cts +18 -0
- package/dist/stickers/conformance.d.ts +18 -0
- package/dist/stickers/editor.d.cts +14 -0
- package/dist/stickers/editor.d.ts +14 -0
- package/dist/stickers/errors.d.cts +6 -0
- package/dist/stickers/errors.d.ts +6 -0
- package/dist/stickers/fake.d.cts +16 -0
- package/dist/stickers/fake.d.ts +16 -0
- package/dist/stickers/helpers.d.cts +51 -0
- package/dist/stickers/helpers.d.ts +51 -0
- package/dist/stickers/index.cjs +337 -0
- package/dist/stickers/index.d.cts +16 -0
- package/dist/stickers/index.d.ts +16 -0
- package/dist/stickers/index.js +337 -0
- package/dist/stickers/stamps.d.cts +13 -0
- package/dist/stickers/stamps.d.ts +13 -0
- package/dist/stickers/tools.d.cts +81 -0
- package/dist/stickers/tools.d.ts +81 -0
- package/dist/stickers/types.d.cts +123 -0
- package/dist/stickers/types.d.ts +123 -0
- package/dist/vector/index.cjs +1018 -981
- package/dist/vector/index.d.cts +1 -0
- package/dist/vector/index.d.ts +1 -0
- package/dist/vector/index.js +44 -7
- package/dist/vector/stickers.d.cts +11 -0
- package/dist/vector/stickers.d.ts +11 -0
- package/dist/video-editor/index.cjs +344 -344
- package/dist/video-editor/index.js +4 -4
- package/package.json +11 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-image-editor/SKILL.md +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +8 -5
- package/skills/pixerate-stickers/SKILL.md +57 -0
|
@@ -1,12 +1,14 @@
|
|
|
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;
|
|
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;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
var _chunk4JNWA3VTcjs = require('./chunk-4JNWA3VT.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
var _chunkU67EN7GGcjs = require('./chunk-U67EN7GG.cjs');
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
|
|
@@ -20,7 +22,22 @@
|
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunkI7NJPHWVcjs = require('./chunk-I7NJPHWV.cjs');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _chunk3K6HWEXZcjs = require('./chunk-3K6HWEXZ.cjs');
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
|
|
24
41
|
|
|
25
42
|
|
|
26
43
|
|
|
@@ -229,7 +246,7 @@ function normalizePaper(raw = {}, base) {
|
|
|
229
246
|
preset: typeof r.preset === "string" && r.preset ? r.preset : b.preset,
|
|
230
247
|
name: typeof r.name === "string" && r.name.trim() ? r.name.trim() : b.name,
|
|
231
248
|
family: PAPER_FAMILIES.includes(r.family) ? r.family : b.family,
|
|
232
|
-
pattern:
|
|
249
|
+
pattern: _chunkI7NJPHWVcjs.GRAIN_PATTERNS.includes(r.pattern) ? r.pattern : b.pattern,
|
|
233
250
|
seed: typeof r.seed === "number" && Number.isFinite(r.seed) ? Math.round(Math.abs(r.seed)) % 2147483647 : b.seed,
|
|
234
251
|
color: typeof r.color === "string" && HEX.test(r.color) ? r.color.toLowerCase() : b.color,
|
|
235
252
|
scale: clampNum(r.scale, 0.25, 8, b.scale),
|
|
@@ -251,7 +268,7 @@ function hexToRgb8(hex) {
|
|
|
251
268
|
const n = parseInt(hex.slice(1, 7), 16);
|
|
252
269
|
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
253
270
|
}
|
|
254
|
-
function renderPaper(paper, rect, grain = new (0,
|
|
271
|
+
function renderPaper(paper, rect, grain = new (0, _chunkI7NJPHWVcjs.PaperGrain)(paper), light) {
|
|
255
272
|
const [r, g, b] = hexToRgb8(paper.color);
|
|
256
273
|
const out = new Uint8ClampedArray(rect.width * rect.height * 4);
|
|
257
274
|
const shade = grain.flat ? 0 : paper.shading * 0.16;
|
|
@@ -413,22 +430,22 @@ var PenDabWalker = (_class2 = class {
|
|
|
413
430
|
const i = this.index++;
|
|
414
431
|
const seed = this.seed;
|
|
415
432
|
let diameter = this.diameter(s);
|
|
416
|
-
if (dyn.sizeJitter) diameter *= Math.max(0.05, 1 + dyn.sizeJitter *
|
|
433
|
+
if (dyn.sizeJitter) diameter *= Math.max(0.05, 1 + dyn.sizeJitter * _chunk3K6HWEXZcjs.randSigned.call(void 0, seed, i, 1 /* Size */));
|
|
417
434
|
const base = tip.angle * Math.PI / 180;
|
|
418
435
|
let angle;
|
|
419
436
|
if (rotation === "stroke") angle = this.dir + base;
|
|
420
437
|
else if (rotation === "barrel" && s.twist !== null) angle = this.mapAngle(base - s.twist * Math.PI / 180);
|
|
421
438
|
else if (dyn.tiltRoundness > 0 && s.lean > 0.02) angle = this.mapAngle(base - s.azimuth);
|
|
422
439
|
else angle = this.mapAngle(base);
|
|
423
|
-
if (dyn.angleJitter) angle += dyn.angleJitter * Math.PI *
|
|
440
|
+
if (dyn.angleJitter) angle += dyn.angleJitter * Math.PI * _chunk3K6HWEXZcjs.randSigned.call(void 0, seed, i, 2 /* Angle */);
|
|
424
441
|
let opacity = tip.pressureOpacity ? s.pressure : 1;
|
|
425
442
|
opacity *= 1 - dyn.tiltOpacity * s.lean * 0.8;
|
|
426
443
|
if (s.speed !== null && dyn.velocityOpacity) opacity *= Math.max(0, 1 + dyn.velocityOpacity * (Math.min(1, s.speed / FULL_SPEED) - 0.5));
|
|
427
|
-
if (dyn.opacityJitter) opacity *= 1 - dyn.opacityJitter * (
|
|
444
|
+
if (dyn.opacityJitter) opacity *= 1 - dyn.opacityJitter * (_chunk3K6HWEXZcjs.randSigned.call(void 0, seed, i, 3 /* Opacity */) * 0.5 + 0.5);
|
|
428
445
|
const flow = tip.flow * (1 - dyn.pressureFlow + dyn.pressureFlow * s.pressure);
|
|
429
446
|
let { x, y } = s;
|
|
430
447
|
if (dyn.scatter) {
|
|
431
|
-
const off = dyn.scatter * diameter *
|
|
448
|
+
const off = dyn.scatter * diameter * _chunk3K6HWEXZcjs.randSigned.call(void 0, seed, i, 4 /* Scatter */);
|
|
432
449
|
x += Math.sin(this.dir) * off;
|
|
433
450
|
y += Math.cos(this.dir) * off;
|
|
434
451
|
}
|
|
@@ -518,7 +535,7 @@ var DryStroke = (_class3 = class {
|
|
|
518
535
|
}
|
|
519
536
|
|
|
520
537
|
|
|
521
|
-
__init12() {this.coverage = new (0,
|
|
538
|
+
__init12() {this.coverage = new (0, _chunkI7NJPHWVcjs.CoverageMap)()}
|
|
522
539
|
__init13() {this.dabCount = 0}
|
|
523
540
|
|
|
524
541
|
|
|
@@ -553,16 +570,16 @@ var DryStroke = (_class3 = class {
|
|
|
553
570
|
const hardness = this.brush.tip.hardness;
|
|
554
571
|
const grain = this.options.grain;
|
|
555
572
|
for (const d of dabs) {
|
|
556
|
-
const rect =
|
|
573
|
+
const rect = _chunkI7NJPHWVcjs.dabRect.call(void 0, d, hardness);
|
|
557
574
|
const n = rect.width * rect.height;
|
|
558
575
|
if (this.buf.length < n) this.buf = new Float32Array(n);
|
|
559
576
|
const vals = this.buf.subarray(0, n);
|
|
560
|
-
|
|
577
|
+
_chunkI7NJPHWVcjs.rasterizeDab.call(void 0, d, hardness, rect, vals);
|
|
561
578
|
if (this.depth > 0 && grain) {
|
|
562
579
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
563
580
|
const y = rect.y + yy + 0.5;
|
|
564
581
|
for (let xx = 0; xx < rect.width; xx++, k++) {
|
|
565
|
-
if (vals[k] > 0) vals[k] *=
|
|
582
|
+
if (vals[k] > 0) vals[k] *= _chunkI7NJPHWVcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, y), this.depth, d.pressure);
|
|
566
583
|
}
|
|
567
584
|
}
|
|
568
585
|
}
|
|
@@ -586,14 +603,129 @@ function toStrokePoint(p) {
|
|
|
586
603
|
return { x: p.x, y: p.y, pressure: pressureOf(p), ...typeof p.t === "number" ? { t: p.t } : {} };
|
|
587
604
|
}
|
|
588
605
|
|
|
606
|
+
// src/paint-editor/sticker-art.ts
|
|
607
|
+
var STICKER_ART_SIZE = 256;
|
|
608
|
+
var defaultStickerRasterizer = async (asset, size) => {
|
|
609
|
+
if (asset.kind === "image") {
|
|
610
|
+
const parsed = _chunkW5M3J7PVcjs.parseDataUrl.call(void 0, asset.url);
|
|
611
|
+
if (parsed && parsed.mime === "image/png") {
|
|
612
|
+
const png = _chunkW5M3J7PVcjs.decodePng.call(void 0, parsed.bytes);
|
|
613
|
+
return { width: png.width, height: png.height, data: new Uint8ClampedArray(png.data) };
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
const g = globalThis;
|
|
617
|
+
if (!g.createImageBitmap || !g.OffscreenCanvas) {
|
|
618
|
+
throw new (0, _chunkU67EN7GGcjs.StickerError)("unsupported_format", `This environment can't draw ${asset.kind === "svg" ? "SVG" : "non-PNG"} sticker art; pass rasterizeSticker in the paint editor's options (or use a provider that offers png).`);
|
|
619
|
+
}
|
|
620
|
+
const blob = asset.kind === "svg" ? new Blob([asset.svg], { type: "image/svg+xml" }) : await (await g.fetch(asset.url)).blob();
|
|
621
|
+
const bitmap = await g.createImageBitmap(blob);
|
|
622
|
+
const scale = size / Math.max(bitmap.width, bitmap.height, 1);
|
|
623
|
+
const w = Math.max(1, Math.round(bitmap.width * scale));
|
|
624
|
+
const h = Math.max(1, Math.round(bitmap.height * scale));
|
|
625
|
+
const canvas = new g.OffscreenCanvas(w, h);
|
|
626
|
+
const ctx = canvas.getContext("2d");
|
|
627
|
+
ctx.drawImage(bitmap, 0, 0, w, h);
|
|
628
|
+
const img = ctx.getImageData(0, 0, w, h);
|
|
629
|
+
return { width: w, height: h, data: img.data };
|
|
630
|
+
};
|
|
631
|
+
var StickerArtCache = (_class4 = class {constructor() { _class4.prototype.__init18.call(this);_class4.prototype.__init19.call(this); }
|
|
632
|
+
__init18() {this.entries = /* @__PURE__ */ new Map()}
|
|
633
|
+
/** The art for `ref` when it has loaded (editor stamps never need any). */
|
|
634
|
+
__init19() {this.get = (ref) => {
|
|
635
|
+
const e = this.entries.get(ref);
|
|
636
|
+
return _optionalChain([e, 'optionalAccess', _8 => _8.status]) === "ready" ? e.art : void 0;
|
|
637
|
+
}}
|
|
638
|
+
/** `ready`, `loading`, `failed` (with the reason) or `none` (never asked for). Editor stamps are always `ready`. */
|
|
639
|
+
status(ref) {
|
|
640
|
+
if (_chunk4JNWA3VTcjs.editorStampOf.call(void 0, ref)) return { status: "ready" };
|
|
641
|
+
const e = this.entries.get(ref);
|
|
642
|
+
if (!e) return { status: "none" };
|
|
643
|
+
return e.status === "failed" ? { status: "failed", error: e.error } : { status: e.status };
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Loads and rasterises `ref` from `provider` once (later calls share the load). Unknown refs
|
|
647
|
+
* reject with the closest known ones; failures are kept so they are reported, and retried on
|
|
648
|
+
* the next call.
|
|
649
|
+
*/
|
|
650
|
+
ensure(provider, ref, rasterize) {
|
|
651
|
+
if (_chunk4JNWA3VTcjs.editorStampOf.call(void 0, ref)) return Promise.resolve(null);
|
|
652
|
+
const e = this.entries.get(ref);
|
|
653
|
+
if (_optionalChain([e, 'optionalAccess', _9 => _9.status]) === "ready") return Promise.resolve(e.art);
|
|
654
|
+
if (_optionalChain([e, 'optionalAccess', _10 => _10.status]) === "loading") return e.promise;
|
|
655
|
+
const promise = (async () => {
|
|
656
|
+
const d = await _chunk4JNWA3VTcjs.describeStickerRef.call(void 0, provider, ref);
|
|
657
|
+
const id = _chunk4JNWA3VTcjs.stickerIdFor.call(void 0, provider, ref);
|
|
658
|
+
const max = _nullishCoalesce(provider.capabilities.maxSize, () => ( STICKER_ART_SIZE));
|
|
659
|
+
const size = Math.min(STICKER_ART_SIZE, max);
|
|
660
|
+
const asset = await provider.load(id, d.formats.includes("png") ? { format: "png", size } : { format: _nullishCoalesce(d.formats[0], () => ( "svg")), size });
|
|
661
|
+
const px = await rasterize(asset, size);
|
|
662
|
+
if (!(px.width > 0 && px.height > 0) || px.data.length !== px.width * px.height * 4) throw new (0, _chunkU67EN7GGcjs.StickerError)("load_failed", `The art for "${ref}" came back empty or the wrong size.`);
|
|
663
|
+
return { ...px, tintable: d.tintable };
|
|
664
|
+
})();
|
|
665
|
+
this.entries.set(ref, { status: "loading", promise });
|
|
666
|
+
return promise.then(
|
|
667
|
+
(art) => {
|
|
668
|
+
this.entries.set(ref, { status: "ready", art });
|
|
669
|
+
return art;
|
|
670
|
+
},
|
|
671
|
+
(err) => {
|
|
672
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
673
|
+
this.entries.set(ref, { status: "failed", error: message });
|
|
674
|
+
throw err;
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
/** Forgets every load (a new provider). */
|
|
679
|
+
clear() {
|
|
680
|
+
this.entries.clear();
|
|
681
|
+
}
|
|
682
|
+
}, _class4);
|
|
683
|
+
function sampleArt(art, x, y, out) {
|
|
684
|
+
const { width: w, height: h, data } = art;
|
|
685
|
+
const fx = x - 0.5;
|
|
686
|
+
const fy = y - 0.5;
|
|
687
|
+
const x0 = Math.floor(fx);
|
|
688
|
+
const y0 = Math.floor(fy);
|
|
689
|
+
const tx = fx - x0;
|
|
690
|
+
const ty = fy - y0;
|
|
691
|
+
let r = 0;
|
|
692
|
+
let g = 0;
|
|
693
|
+
let b = 0;
|
|
694
|
+
let a = 0;
|
|
695
|
+
for (let k = 0; k < 4; k++) {
|
|
696
|
+
const xx = x0 + (k & 1);
|
|
697
|
+
const yy = y0 + (k >> 1);
|
|
698
|
+
if (xx < 0 || yy < 0 || xx >= w || yy >= h) continue;
|
|
699
|
+
const wgt = (k & 1 ? tx : 1 - tx) * (k >> 1 ? ty : 1 - ty);
|
|
700
|
+
const i = (yy * w + xx) * 4;
|
|
701
|
+
const al = data[i + 3] * wgt;
|
|
702
|
+
r += data[i] * al;
|
|
703
|
+
g += data[i + 1] * al;
|
|
704
|
+
b += data[i + 2] * al;
|
|
705
|
+
a += al;
|
|
706
|
+
}
|
|
707
|
+
out[0] = a > 0 ? r / a / 255 : 0;
|
|
708
|
+
out[1] = a > 0 ? g / a / 255 : 0;
|
|
709
|
+
out[2] = a > 0 ? b / a / 255 : 0;
|
|
710
|
+
out[3] = a / 255;
|
|
711
|
+
return out;
|
|
712
|
+
}
|
|
713
|
+
|
|
589
714
|
// src/paint-editor/stickers.ts
|
|
590
|
-
var
|
|
591
|
-
var DEFAULT_STICKER = { stamps: ["star"], density: 0.4, sizeJitter: 0.4, rotationJitter: 1, scatter: 0.5, colorJitter: 0.2 };
|
|
715
|
+
var MAX_STICKER_STAMPS = 16;
|
|
716
|
+
var DEFAULT_STICKER = { stamps: ["editor:star"], density: 0.4, sizeJitter: 0.4, rotationJitter: 1, scatter: 0.5, colorJitter: 0.2 };
|
|
592
717
|
var unit2 = (v, d) => typeof v === "number" && Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : d;
|
|
593
718
|
function normalizeStickerSettings(raw = {}, base = DEFAULT_STICKER) {
|
|
594
|
-
const
|
|
719
|
+
const refs = (list) => list.flatMap((s) => {
|
|
720
|
+
try {
|
|
721
|
+
return [_chunk4JNWA3VTcjs.normalizeStickerRef.call(void 0, s)];
|
|
722
|
+
} catch (e3) {
|
|
723
|
+
return [];
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
const stamps = Array.isArray(raw.stamps) ? refs(raw.stamps) : refs(base.stamps);
|
|
595
727
|
return {
|
|
596
|
-
stamps: stamps.length ? [...new Set(stamps)] :
|
|
728
|
+
stamps: stamps.length ? [...new Set(stamps)].slice(0, MAX_STICKER_STAMPS) : refs(base.stamps.length ? base.stamps : DEFAULT_STICKER.stamps),
|
|
597
729
|
density: unit2(raw.density, base.density),
|
|
598
730
|
sizeJitter: unit2(raw.sizeJitter, base.sizeJitter),
|
|
599
731
|
rotationJitter: unit2(raw.rotationJitter, base.rotationJitter),
|
|
@@ -601,59 +733,6 @@ function normalizeStickerSettings(raw = {}, base = DEFAULT_STICKER) {
|
|
|
601
733
|
colorJitter: unit2(raw.colorJitter, base.colorJitter)
|
|
602
734
|
};
|
|
603
735
|
}
|
|
604
|
-
function stampCoverage(kind, u, v, t) {
|
|
605
|
-
const r = Math.hypot(u, v);
|
|
606
|
-
const a = Math.atan2(v, u);
|
|
607
|
-
const edge = (d) => Math.min(1, Math.max(0, d * 24 + 0.5));
|
|
608
|
-
switch (kind) {
|
|
609
|
-
case "dot":
|
|
610
|
-
return edge(0.95 - r);
|
|
611
|
-
case "ring":
|
|
612
|
-
return edge(Math.min(0.95 - r, r - 0.6));
|
|
613
|
-
case "star": {
|
|
614
|
-
const f = (a + Math.PI / 2) * 5 / (2 * Math.PI) % 1;
|
|
615
|
-
const notch = Math.min(f < 0 ? f + 1 : f, 1 - (f < 0 ? f + 1 : f)) * 2;
|
|
616
|
-
return edge(0.95 - 0.55 * notch - r);
|
|
617
|
-
}
|
|
618
|
-
case "sparkle": {
|
|
619
|
-
const q = Math.pow(Math.abs(u) / 0.95, 0.6) + Math.pow(Math.abs(v) / 0.95, 0.6);
|
|
620
|
-
return edge((1 - q) * 0.4);
|
|
621
|
-
}
|
|
622
|
-
case "heart": {
|
|
623
|
-
const x = u * 1.1;
|
|
624
|
-
const y = -v * 1.1 + 0.15;
|
|
625
|
-
const q = x * x + y * y - 0.55;
|
|
626
|
-
return edge(-(q * q * q - x * x * y * y * y) * 3);
|
|
627
|
-
}
|
|
628
|
-
case "leaf": {
|
|
629
|
-
const w = 0.42 * Math.sqrt(Math.max(0, 1 - u * u));
|
|
630
|
-
const inside = edge(w - Math.abs(v + 0.15 * u * u));
|
|
631
|
-
const rib = Math.abs(v + 0.15 * u * u) < 0.03 && Math.abs(u) < 0.85 ? 0.65 : 1;
|
|
632
|
-
return inside * rib;
|
|
633
|
-
}
|
|
634
|
-
case "flower": {
|
|
635
|
-
const petals = 0.6 + 0.35 * Math.abs(Math.cos(2.5 * a));
|
|
636
|
-
const body = edge(petals - r);
|
|
637
|
-
return r < 0.22 ? Math.max(body, 1) * 0.85 : body;
|
|
638
|
-
}
|
|
639
|
-
case "confetti": {
|
|
640
|
-
return edge(Math.min(0.9 - Math.abs(u), 0.35 - Math.abs(v)));
|
|
641
|
-
}
|
|
642
|
-
case "splat": {
|
|
643
|
-
let rr = 0.55;
|
|
644
|
-
for (let k = 1; k <= 3; k++) rr += 0.08 * Math.sin(a * (k + 2) + _chunkPQ3H2AANcjs.hash2.call(void 0, k, 1, t) * 6.28) / k;
|
|
645
|
-
let c = edge(rr - r);
|
|
646
|
-
for (let k = 0; k < 4; k++) {
|
|
647
|
-
const ang = _chunkPQ3H2AANcjs.hash2.call(void 0, k, 7, t) * Math.PI * 2;
|
|
648
|
-
const dist = 0.72 + 0.2 * _chunkPQ3H2AANcjs.hash2.call(void 0, k, 9, t);
|
|
649
|
-
const dx = u - Math.cos(ang) * dist;
|
|
650
|
-
const dy = v - Math.sin(ang) * dist;
|
|
651
|
-
c = Math.max(c, edge(0.08 + 0.06 * _chunkPQ3H2AANcjs.hash2.call(void 0, k, 11, t) - Math.hypot(dx, dy)));
|
|
652
|
-
}
|
|
653
|
-
return c;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
736
|
function hexRgb(hex) {
|
|
658
737
|
const n = parseInt(hex.slice(1, 7), 16);
|
|
659
738
|
return [(n >> 16 & 255) / 255, (n >> 8 & 255) / 255, (n & 255) / 255];
|
|
@@ -664,7 +743,22 @@ function stickerRect(s) {
|
|
|
664
743
|
const y0 = Math.floor(s.y - r);
|
|
665
744
|
return { x: x0, y: y0, width: Math.ceil(s.x + r) - x0, height: Math.ceil(s.y + r) - y0 };
|
|
666
745
|
}
|
|
667
|
-
function
|
|
746
|
+
function stickerStamp(s) {
|
|
747
|
+
if (s.ref) {
|
|
748
|
+
try {
|
|
749
|
+
return _chunk4JNWA3VTcjs.editorStampOf.call(void 0, s.ref);
|
|
750
|
+
} catch (e4) {
|
|
751
|
+
return null;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return s.stamp && _chunk4JNWA3VTcjs.STAMP_KINDS.includes(s.stamp) ? s.stamp : null;
|
|
755
|
+
}
|
|
756
|
+
function drawSticker(medium, s, art) {
|
|
757
|
+
const kind = stickerStamp(s);
|
|
758
|
+
if (!kind) {
|
|
759
|
+
const a2 = _optionalChain([art, 'optionalCall', _11 => _11(s.ref)]);
|
|
760
|
+
return a2 ? drawArtSticker(medium, s, a2) : stickerRect(s);
|
|
761
|
+
}
|
|
668
762
|
const rect = stickerRect(s);
|
|
669
763
|
const n = rect.width * rect.height;
|
|
670
764
|
const cov = new Float32Array(n);
|
|
@@ -682,11 +776,11 @@ function drawSticker(medium, s) {
|
|
|
682
776
|
const v = (-dx * sa + dy * ca) / rad;
|
|
683
777
|
if (u < -1.05 || u > 1.05 || v < -1.05 || v > 1.05) continue;
|
|
684
778
|
let c = 0;
|
|
685
|
-
for (let k = 0; k < 4; k++) c += stampCoverage(
|
|
779
|
+
for (let k = 0; k < 4; k++) c += _chunk4JNWA3VTcjs.stampCoverage.call(void 0, kind, u + ((k & 1) - 0.5) / rad / 2, v + ((k >> 1) - 0.5) / rad / 2, s.seed);
|
|
686
780
|
c /= 4;
|
|
687
781
|
if (c <= 0) continue;
|
|
688
782
|
cov[p] = c;
|
|
689
|
-
const shade = 1 + 0.12 * (-(u + v) / 2) + 0.06 * (
|
|
783
|
+
const shade = 1 + 0.12 * (-(u + v) / 2) + 0.06 * (_chunk3K6HWEXZcjs.hash2.call(void 0, px, rect.y + yy, s.seed) - 0.5);
|
|
690
784
|
field[p * 3] = Math.min(1, Math.max(0, r * shade));
|
|
691
785
|
field[p * 3 + 1] = Math.min(1, Math.max(0, g * shade));
|
|
692
786
|
field[p * 3 + 2] = Math.min(1, Math.max(0, b * shade));
|
|
@@ -695,11 +789,40 @@ function drawSticker(medium, s) {
|
|
|
695
789
|
medium.deposit(rect, cov, s.opacity, [r, g, b], null, field);
|
|
696
790
|
return rect;
|
|
697
791
|
}
|
|
792
|
+
function drawArtSticker(medium, s, art) {
|
|
793
|
+
const rect = stickerRect(s);
|
|
794
|
+
const n = rect.width * rect.height;
|
|
795
|
+
const cov = new Float32Array(n);
|
|
796
|
+
const field = new Float32Array(n * 3);
|
|
797
|
+
const a = s.rotation * Math.PI / 180;
|
|
798
|
+
const ca = Math.cos(a);
|
|
799
|
+
const sa = Math.sin(a);
|
|
800
|
+
const scale = Math.max(art.width, art.height) / s.size;
|
|
801
|
+
const [r, g, b] = hexRgb(s.color);
|
|
802
|
+
const px = [0, 0, 0, 0];
|
|
803
|
+
for (let yy = 0, p = 0; yy < rect.height; yy++) {
|
|
804
|
+
for (let xx = 0; xx < rect.width; xx++, p++) {
|
|
805
|
+
const dx = rect.x + xx + 0.5 - s.x;
|
|
806
|
+
const dy = rect.y + yy + 0.5 - s.y;
|
|
807
|
+
const ax = (dx * ca + dy * sa) * scale + art.width / 2;
|
|
808
|
+
const ay = (-dx * sa + dy * ca) * scale + art.height / 2;
|
|
809
|
+
if (ax < -1 || ay < -1 || ax > art.width + 1 || ay > art.height + 1) continue;
|
|
810
|
+
sampleArt(art, ax, ay, px);
|
|
811
|
+
if (!(px[3] > 0)) continue;
|
|
812
|
+
cov[p] = px[3];
|
|
813
|
+
field[p * 3] = art.tintable ? r : px[0];
|
|
814
|
+
field[p * 3 + 1] = art.tintable ? g : px[1];
|
|
815
|
+
field[p * 3 + 2] = art.tintable ? b : px[2];
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
medium.deposit(rect, cov, s.opacity, [r, g, b], null, field);
|
|
819
|
+
return rect;
|
|
820
|
+
}
|
|
698
821
|
function jitterColor(hex, amount, seed, i) {
|
|
699
822
|
const [r, g, b] = hexRgb(hex);
|
|
700
823
|
const lch = _chunk7AHBW2CQcjs.oklabToOklch.call(void 0, _chunk7AHBW2CQcjs.rgbToOklab.call(void 0, { r, g, b, a: 1 }));
|
|
701
|
-
const l = Math.min(1, Math.max(0, lch.l + (
|
|
702
|
-
const h = lch.h + (
|
|
824
|
+
const l = Math.min(1, Math.max(0, lch.l + (_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 61) - 0.5) * amount * 0.3));
|
|
825
|
+
const h = lch.h + (_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 63) - 0.5) * amount * 80;
|
|
703
826
|
const at = (c) => _chunk7AHBW2CQcjs.oklabToRgb.call(void 0, _chunk7AHBW2CQcjs.oklchToOklab.call(void 0, { l, c, h, alpha: 1 }));
|
|
704
827
|
const inGamut = (o) => [o.r, o.g, o.b].every((v) => v >= -1e-4 && v <= 1 + 1e-4);
|
|
705
828
|
let out = at(lch.c);
|
|
@@ -715,8 +838,8 @@ function jitterColor(hex, amount, seed, i) {
|
|
|
715
838
|
}
|
|
716
839
|
return "#" + [out.r, out.g, out.b].map((c) => Math.round(Math.min(1, Math.max(0, c)) * 255).toString(16).padStart(2, "0")).join("");
|
|
717
840
|
}
|
|
718
|
-
var StickerSpray = (
|
|
719
|
-
constructor(init) {;
|
|
841
|
+
var StickerSpray = (_class5 = class {
|
|
842
|
+
constructor(init) {;_class5.prototype.__init20.call(this);_class5.prototype.__init21.call(this);_class5.prototype.__init22.call(this);_class5.prototype.__init23.call(this);_class5.prototype.__init24.call(this);
|
|
720
843
|
this.init = init;
|
|
721
844
|
const b = init.brush;
|
|
722
845
|
this.smoother = new PenSmoother(b.tip.smoothing, b.pressureSmoothing);
|
|
@@ -724,18 +847,20 @@ var StickerSpray = (_class4 = class {
|
|
|
724
847
|
const spacing = Math.max(0.05, 1 / Math.max(0.05, b.sticker.density * 4));
|
|
725
848
|
const walk = { ...b, tip: { ...b.tip, spacing }, dynamics: { ...b.dynamics, scatter: 0, sizeJitter: 0, angleJitter: 0 } };
|
|
726
849
|
this.walkers = this.copies.map((c, i) => new PenDabWalker(walk, init.seed + i * 7919 | 0, c.linear));
|
|
727
|
-
this.medium = new (0,
|
|
850
|
+
this.medium = new (0, _chunkI7NJPHWVcjs.TileMedium)(init.target, {});
|
|
728
851
|
this.next = init.nextId;
|
|
729
852
|
}
|
|
730
853
|
|
|
731
|
-
|
|
732
|
-
|
|
854
|
+
__init20() {this.dabCount = 0}
|
|
855
|
+
__init21() {this.stickers = []}
|
|
856
|
+
/** Refs the spray picked but could not draw because their art had not loaded. */
|
|
857
|
+
__init22() {this.skipped = /* @__PURE__ */ new Set()}
|
|
733
858
|
|
|
734
859
|
|
|
735
860
|
|
|
736
861
|
|
|
737
|
-
|
|
738
|
-
|
|
862
|
+
__init23() {this.lastRaw = null}
|
|
863
|
+
__init24() {this.lastFed = null}
|
|
739
864
|
|
|
740
865
|
push(points) {
|
|
741
866
|
const rects = [];
|
|
@@ -767,28 +892,36 @@ var StickerSpray = (_class4 = class {
|
|
|
767
892
|
const st = this.init.brush.sticker;
|
|
768
893
|
const i = this.next;
|
|
769
894
|
const seed = this.init.seed;
|
|
770
|
-
const size = d.radius * 2 * (1 - st.sizeJitter * 0.7 *
|
|
895
|
+
const size = d.radius * 2 * (1 - st.sizeJitter * 0.7 * _chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 51));
|
|
771
896
|
const off = st.scatter * d.radius * 2;
|
|
772
|
-
const a =
|
|
773
|
-
const dist =
|
|
897
|
+
const a = _chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 53) * Math.PI * 2;
|
|
898
|
+
const dist = _chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 55) * off;
|
|
774
899
|
const base = this.colorAt(d, Math.cos(a) * dist, Math.sin(a) * dist);
|
|
775
900
|
if (!(base.alpha > 0)) {
|
|
776
901
|
this.next++;
|
|
777
902
|
return;
|
|
778
903
|
}
|
|
904
|
+
const ref = _nullishCoalesce(st.stamps[Math.floor(_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 57) * st.stamps.length)], () => ( "editor:dot"));
|
|
905
|
+
const stamp = stickerStamp({ ref });
|
|
906
|
+
if (!stamp && !_optionalChain([this, 'access', _12 => _12.init, 'access', _13 => _13.art, 'optionalCall', _14 => _14(ref)])) {
|
|
907
|
+
this.skipped.add(ref);
|
|
908
|
+
this.next++;
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
779
911
|
const sticker = {
|
|
780
912
|
id: `st${this.next++}`,
|
|
781
|
-
|
|
913
|
+
ref,
|
|
914
|
+
...stamp ? { stamp } : {},
|
|
782
915
|
x: Math.round((d.x + Math.cos(a) * dist) * 100) / 100,
|
|
783
916
|
y: Math.round((d.y + Math.sin(a) * dist) * 100) / 100,
|
|
784
917
|
size: Math.max(2, Math.round(size * 10) / 10),
|
|
785
|
-
rotation: Math.round((-d.angle * 180 / Math.PI + (
|
|
918
|
+
rotation: Math.round((-d.angle * 180 / Math.PI + (_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 59) * 2 - 1) * 180 * st.rotationJitter) * 10) / 10,
|
|
786
919
|
color: st.colorJitter > 0 ? jitterColor(base.color, st.colorJitter, seed, i) : base.color,
|
|
787
920
|
opacity: Math.round(Math.min(1, d.opacity * this.init.brush.tip.opacity * base.alpha) * 1e3) / 1e3,
|
|
788
|
-
seed: Math.floor(
|
|
921
|
+
seed: Math.floor(_chunk3K6HWEXZcjs.rand01.call(void 0, seed, i, 65) * 1e9)
|
|
789
922
|
};
|
|
790
923
|
this.stickers.push(sticker);
|
|
791
|
-
rects.push(drawSticker(this.medium, sticker));
|
|
924
|
+
rects.push(drawSticker(this.medium, sticker, this.init.art));
|
|
792
925
|
this.dabCount++;
|
|
793
926
|
}
|
|
794
927
|
|
|
@@ -802,21 +935,29 @@ var StickerSpray = (_class4 = class {
|
|
|
802
935
|
}
|
|
803
936
|
const g = this.init.paint;
|
|
804
937
|
if (!g) return { color: this.init.color, alpha: 1 };
|
|
805
|
-
this.sampler ??= new (0,
|
|
938
|
+
this.sampler ??= new (0, _chunkI7NJPHWVcjs.PaintGradientSampler)(g, this.init.seed);
|
|
806
939
|
const s = g.map.by === "across-tip" ? this.sampler.sample(((dx * Math.sin(d.direction) + dy * Math.cos(d.direction)) / Math.max(0.5, d.radius) + 1) / 2) : this.sampler.dab(d);
|
|
807
940
|
return { color: "#" + s.rgb.map((c) => Math.round(Math.min(1, Math.max(0, c)) * 255).toString(16).padStart(2, "0")).join(""), alpha: s.alpha };
|
|
808
941
|
}
|
|
809
|
-
},
|
|
810
|
-
function renderStickers(stickers, target) {
|
|
811
|
-
const medium = new (0,
|
|
812
|
-
for (const s of stickers) drawSticker(medium, s);
|
|
942
|
+
}, _class5);
|
|
943
|
+
function renderStickers(stickers, target, art) {
|
|
944
|
+
const medium = new (0, _chunkI7NJPHWVcjs.TileMedium)(target, {});
|
|
945
|
+
for (const s of stickers) drawSticker(medium, s, art);
|
|
813
946
|
}
|
|
814
947
|
function normalizeStickerUpdate(u) {
|
|
815
948
|
const out = {};
|
|
949
|
+
if (u.ref !== void 0 && u.stamp !== void 0) throw new Error("Give ref or stamp, not both (stamp is the older name for an editor stamp).");
|
|
816
950
|
if (u.stamp !== void 0) {
|
|
817
|
-
if (!STAMP_KINDS.includes(u.stamp)) throw new Error(`stamp ${JSON.stringify(u.stamp)} is not a stamp; use ${STAMP_KINDS.join(", ")}.`);
|
|
951
|
+
if (!_chunk4JNWA3VTcjs.STAMP_KINDS.includes(u.stamp)) throw new Error(`stamp ${JSON.stringify(u.stamp)} is not a stamp; use ${_chunk4JNWA3VTcjs.STAMP_KINDS.join(", ")}, or ref for any sticker (find_stickers).`);
|
|
952
|
+
out.ref = `editor:${u.stamp}`;
|
|
818
953
|
out.stamp = u.stamp;
|
|
819
954
|
}
|
|
955
|
+
if (u.ref !== void 0) {
|
|
956
|
+
out.ref = _chunk4JNWA3VTcjs.normalizeStickerRef.call(void 0, u.ref);
|
|
957
|
+
const stamp = stickerStamp({ ref: out.ref });
|
|
958
|
+
if (stamp) out.stamp = stamp;
|
|
959
|
+
else out.stamp = void 0;
|
|
960
|
+
}
|
|
820
961
|
for (const k of ["x", "y"]) if (u[k] !== void 0) {
|
|
821
962
|
if (!Number.isFinite(u[k])) throw new Error(`${k} must be a number of pixels.`);
|
|
822
963
|
out[k] = u[k];
|
|
@@ -839,7 +980,7 @@ function normalizeStickerUpdate(u) {
|
|
|
839
980
|
}
|
|
840
981
|
return out;
|
|
841
982
|
}
|
|
842
|
-
function stickerSurface(stickers, base, dirty) {
|
|
983
|
+
function stickerSurface(stickers, base, dirty, art) {
|
|
843
984
|
const only = base && dirty ? new Set(dirty.flatMap((r) => _chunk474IQG74cjs.tilesInRect.call(void 0, r).map(({ tx, ty }) => _chunk474IQG74cjs.tileKey.call(void 0, tx, ty)))) : null;
|
|
844
985
|
const live = /* @__PURE__ */ new Map();
|
|
845
986
|
let scratch = null;
|
|
@@ -857,7 +998,7 @@ function stickerSurface(stickers, base, dirty) {
|
|
|
857
998
|
}
|
|
858
999
|
};
|
|
859
1000
|
const reaches = (s) => !only || _chunk474IQG74cjs.tilesInRect.call(void 0, stickerRect(s)).some(({ tx, ty }) => only.has(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)));
|
|
860
|
-
renderStickers(stickers.filter(reaches), target);
|
|
1001
|
+
renderStickers(stickers.filter(reaches), target, art);
|
|
861
1002
|
const tiles = /* @__PURE__ */ new Map();
|
|
862
1003
|
if (only && base) {
|
|
863
1004
|
for (const [k, t] of base.tiles) if (!only.has(k)) tiles.set(k, t);
|
|
@@ -868,7 +1009,7 @@ function stickerSurface(stickers, base, dirty) {
|
|
|
868
1009
|
}
|
|
869
1010
|
return new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, 0);
|
|
870
1011
|
}
|
|
871
|
-
function stickerAt(stickers, x, y) {
|
|
1012
|
+
function stickerAt(stickers, x, y, art) {
|
|
872
1013
|
for (let i = stickers.length - 1; i >= 0; i--) {
|
|
873
1014
|
const s = stickers[i];
|
|
874
1015
|
const rad = s.size / 2;
|
|
@@ -878,21 +1019,30 @@ function stickerAt(stickers, x, y) {
|
|
|
878
1019
|
const u = (dx * Math.cos(a) + dy * Math.sin(a)) / rad;
|
|
879
1020
|
const v = (-dx * Math.sin(a) + dy * Math.cos(a)) / rad;
|
|
880
1021
|
if (Math.abs(u) > 1.05 || Math.abs(v) > 1.05) continue;
|
|
881
|
-
if (s.size < 16
|
|
1022
|
+
if (s.size < 16) return s;
|
|
1023
|
+
const kind = stickerStamp(s);
|
|
1024
|
+
if (kind) {
|
|
1025
|
+
if (_chunk4JNWA3VTcjs.stampCoverage.call(void 0, kind, u, v, s.seed) > 0.25) return s;
|
|
1026
|
+
continue;
|
|
1027
|
+
}
|
|
1028
|
+
const pic = _optionalChain([art, 'optionalCall', _15 => _15(s.ref)]);
|
|
1029
|
+
if (!pic) return s;
|
|
1030
|
+
const scale = Math.max(pic.width, pic.height) / 2;
|
|
1031
|
+
if (sampleArt(pic, u * scale + pic.width / 2, v * scale + pic.height / 2, [0, 0, 0, 0])[3] > 0.25) return s;
|
|
882
1032
|
}
|
|
883
1033
|
return null;
|
|
884
1034
|
}
|
|
885
1035
|
|
|
886
1036
|
// src/paint-editor/procedural.ts
|
|
887
1037
|
var STEP_PX = 1.5;
|
|
888
|
-
var MarkStroke = (
|
|
889
|
-
constructor(brush, options) {;
|
|
1038
|
+
var MarkStroke = (_class6 = class {
|
|
1039
|
+
constructor(brush, options) {;_class6.prototype.__init25.call(this);_class6.prototype.__init26.call(this);_class6.prototype.__init27.call(this);_class6.prototype.__init28.call(this);_class6.prototype.__init29.call(this);_class6.prototype.__init30.call(this);_class6.prototype.__init31.call(this);_class6.prototype.__init32.call(this);
|
|
890
1040
|
this.brush = brush;
|
|
891
1041
|
this.options = options;
|
|
892
|
-
this.sampler = options.paint ? new (0,
|
|
893
|
-
this.tipTable = _optionalChain([this, 'access',
|
|
1042
|
+
this.sampler = options.paint ? new (0, _chunkI7NJPHWVcjs.PaintGradientSampler)(options.paint, _nullishCoalesce(options.seed, () => ( 0))) : null;
|
|
1043
|
+
this.tipTable = _optionalChain([this, 'access', _16 => _16.sampler, 'optionalAccess', _17 => _17.acrossTip]) ? this.sampler.tipTable(_chunkI7NJPHWVcjs.TIP_GRADIENT_STEPS) : null;
|
|
894
1044
|
this.smoother = new PenSmoother(brush.tip.smoothing, brush.pressureSmoothing);
|
|
895
|
-
this.copies = _optionalChain([options, 'access',
|
|
1045
|
+
this.copies = _optionalChain([options, 'access', _18 => _18.copies, 'optionalAccess', _19 => _19.length]) ? options.copies : [IDENTITY_COPY];
|
|
896
1046
|
this.seed = _nullishCoalesce(options.seed, () => ( 0));
|
|
897
1047
|
const fine = { ...brush, tip: { ...brush.tip, spacing: Math.max(0.01, Math.min(0.25, STEP_PX / Math.max(1, brush.tip.size))) } };
|
|
898
1048
|
this.walkers = this.copies.map((c, i) => new PenDabWalker(fine, (_nullishCoalesce(options.seed, () => ( 0))) + i * 7919 | 0, c.linear));
|
|
@@ -900,22 +1050,22 @@ var MarkStroke = (_class5 = class {
|
|
|
900
1050
|
}
|
|
901
1051
|
|
|
902
1052
|
|
|
903
|
-
|
|
904
|
-
|
|
1053
|
+
__init25() {this.coverage = new (0, _chunkI7NJPHWVcjs.CoverageMap)()}
|
|
1054
|
+
__init26() {this.dabCount = 0}
|
|
905
1055
|
|
|
906
1056
|
|
|
907
1057
|
|
|
908
1058
|
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
1059
|
+
__init27() {this.buf = new Float32Array(0)}
|
|
1060
|
+
__init28() {this.field = new Float32Array(0)}
|
|
1061
|
+
__init29() {this.lastRaw = null}
|
|
1062
|
+
__init30() {this.lastFed = null}
|
|
913
1063
|
|
|
914
1064
|
|
|
915
1065
|
|
|
916
1066
|
/** The pen dab the marks being made belong to, and its gradient colour. */
|
|
917
|
-
|
|
918
|
-
|
|
1067
|
+
__init31() {this.pen = null}
|
|
1068
|
+
__init32() {this.penColor = { rgb: [0, 0, 0], alpha: 1 }}
|
|
919
1069
|
push(points) {
|
|
920
1070
|
const rects = [];
|
|
921
1071
|
for (const raw of points) {
|
|
@@ -961,11 +1111,11 @@ var MarkStroke = (_class5 = class {
|
|
|
961
1111
|
if (!(r > 0.05) || !(alpha > 0)) return;
|
|
962
1112
|
const dab = { x, y, radius: Math.max(0.5, r), alpha: Math.min(1, alpha), opacity: Math.min(1, opacity), angle: 0, roundness: 1 };
|
|
963
1113
|
const hardness = this.brush.tip.hardness;
|
|
964
|
-
const rect =
|
|
1114
|
+
const rect = _chunkI7NJPHWVcjs.dabRect.call(void 0, dab, hardness);
|
|
965
1115
|
const n = rect.width * rect.height;
|
|
966
1116
|
if (n <= 0) return;
|
|
967
1117
|
const vals = this.scratch(n);
|
|
968
|
-
|
|
1118
|
+
_chunkI7NJPHWVcjs.rasterizeDab.call(void 0, dab, hardness, rect, vals);
|
|
969
1119
|
this.lay(rect, vals, dab.opacity, pressure, x, y, rects);
|
|
970
1120
|
}
|
|
971
1121
|
/**
|
|
@@ -992,7 +1142,7 @@ var MarkStroke = (_class5 = class {
|
|
|
992
1142
|
for (let sx = 0; sx < ss; sx++) {
|
|
993
1143
|
const dx = rect.x + xx + (sx + 0.5) / ss - x;
|
|
994
1144
|
const dy = rect.y + yy + (sy + 0.5) / ss - y;
|
|
995
|
-
sum += stampCoverage(kind, (dx * c + dy * s) * inv, (dy * c - dx * s) * inv, seed);
|
|
1145
|
+
sum += _chunk4JNWA3VTcjs.stampCoverage.call(void 0, kind, (dx * c + dy * s) * inv, (dy * c - dx * s) * inv, seed);
|
|
996
1146
|
}
|
|
997
1147
|
}
|
|
998
1148
|
vals[k] = sum / (ss * ss) * a;
|
|
@@ -1017,7 +1167,7 @@ var MarkStroke = (_class5 = class {
|
|
|
1017
1167
|
const grain = this.options.grain;
|
|
1018
1168
|
if (this.depth > 0 && grain) {
|
|
1019
1169
|
for (let yy = 0, k = 0; yy < rect.height; yy++)
|
|
1020
|
-
for (let xx = 0; xx < rect.width; xx++, k++) if (vals[k] > 0) vals[k] *=
|
|
1170
|
+
for (let xx = 0; xx < rect.width; xx++, k++) if (vals[k] > 0) vals[k] *= _chunkI7NJPHWVcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, rect.y + yy + 0.5), this.depth, pressure);
|
|
1021
1171
|
}
|
|
1022
1172
|
if (this.options.effect) {
|
|
1023
1173
|
if (this.field.length < n * 3) this.field = new Float32Array(n * 3);
|
|
@@ -1039,7 +1189,7 @@ var MarkStroke = (_class5 = class {
|
|
|
1039
1189
|
const n = Math.max(1, Math.ceil(len / step));
|
|
1040
1190
|
for (let i = 1; i <= n; i++) this.mark(x0 + (x1 - x0) * i / n, y0 + (y1 - y0) * i / n, r, alpha, opacity, pressure, rects);
|
|
1041
1191
|
}
|
|
1042
|
-
},
|
|
1192
|
+
}, _class6);
|
|
1043
1193
|
var PARTICLE_KINDS = ["string", "spring", "orbit", "flow", "elastic", "fuzzy"];
|
|
1044
1194
|
var PARTICLE_RENDERS = ["dot", "line", "sequence", "ribbon"];
|
|
1045
1195
|
var RIBBON_PAIRS = ["adjacent", "first-last"];
|
|
@@ -1071,7 +1221,7 @@ var DEFAULT_PARTICLE = {
|
|
|
1071
1221
|
var unit3 = (v, d) => typeof v === "number" && Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : d;
|
|
1072
1222
|
var oneOf = (v, all, d) => all.includes(v) ? v : d;
|
|
1073
1223
|
function normalizeParticle(raw = {}, base = DEFAULT_PARTICLE) {
|
|
1074
|
-
const textures = Array.isArray(raw.dotTextures) ? raw.dotTextures.filter((t) => STAMP_KINDS.includes(t)).slice(0, MAX_DOT_TEXTURES) : [..._nullishCoalesce(base.dotTextures, () => ( []))];
|
|
1224
|
+
const textures = Array.isArray(raw.dotTextures) ? raw.dotTextures.filter((t) => _chunk4JNWA3VTcjs.STAMP_KINDS.includes(t)).slice(0, MAX_DOT_TEXTURES) : [..._nullishCoalesce(base.dotTextures, () => ( []))];
|
|
1075
1225
|
return {
|
|
1076
1226
|
kind: oneOf(raw.kind, PARTICLE_KINDS, base.kind),
|
|
1077
1227
|
render: oneOf(raw.render, PARTICLE_RENDERS, base.render),
|
|
@@ -1146,7 +1296,7 @@ function curl(x, y, seed) {
|
|
|
1146
1296
|
const fy = v - y0;
|
|
1147
1297
|
const sx = fx * fx * (3 - 2 * fx);
|
|
1148
1298
|
const sy = fy * fy * (3 - 2 * fy);
|
|
1149
|
-
const h = (a2, b2) =>
|
|
1299
|
+
const h = (a2, b2) => _chunk3K6HWEXZcjs.rand01.call(void 0, seed, a2 * 73856093 + b2 * 19349663, 41);
|
|
1150
1300
|
const a = h(x0, y0);
|
|
1151
1301
|
const b = h(x0 + 1, y0);
|
|
1152
1302
|
const c = h(x0, y0 + 1);
|
|
@@ -1156,19 +1306,19 @@ function curl(x, y, seed) {
|
|
|
1156
1306
|
const e = 0.01;
|
|
1157
1307
|
return [(n(x, y + e) - n(x, y - e)) / (2 * e), -(n(x + e, y) - n(x - e, y)) / (2 * e)];
|
|
1158
1308
|
}
|
|
1159
|
-
var ParticleStroke = (
|
|
1309
|
+
var ParticleStroke = (_class7 = class extends MarkStroke {
|
|
1160
1310
|
|
|
1161
1311
|
/** Ribbon pairs per copy: particles in their order around the pen (non-flow kinds). */
|
|
1162
1312
|
|
|
1163
1313
|
|
|
1164
|
-
|
|
1314
|
+
__init33() {this.spawn = 0}
|
|
1165
1315
|
/** Textured dots drawn so far, per copy (sequence order, random picks). */
|
|
1166
1316
|
|
|
1167
1317
|
/** Ribbon fill: the area each pixel has had so far this stroke (telescoped into the coverage). */
|
|
1168
|
-
|
|
1169
|
-
|
|
1318
|
+
__init34() {this.filled = /* @__PURE__ */ new Map()}
|
|
1319
|
+
__init35() {this.pts = []}
|
|
1170
1320
|
constructor(brush, options) {
|
|
1171
|
-
super(brush, options);
|
|
1321
|
+
super(brush, options);_class7.prototype.__init33.call(this);_class7.prototype.__init34.call(this);_class7.prototype.__init35.call(this);;
|
|
1172
1322
|
this.s = brush.particle;
|
|
1173
1323
|
this.sets = this.copies.map(() => []);
|
|
1174
1324
|
this.orders = this.copies.map(() => []);
|
|
@@ -1195,8 +1345,8 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
1195
1345
|
run: 0,
|
|
1196
1346
|
bead: 0,
|
|
1197
1347
|
alive: true,
|
|
1198
|
-
wavePhase: jitter > 0 ? jitter * Math.PI * 2 *
|
|
1199
|
-
waveScale: fuzzy ? 0.6 + 0.8 *
|
|
1348
|
+
wavePhase: jitter > 0 ? jitter * Math.PI * 2 * _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 43 + copy) : 0,
|
|
1349
|
+
waveScale: fuzzy ? 0.6 + 0.8 * _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 47 + copy) : 1,
|
|
1200
1350
|
dx: x,
|
|
1201
1351
|
dy: y,
|
|
1202
1352
|
px: NaN,
|
|
@@ -1209,11 +1359,11 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
1209
1359
|
const list = this.sets[copy];
|
|
1210
1360
|
const size = Math.max(1, d.radius * 2);
|
|
1211
1361
|
for (let i = 0; i < (s.kind === "flow" ? 0 : s.count); i++) {
|
|
1212
|
-
const r =
|
|
1213
|
-
const a =
|
|
1362
|
+
const r = _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 3 + copy) * s.spread * size * 0.5;
|
|
1363
|
+
const a = _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 5 + copy) * Math.PI * 2;
|
|
1214
1364
|
const ox = Math.cos(a) * r;
|
|
1215
1365
|
const oy = Math.sin(a) * r;
|
|
1216
|
-
const p = this.newParticle(d.x + ox, d.y + oy, ox, oy, 0.6 + 0.8 *
|
|
1366
|
+
const p = this.newParticle(d.x + ox, d.y + oy, ox, oy, 0.6 + 0.8 * _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 7), a, i, copy);
|
|
1217
1367
|
if (this.strands) p.strand = Array.from({ length: 6 }, () => ({ x: d.x + ox, y: d.y + oy, vx: 0, vy: 0 }));
|
|
1218
1368
|
if (s.kind === "orbit") {
|
|
1219
1369
|
p.ox = Math.max(1, r + size * 0.15);
|
|
@@ -1250,8 +1400,8 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
1250
1400
|
while (this.spawn >= 1) {
|
|
1251
1401
|
this.spawn -= 1;
|
|
1252
1402
|
const i = this.dabCount + list.length * 31 + Math.floor(d.index);
|
|
1253
|
-
const a =
|
|
1254
|
-
const r =
|
|
1403
|
+
const a = _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 11 + copy) * Math.PI * 2;
|
|
1404
|
+
const r = _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 13 + copy) * s.spread * size * 0.5;
|
|
1255
1405
|
list.push(this.newParticle(d.x + Math.cos(a) * r, d.y + Math.sin(a) * r, 0, 0, 1, a, i, copy));
|
|
1256
1406
|
}
|
|
1257
1407
|
}
|
|
@@ -1309,7 +1459,7 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
1309
1459
|
break;
|
|
1310
1460
|
}
|
|
1311
1461
|
case "orbit": {
|
|
1312
|
-
p.phase += (0.05 + 0.3 * s.speed) * (i % 2 ? -1 : 1) * (0.7 + 0.6 *
|
|
1462
|
+
p.phase += (0.05 + 0.3 * s.speed) * (i % 2 ? -1 : 1) * (0.7 + 0.6 * _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 17));
|
|
1313
1463
|
p.x = d.x + Math.cos(p.phase) * p.ox;
|
|
1314
1464
|
p.y = d.y + Math.sin(p.phase) * p.ox + g * p.ox;
|
|
1315
1465
|
break;
|
|
@@ -1367,8 +1517,8 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
1367
1517
|
const textures = s.dotTextures;
|
|
1368
1518
|
if (!textures.length) return this.mark(x, y, r, alpha, opacity, d.pressure, rects);
|
|
1369
1519
|
const n = this.dots[copy]++;
|
|
1370
|
-
const pick = s.dotTextureOrder === "random" ? Math.min(textures.length - 1, Math.floor(
|
|
1371
|
-
const rotation = s.dotRotation === "random" ?
|
|
1520
|
+
const pick = s.dotTextureOrder === "random" ? Math.min(textures.length - 1, Math.floor(_chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, n, 31 + copy) * textures.length)) : n % textures.length;
|
|
1521
|
+
const rotation = s.dotRotation === "random" ? _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, n, 37 + copy) * Math.PI * 2 : s.dotRotation === "follow" ? mx || my ? Math.atan2(my, mx) : -d.direction : -this.brush.tip.angle * Math.PI / 180;
|
|
1372
1522
|
this.stamp(x, y, r, textures[pick], rotation, this.seed + n * 2654435761 >>> 0, alpha, opacity, d.pressure, rects);
|
|
1373
1523
|
}
|
|
1374
1524
|
/**
|
|
@@ -1445,7 +1595,7 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
1445
1595
|
}
|
|
1446
1596
|
return any;
|
|
1447
1597
|
}
|
|
1448
|
-
},
|
|
1598
|
+
}, _class7);
|
|
1449
1599
|
var DEFAULT_BRISTLE = { count: 32, stiffness: 0.5, splay: 0.5, thickness: 0.06, load: 0.6, jitter: 0.4 };
|
|
1450
1600
|
function normalizeBristle(raw = {}, base = DEFAULT_BRISTLE) {
|
|
1451
1601
|
return {
|
|
@@ -1466,16 +1616,16 @@ var BristleStroke = class extends MarkStroke {
|
|
|
1466
1616
|
const s = this.s;
|
|
1467
1617
|
this.tufts = this.copies.map(
|
|
1468
1618
|
(_, c) => Array.from({ length: s.count }, (_2, i) => {
|
|
1469
|
-
const a =
|
|
1470
|
-
const r = Math.sqrt(
|
|
1619
|
+
const a = _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 21 + c) * Math.PI * 2;
|
|
1620
|
+
const r = Math.sqrt(_chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 23 + c));
|
|
1471
1621
|
return {
|
|
1472
1622
|
u: Math.cos(a) * r,
|
|
1473
1623
|
v: Math.sin(a) * r,
|
|
1474
1624
|
x: 0,
|
|
1475
1625
|
y: 0,
|
|
1476
|
-
paint: 1 - s.jitter * 0.4 *
|
|
1477
|
-
thirst: 1 + s.jitter * (
|
|
1478
|
-
w: 1 + s.jitter * 0.6 * (
|
|
1626
|
+
paint: 1 - s.jitter * 0.4 * _chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 25 + c),
|
|
1627
|
+
thirst: 1 + s.jitter * (_chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 27 + c) * 2 - 1),
|
|
1628
|
+
w: 1 + s.jitter * 0.6 * (_chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, i, 29 + c) - 0.5),
|
|
1479
1629
|
started: false
|
|
1480
1630
|
};
|
|
1481
1631
|
})
|
|
@@ -1680,12 +1830,12 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1680
1830
|
if (rb.dirty !== void 0) mixerIn.cleanEachStroke = !rb.dirty;
|
|
1681
1831
|
if (rb.mixing !== void 0) mixerIn.mixing = rb.mixing;
|
|
1682
1832
|
}
|
|
1683
|
-
const mixer =
|
|
1833
|
+
const mixer = _chunkI7NJPHWVcjs.normalizeMixer.call(void 0, mixerIn);
|
|
1684
1834
|
let behavior = normalizeBehavior(rb, b.behavior);
|
|
1685
1835
|
if (engine === "mixer") behavior = { ...behavior, pickup: mixer.wet, mix: mixer.mix, dirty: !mixer.cleanEachStroke, mixing: mixer.mixing };
|
|
1686
1836
|
let paint = _nullishCoalesce(b.paint, () => ( null));
|
|
1687
1837
|
if (raw.paint !== void 0) {
|
|
1688
|
-
const p =
|
|
1838
|
+
const p = _chunkI7NJPHWVcjs.readPaintSource.call(void 0, raw.paint);
|
|
1689
1839
|
paint = p && p.type === "gradient" ? p : null;
|
|
1690
1840
|
} else if (rb.multicolor !== void 0) {
|
|
1691
1841
|
const mc = normalizeMultiColor(rb.multicolor, _nullishCoalesce(paintToMultiColor(paint), () => ( DEFAULT_MULTI_COLOR)));
|
|
@@ -1697,7 +1847,7 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1697
1847
|
name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim().slice(0, 80) : b.name,
|
|
1698
1848
|
category: PAINT_BRUSH_CATEGORIES.includes(raw.category) ? raw.category : b.category,
|
|
1699
1849
|
engine,
|
|
1700
|
-
tip:
|
|
1850
|
+
tip: _chunkI7NJPHWVcjs.normalizeBrush.call(void 0, { ...b.tip, ..._nullishCoalesce(raw.tip, () => ( {})) }),
|
|
1701
1851
|
grain: unit4(raw.grain, b.grain),
|
|
1702
1852
|
pressureSmoothing: range(raw.pressureSmoothing, 0, 0.95, b.pressureSmoothing),
|
|
1703
1853
|
rotation: BRUSH_ROTATIONS.includes(raw.rotation) ? raw.rotation : b.rotation,
|
|
@@ -1705,8 +1855,8 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1705
1855
|
mixer,
|
|
1706
1856
|
loadsColor: typeof raw.loadsColor === "boolean" ? raw.loadsColor : b.loadsColor,
|
|
1707
1857
|
behavior,
|
|
1708
|
-
blender:
|
|
1709
|
-
smudge:
|
|
1858
|
+
blender: _chunkI7NJPHWVcjs.normalizeBlender.call(void 0, _nullishCoalesce(raw.blender, () => ( {})), b.blender),
|
|
1859
|
+
smudge: _chunkI7NJPHWVcjs.normalizeSmudge.call(void 0, _nullishCoalesce(raw.smudge, () => ( {})), b.smudge),
|
|
1710
1860
|
wet: normalizeWetBrush(_nullishCoalesce(raw.wet, () => ( {})), _nullishCoalesce(b.wet, () => ( DEFAULT_WET_BRUSH))),
|
|
1711
1861
|
impasto: normalizeImpasto(_nullishCoalesce(raw.impasto, () => ( {})), _nullishCoalesce(b.impasto, () => ( DEFAULT_IMPASTO))),
|
|
1712
1862
|
particle: normalizeParticle(_nullishCoalesce(raw.particle, () => ( {})), _nullishCoalesce(b.particle, () => ( DEFAULT_PARTICLE))),
|
|
@@ -1722,16 +1872,16 @@ var BASE_BRUSH = {
|
|
|
1722
1872
|
name: "Round",
|
|
1723
1873
|
category: "custom",
|
|
1724
1874
|
engine: "dab",
|
|
1725
|
-
tip: { ...
|
|
1875
|
+
tip: { ..._chunkI7NJPHWVcjs.DEFAULT_BRUSH },
|
|
1726
1876
|
grain: 0,
|
|
1727
1877
|
pressureSmoothing: 0,
|
|
1728
1878
|
rotation: "fixed",
|
|
1729
1879
|
dynamics: { ...DEFAULT_DYNAMICS },
|
|
1730
|
-
mixer: { ...
|
|
1880
|
+
mixer: { ..._chunkI7NJPHWVcjs.DEFAULT_MIXER },
|
|
1731
1881
|
loadsColor: true,
|
|
1732
1882
|
behavior: { ...DEFAULT_BEHAVIOR, multicolor: { ...DEFAULT_MULTI_COLOR, colors: [] } },
|
|
1733
|
-
blender: { ...
|
|
1734
|
-
smudge: { ...
|
|
1883
|
+
blender: { ..._chunkI7NJPHWVcjs.DEFAULT_BLENDER },
|
|
1884
|
+
smudge: { ..._chunkI7NJPHWVcjs.DEFAULT_SMUDGE },
|
|
1735
1885
|
wet: { ...DEFAULT_WET_BRUSH },
|
|
1736
1886
|
impasto: { ...DEFAULT_IMPASTO },
|
|
1737
1887
|
particle: { ...DEFAULT_PARTICLE },
|
|
@@ -2480,4 +2630,8 @@ function parseBrushLibrary(raw, problems = []) {
|
|
|
2480
2630
|
|
|
2481
2631
|
|
|
2482
2632
|
|
|
2483
|
-
|
|
2633
|
+
|
|
2634
|
+
|
|
2635
|
+
|
|
2636
|
+
|
|
2637
|
+
exports.EFFECT_STRIP_HEIGHT = EFFECT_STRIP_HEIGHT; exports.EFFECT_MAP_REPEATS = EFFECT_MAP_REPEATS; exports.effectPaintSize = effectPaintSize; exports.readEffectStrokeMap = readEffectStrokeMap; exports.effectPaintKey = effectPaintKey; exports.isPaintEffectPaint = isPaintEffectPaint; exports.readPaintEffectPaint = readPaintEffectPaint; exports.sampleEffectField = sampleEffectField; exports.sampleEffectAt = sampleEffectAt; exports.effectDabField = effectDabField; exports.PAPER_FAMILIES = PAPER_FAMILIES; exports.PAPER_LIBRARY = PAPER_LIBRARY; exports.DEFAULT_PAPER = DEFAULT_PAPER; exports.paperPreset = paperPreset; exports.clonePaper = clonePaper; exports.normalizePaper = normalizePaper; exports.hexToRgb8 = hexToRgb8; exports.renderPaper = renderPaper; exports.penOrientation = penOrientation; exports.tiltToOrientation = tiltToOrientation; exports.PenSmoother = PenSmoother; exports.IDENTITY_COPY = IDENTITY_COPY; exports.PenDabWalker = PenDabWalker; exports.DryStroke = DryStroke; exports.mixerTip = mixerTip; exports.toStrokePoint = toStrokePoint; exports.STICKER_ART_SIZE = STICKER_ART_SIZE; exports.defaultStickerRasterizer = defaultStickerRasterizer; exports.StickerArtCache = StickerArtCache; exports.sampleArt = sampleArt; exports.MAX_STICKER_STAMPS = MAX_STICKER_STAMPS; exports.DEFAULT_STICKER = DEFAULT_STICKER; exports.normalizeStickerSettings = normalizeStickerSettings; exports.stickerRect = stickerRect; exports.stickerStamp = stickerStamp; exports.drawSticker = drawSticker; exports.StickerSpray = StickerSpray; exports.renderStickers = renderStickers; exports.normalizeStickerUpdate = normalizeStickerUpdate; exports.stickerSurface = stickerSurface; exports.stickerAt = stickerAt; exports.PARTICLE_KINDS = PARTICLE_KINDS; exports.PARTICLE_RENDERS = PARTICLE_RENDERS; exports.RIBBON_PAIRS = RIBBON_PAIRS; exports.DOT_TEXTURE_ORDERS = DOT_TEXTURE_ORDERS; exports.DOT_ROTATIONS = DOT_ROTATIONS; exports.MAX_DOT_TEXTURES = MAX_DOT_TEXTURES; exports.DEFAULT_PARTICLE = DEFAULT_PARTICLE; exports.normalizeParticle = normalizeParticle; exports.addPolygonArea = addPolygonArea; exports.ParticleStroke = ParticleStroke; exports.DEFAULT_BRISTLE = DEFAULT_BRISTLE; exports.normalizeBristle = normalizeBristle; exports.BristleStroke = BristleStroke; exports.PAINT_BRUSH_ENGINES = PAINT_BRUSH_ENGINES; exports.PAINT_BRUSH_CATEGORIES = PAINT_BRUSH_CATEGORIES; exports.WET_TOOLS = WET_TOOLS; exports.WET_MEDIA = WET_MEDIA; exports.DEFAULT_WET_BRUSH = DEFAULT_WET_BRUSH; exports.normalizeWetBrush = normalizeWetBrush; exports.IMPASTO_TOOLS = IMPASTO_TOOLS; exports.DEFAULT_IMPASTO = DEFAULT_IMPASTO; exports.DEFAULT_LIGHT = DEFAULT_LIGHT; exports.normalizeLight = normalizeLight; exports.normalizeImpasto = normalizeImpasto; exports.MULTI_COLOR_MODES = MULTI_COLOR_MODES; exports.DEFAULT_MULTI_COLOR = DEFAULT_MULTI_COLOR; exports.DEFAULT_BEHAVIOR = DEFAULT_BEHAVIOR; exports.BRUSH_ROTATIONS = BRUSH_ROTATIONS; exports.DEFAULT_DYNAMICS = DEFAULT_DYNAMICS; exports.normalizeDynamics = normalizeDynamics; exports.BRUSH_ID = BRUSH_ID; exports.normalizeMultiColor = normalizeMultiColor; exports.normalizeBehavior = normalizeBehavior; exports.isWetCapable = isWetCapable; exports.isWetBrush = isWetBrush; exports.usesPaintExchange = usesPaintExchange; exports.brushTakesPaint = brushTakesPaint; exports.paintToMultiColor = paintToMultiColor; exports.multiColorToPaint = multiColorToPaint; exports.normalizePaintBrush = normalizePaintBrush; exports.BUILTIN_BRUSHES = BUILTIN_BRUSHES; exports.DEFAULT_BRUSH_ID = DEFAULT_BRUSH_ID; exports.brushToJSON = brushToJSON; exports.parseBrushLibrary = parseBrushLibrary;
|