@pixerate/editor 0.207.0 → 0.209.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +60 -59
- package/dist/animation-editor/index.js +6 -5
- package/dist/{brushstrokeRender-7LXCU7PD.js → brushstrokeRender-C3UU6GVC.js} +5 -4
- package/dist/{brushstrokeRender-VO4ZTWVA.cjs → brushstrokeRender-EAJNE6WP.cjs} +12 -11
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-2N2QPO3H.js → chunk-2PBZBRP5.js} +9 -7
- package/dist/{chunk-7NW46N7I.cjs → chunk-3EHPLDFQ.cjs} +54 -52
- package/dist/{chunk-H367YTXI.js → chunk-42TWUPNJ.js} +13 -387
- package/dist/chunk-474IQG74.cjs +384 -0
- package/dist/{chunk-MLC7HUHO.js → chunk-BGOCAUXH.js} +1 -1
- package/dist/chunk-DWYQPL2A.js +2010 -0
- package/dist/{chunk-YXKLVD56.js → chunk-F7YA3MMC.js} +2 -2
- package/dist/{chunk-ZZGPYNS2.js → chunk-G4E6RUPC.js} +1 -1
- package/dist/chunk-HVVR5PZW.js +384 -0
- package/dist/{chunk-FR2Q2LVF.cjs → chunk-I7G3RSUJ.cjs} +35 -35
- package/dist/chunk-K6PXS6DO.cjs +102 -0
- package/dist/{chunk-ZIDUPSP4.js → chunk-KFIOEOCQ.js} +24 -761
- package/dist/{chunk-V7GWZIZK.cjs → chunk-KWNMBMKG.cjs} +23 -21
- package/dist/chunk-L3G23N5Y.js +763 -0
- package/dist/{chunk-GHCXLQ47.js → chunk-NDMXB4PR.js} +2 -2
- package/dist/{chunk-CWM3CUUX.cjs → chunk-OLNIPTB3.cjs} +39 -413
- package/dist/{chunk-EBDCRTZI.cjs → chunk-PQ3H2AAN.cjs} +92 -90
- package/dist/{chunk-BRKVNXDZ.cjs → chunk-QAUIZPYI.cjs} +7 -7
- package/dist/{chunk-UYXL6ZWQ.cjs → chunk-QE7D7TZR.cjs} +494 -1231
- package/dist/chunk-QYLWG22N.cjs +763 -0
- package/dist/{chunk-YQ5C5BVK.cjs → chunk-ROVK6AXX.cjs} +60 -60
- package/dist/{chunk-HGTDMKNE.cjs → chunk-UOGKSVRQ.cjs} +126 -221
- package/dist/{chunk-EL5PAHNP.js → chunk-USQCKRZG.js} +6 -4
- package/dist/{chunk-36OKQDCF.js → chunk-WJ2RBZMM.js} +5 -3
- package/dist/chunk-X4LUGTQX.cjs +2010 -0
- package/dist/{chunk-NQMP3CWF.js → chunk-YBJXCQTR.js} +15 -110
- package/dist/chunk-ZIF4UJJ6.js +102 -0
- package/dist/{chunk-WTW7QRTS.cjs → chunk-ZMHPQ6HP.cjs} +1 -1
- package/dist/image-editor/controller.d.cts +53 -5
- package/dist/image-editor/controller.d.ts +53 -5
- package/dist/image-editor/index.cjs +1806 -3356
- package/dist/image-editor/index.js +462 -2012
- package/dist/image-editor/selection/index.d.cts +1 -0
- package/dist/image-editor/selection/index.d.ts +1 -0
- package/dist/image-editor/selection/segment/focus.d.cts +2 -0
- package/dist/image-editor/selection/segment/focus.d.ts +2 -0
- package/dist/image-editor/selection/segment/grabcut.d.cts +4 -2
- package/dist/image-editor/selection/segment/grabcut.d.ts +4 -2
- package/dist/image-editor/selection/segment/sky.d.cts +2 -0
- package/dist/image-editor/selection/segment/sky.d.ts +2 -0
- package/dist/image-editor/selection/segment/subject.d.cts +2 -1
- package/dist/image-editor/selection/segment/subject.d.ts +2 -1
- package/dist/image-editor/selection/segment/work.d.cts +5 -0
- package/dist/image-editor/selection/segment/work.d.ts +5 -0
- package/dist/image-editor/selection/select-and-mask.d.cts +12 -2
- package/dist/image-editor/selection/select-and-mask.d.ts +12 -2
- package/dist/image-editor/selection/tool-options.d.cts +3 -1
- package/dist/image-editor/selection/tool-options.d.ts +3 -1
- package/dist/image-editor/selection/worker.d.cts +126 -0
- package/dist/image-editor/selection/worker.d.ts +126 -0
- package/dist/image-editor/selection-worker.cjs +14 -0
- package/dist/image-editor/selection-worker.d.cts +12 -0
- package/dist/image-editor/selection-worker.d.ts +12 -0
- package/dist/image-editor/selection-worker.js +14 -0
- package/dist/image-editor/types.d.cts +22 -0
- package/dist/image-editor/types.d.ts +22 -0
- package/dist/paint/index.cjs +6 -5
- package/dist/paint/index.js +5 -4
- package/dist/paint-editor/index.cjs +394 -390
- package/dist/paint-editor/index.js +18 -14
- package/dist/raster/index.cjs +22 -18
- package/dist/raster/index.js +29 -25
- package/dist/vector/index.cjs +986 -985
- package/dist/vector/index.js +6 -5
- package/package.json +11 -1
- package/skills/pixerate-image-editor/SKILL.md +1 -1
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkPQ3H2AANcjs = require('./chunk-PQ3H2AAN.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunk474IQG74cjs = require('./chunk-474IQG74.cjs');
|
|
30
30
|
|
|
31
31
|
// src/paint-editor/paper.ts
|
|
32
32
|
var PAPER_FAMILIES = ["watercolor", "drawing", "pastel", "canvas", "panel", "smooth"];
|
|
@@ -92,7 +92,7 @@ function normalizePaper(raw = {}, base) {
|
|
|
92
92
|
preset: typeof r.preset === "string" && r.preset ? r.preset : b.preset,
|
|
93
93
|
name: typeof r.name === "string" && r.name.trim() ? r.name.trim() : b.name,
|
|
94
94
|
family: PAPER_FAMILIES.includes(r.family) ? r.family : b.family,
|
|
95
|
-
pattern:
|
|
95
|
+
pattern: _chunkPQ3H2AANcjs.GRAIN_PATTERNS.includes(r.pattern) ? r.pattern : b.pattern,
|
|
96
96
|
seed: typeof r.seed === "number" && Number.isFinite(r.seed) ? Math.round(Math.abs(r.seed)) % 2147483647 : b.seed,
|
|
97
97
|
color: typeof r.color === "string" && HEX.test(r.color) ? r.color.toLowerCase() : b.color,
|
|
98
98
|
scale: clampNum(r.scale, 0.25, 8, b.scale),
|
|
@@ -112,7 +112,7 @@ function hexToRgb8(hex) {
|
|
|
112
112
|
const n = parseInt(hex.slice(1, 7), 16);
|
|
113
113
|
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
114
114
|
}
|
|
115
|
-
function renderPaper(paper, rect, grain = new (0,
|
|
115
|
+
function renderPaper(paper, rect, grain = new (0, _chunkPQ3H2AANcjs.PaperGrain)(paper), light) {
|
|
116
116
|
const [r, g, b] = hexToRgb8(paper.color);
|
|
117
117
|
const out = new Uint8ClampedArray(rect.width * rect.height * 4);
|
|
118
118
|
const shade = grain.flat ? 0 : paper.shading * 0.16;
|
|
@@ -274,22 +274,22 @@ var PenDabWalker = (_class2 = class {
|
|
|
274
274
|
const i = this.index++;
|
|
275
275
|
const seed = this.seed;
|
|
276
276
|
let diameter = this.diameter(s);
|
|
277
|
-
if (dyn.sizeJitter) diameter *= Math.max(0.05, 1 + dyn.sizeJitter *
|
|
277
|
+
if (dyn.sizeJitter) diameter *= Math.max(0.05, 1 + dyn.sizeJitter * _chunkPQ3H2AANcjs.randSigned.call(void 0, seed, i, 1 /* Size */));
|
|
278
278
|
const base = tip.angle * Math.PI / 180;
|
|
279
279
|
let angle;
|
|
280
280
|
if (rotation === "stroke") angle = this.dir + base;
|
|
281
281
|
else if (rotation === "barrel" && s.twist !== null) angle = this.mapAngle(base - s.twist * Math.PI / 180);
|
|
282
282
|
else if (dyn.tiltRoundness > 0 && s.lean > 0.02) angle = this.mapAngle(base - s.azimuth);
|
|
283
283
|
else angle = this.mapAngle(base);
|
|
284
|
-
if (dyn.angleJitter) angle += dyn.angleJitter * Math.PI *
|
|
284
|
+
if (dyn.angleJitter) angle += dyn.angleJitter * Math.PI * _chunkPQ3H2AANcjs.randSigned.call(void 0, seed, i, 2 /* Angle */);
|
|
285
285
|
let opacity = tip.pressureOpacity ? s.pressure : 1;
|
|
286
286
|
opacity *= 1 - dyn.tiltOpacity * s.lean * 0.8;
|
|
287
287
|
if (s.speed !== null && dyn.velocityOpacity) opacity *= Math.max(0, 1 + dyn.velocityOpacity * (Math.min(1, s.speed / FULL_SPEED) - 0.5));
|
|
288
|
-
if (dyn.opacityJitter) opacity *= 1 - dyn.opacityJitter * (
|
|
288
|
+
if (dyn.opacityJitter) opacity *= 1 - dyn.opacityJitter * (_chunkPQ3H2AANcjs.randSigned.call(void 0, seed, i, 3 /* Opacity */) * 0.5 + 0.5);
|
|
289
289
|
const flow = tip.flow * (1 - dyn.pressureFlow + dyn.pressureFlow * s.pressure);
|
|
290
290
|
let { x, y } = s;
|
|
291
291
|
if (dyn.scatter) {
|
|
292
|
-
const off = dyn.scatter * diameter *
|
|
292
|
+
const off = dyn.scatter * diameter * _chunkPQ3H2AANcjs.randSigned.call(void 0, seed, i, 4 /* Scatter */);
|
|
293
293
|
x += Math.sin(this.dir) * off;
|
|
294
294
|
y += Math.cos(this.dir) * off;
|
|
295
295
|
}
|
|
@@ -379,7 +379,7 @@ var DryStroke = (_class3 = class {
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
|
|
382
|
-
__init12() {this.coverage = new (0,
|
|
382
|
+
__init12() {this.coverage = new (0, _chunkPQ3H2AANcjs.CoverageMap)()}
|
|
383
383
|
__init13() {this.dabCount = 0}
|
|
384
384
|
|
|
385
385
|
|
|
@@ -413,16 +413,16 @@ var DryStroke = (_class3 = class {
|
|
|
413
413
|
const hardness = this.brush.tip.hardness;
|
|
414
414
|
const grain = this.options.grain;
|
|
415
415
|
for (const d of dabs) {
|
|
416
|
-
const rect =
|
|
416
|
+
const rect = _chunkPQ3H2AANcjs.dabRect.call(void 0, d, hardness);
|
|
417
417
|
const n = rect.width * rect.height;
|
|
418
418
|
if (this.buf.length < n) this.buf = new Float32Array(n);
|
|
419
419
|
const vals = this.buf.subarray(0, n);
|
|
420
|
-
|
|
420
|
+
_chunkPQ3H2AANcjs.rasterizeDab.call(void 0, d, hardness, rect, vals);
|
|
421
421
|
if (this.depth > 0 && grain) {
|
|
422
422
|
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
423
423
|
const y = rect.y + yy + 0.5;
|
|
424
424
|
for (let xx = 0; xx < rect.width; xx++, k++) {
|
|
425
|
-
if (vals[k] > 0) vals[k] *=
|
|
425
|
+
if (vals[k] > 0) vals[k] *= _chunkPQ3H2AANcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, y), this.depth, d.pressure);
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -495,14 +495,14 @@ function stampCoverage(kind, u, v, t) {
|
|
|
495
495
|
}
|
|
496
496
|
case "splat": {
|
|
497
497
|
let rr = 0.55;
|
|
498
|
-
for (let k = 1; k <= 3; k++) rr += 0.08 * Math.sin(a * (k + 2) +
|
|
498
|
+
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;
|
|
499
499
|
let c = edge(rr - r);
|
|
500
500
|
for (let k = 0; k < 4; k++) {
|
|
501
|
-
const ang =
|
|
502
|
-
const dist = 0.72 + 0.2 *
|
|
501
|
+
const ang = _chunkPQ3H2AANcjs.hash2.call(void 0, k, 7, t) * Math.PI * 2;
|
|
502
|
+
const dist = 0.72 + 0.2 * _chunkPQ3H2AANcjs.hash2.call(void 0, k, 9, t);
|
|
503
503
|
const dx = u - Math.cos(ang) * dist;
|
|
504
504
|
const dy = v - Math.sin(ang) * dist;
|
|
505
|
-
c = Math.max(c, edge(0.08 + 0.06 *
|
|
505
|
+
c = Math.max(c, edge(0.08 + 0.06 * _chunkPQ3H2AANcjs.hash2.call(void 0, k, 11, t) - Math.hypot(dx, dy)));
|
|
506
506
|
}
|
|
507
507
|
return c;
|
|
508
508
|
}
|
|
@@ -540,7 +540,7 @@ function drawSticker(medium, s) {
|
|
|
540
540
|
c /= 4;
|
|
541
541
|
if (c <= 0) continue;
|
|
542
542
|
cov[p] = c;
|
|
543
|
-
const shade = 1 + 0.12 * (-(u + v) / 2) + 0.06 * (
|
|
543
|
+
const shade = 1 + 0.12 * (-(u + v) / 2) + 0.06 * (_chunkPQ3H2AANcjs.hash2.call(void 0, px, rect.y + yy, s.seed) - 0.5);
|
|
544
544
|
field[p * 3] = Math.min(1, Math.max(0, r * shade));
|
|
545
545
|
field[p * 3 + 1] = Math.min(1, Math.max(0, g * shade));
|
|
546
546
|
field[p * 3 + 2] = Math.min(1, Math.max(0, b * shade));
|
|
@@ -551,8 +551,8 @@ function drawSticker(medium, s) {
|
|
|
551
551
|
}
|
|
552
552
|
function jitterColor(hex, amount, seed, i) {
|
|
553
553
|
const [r, g, b] = hexRgb(hex);
|
|
554
|
-
const l = (
|
|
555
|
-
const h = (
|
|
554
|
+
const l = (_chunkPQ3H2AANcjs.rand01.call(void 0, seed, i, 61) - 0.5) * amount * 0.6;
|
|
555
|
+
const h = (_chunkPQ3H2AANcjs.rand01.call(void 0, seed, i, 63) - 0.5) * amount;
|
|
556
556
|
const m = (r + g + b) / 3;
|
|
557
557
|
const rot = (c0, c1) => c0 + (c1 - c0) * h;
|
|
558
558
|
const out = [rot(r, g), rot(g, b), rot(b, r)].map((c) => Math.min(1, Math.max(0, c + l + (c - m) * 0)));
|
|
@@ -567,7 +567,7 @@ var StickerSpray = (_class4 = class {
|
|
|
567
567
|
const spacing = Math.max(0.05, 1 / Math.max(0.05, b.sticker.density * 4));
|
|
568
568
|
const walk = { ...b, tip: { ...b.tip, spacing }, dynamics: { ...b.dynamics, scatter: 0, sizeJitter: 0, angleJitter: 0 } };
|
|
569
569
|
this.walkers = this.copies.map((c, i) => new PenDabWalker(walk, init.seed + i * 7919 | 0, c.linear));
|
|
570
|
-
this.medium = new (0,
|
|
570
|
+
this.medium = new (0, _chunkPQ3H2AANcjs.TileMedium)(init.target, {});
|
|
571
571
|
this.next = init.nextId;
|
|
572
572
|
}
|
|
573
573
|
|
|
@@ -610,21 +610,21 @@ var StickerSpray = (_class4 = class {
|
|
|
610
610
|
const st = this.init.brush.sticker;
|
|
611
611
|
const i = this.next;
|
|
612
612
|
const seed = this.init.seed;
|
|
613
|
-
const size = d.radius * 2 * (1 - st.sizeJitter * 0.7 *
|
|
613
|
+
const size = d.radius * 2 * (1 - st.sizeJitter * 0.7 * _chunkPQ3H2AANcjs.rand01.call(void 0, seed, i, 51));
|
|
614
614
|
const off = st.scatter * d.radius * 2;
|
|
615
|
-
const a =
|
|
616
|
-
const dist =
|
|
615
|
+
const a = _chunkPQ3H2AANcjs.rand01.call(void 0, seed, i, 53) * Math.PI * 2;
|
|
616
|
+
const dist = _chunkPQ3H2AANcjs.rand01.call(void 0, seed, i, 55) * off;
|
|
617
617
|
const base = this.colorAt(d, Math.cos(a) * dist, Math.sin(a) * dist);
|
|
618
618
|
const sticker = {
|
|
619
619
|
id: `st${this.next++}`,
|
|
620
|
-
stamp: _nullishCoalesce(st.stamps[Math.floor(
|
|
620
|
+
stamp: _nullishCoalesce(st.stamps[Math.floor(_chunkPQ3H2AANcjs.rand01.call(void 0, seed, i, 57) * st.stamps.length)], () => ( "dot")),
|
|
621
621
|
x: Math.round((d.x + Math.cos(a) * dist) * 100) / 100,
|
|
622
622
|
y: Math.round((d.y + Math.sin(a) * dist) * 100) / 100,
|
|
623
623
|
size: Math.max(2, Math.round(size * 10) / 10),
|
|
624
|
-
rotation: Math.round((-d.angle * 180 / Math.PI + (
|
|
624
|
+
rotation: Math.round((-d.angle * 180 / Math.PI + (_chunkPQ3H2AANcjs.rand01.call(void 0, seed, i, 59) * 2 - 1) * 180 * st.rotationJitter) * 10) / 10,
|
|
625
625
|
color: st.colorJitter > 0 ? jitterColor(base.color, st.colorJitter, seed, i) : base.color,
|
|
626
626
|
opacity: Math.round(Math.min(1, d.opacity * this.init.brush.tip.opacity * base.alpha) * 1e3) / 1e3,
|
|
627
|
-
seed: Math.floor(
|
|
627
|
+
seed: Math.floor(_chunkPQ3H2AANcjs.rand01.call(void 0, seed, i, 65) * 1e9)
|
|
628
628
|
};
|
|
629
629
|
this.stickers.push(sticker);
|
|
630
630
|
rects.push(drawSticker(this.medium, sticker));
|
|
@@ -635,13 +635,13 @@ var StickerSpray = (_class4 = class {
|
|
|
635
635
|
colorAt(d, dx, dy) {
|
|
636
636
|
const g = this.init.paint;
|
|
637
637
|
if (!g) return { color: this.init.color, alpha: 1 };
|
|
638
|
-
this.sampler ??= new (0,
|
|
638
|
+
this.sampler ??= new (0, _chunkPQ3H2AANcjs.PaintGradientSampler)(g, this.init.seed);
|
|
639
639
|
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);
|
|
640
640
|
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 };
|
|
641
641
|
}
|
|
642
642
|
}, _class4);
|
|
643
643
|
function renderStickers(stickers, target) {
|
|
644
|
-
const medium = new (0,
|
|
644
|
+
const medium = new (0, _chunkPQ3H2AANcjs.TileMedium)(target, {});
|
|
645
645
|
for (const s of stickers) drawSticker(medium, s);
|
|
646
646
|
}
|
|
647
647
|
function normalizeStickerUpdate(u) {
|
|
@@ -678,21 +678,21 @@ function stickerSurface(stickers) {
|
|
|
678
678
|
offset: { x: 0, y: 0 },
|
|
679
679
|
lockTransparency: false,
|
|
680
680
|
selection: null,
|
|
681
|
-
readTile: (tx, ty) => _nullishCoalesce(live.get(
|
|
681
|
+
readTile: (tx, ty) => _nullishCoalesce(live.get(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty)), () => ( null)),
|
|
682
682
|
writeTile: (tx, ty) => {
|
|
683
|
-
const k =
|
|
683
|
+
const k = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
|
|
684
684
|
let t = live.get(k);
|
|
685
|
-
if (!t) live.set(k, t = new Uint8ClampedArray(
|
|
685
|
+
if (!t) live.set(k, t = new Uint8ClampedArray(_chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4));
|
|
686
686
|
return t;
|
|
687
687
|
}
|
|
688
688
|
};
|
|
689
689
|
renderStickers(stickers, target);
|
|
690
690
|
const tiles = /* @__PURE__ */ new Map();
|
|
691
691
|
for (const [k, d] of live) {
|
|
692
|
-
const t =
|
|
692
|
+
const t = _chunk474IQG74cjs.finishTile.call(void 0, d, 4, 0);
|
|
693
693
|
if (t) tiles.set(k, t);
|
|
694
694
|
}
|
|
695
|
-
return new (0,
|
|
695
|
+
return new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, 0);
|
|
696
696
|
}
|
|
697
697
|
|
|
698
698
|
// src/paint-editor/procedural.ts
|
|
@@ -701,8 +701,8 @@ var MarkStroke = (_class5 = class {
|
|
|
701
701
|
constructor(brush, options) {;_class5.prototype.__init21.call(this);_class5.prototype.__init22.call(this);_class5.prototype.__init23.call(this);_class5.prototype.__init24.call(this);_class5.prototype.__init25.call(this);_class5.prototype.__init26.call(this);_class5.prototype.__init27.call(this);
|
|
702
702
|
this.brush = brush;
|
|
703
703
|
this.options = options;
|
|
704
|
-
this.sampler = options.paint ? new (0,
|
|
705
|
-
this.tipTable = _optionalChain([this, 'access', _7 => _7.sampler, 'optionalAccess', _8 => _8.acrossTip]) ? this.sampler.tipTable(
|
|
704
|
+
this.sampler = options.paint ? new (0, _chunkPQ3H2AANcjs.PaintGradientSampler)(options.paint, _nullishCoalesce(options.seed, () => ( 0))) : null;
|
|
705
|
+
this.tipTable = _optionalChain([this, 'access', _7 => _7.sampler, 'optionalAccess', _8 => _8.acrossTip]) ? this.sampler.tipTable(_chunkPQ3H2AANcjs.TIP_GRADIENT_STEPS) : null;
|
|
706
706
|
this.smoother = new PenSmoother(brush.tip.smoothing, brush.pressureSmoothing);
|
|
707
707
|
this.copies = _optionalChain([options, 'access', _9 => _9.copies, 'optionalAccess', _10 => _10.length]) ? options.copies : [IDENTITY_COPY];
|
|
708
708
|
this.seed = _nullishCoalesce(options.seed, () => ( 0));
|
|
@@ -712,7 +712,7 @@ var MarkStroke = (_class5 = class {
|
|
|
712
712
|
}
|
|
713
713
|
|
|
714
714
|
|
|
715
|
-
__init21() {this.coverage = new (0,
|
|
715
|
+
__init21() {this.coverage = new (0, _chunkPQ3H2AANcjs.CoverageMap)()}
|
|
716
716
|
__init22() {this.dabCount = 0}
|
|
717
717
|
|
|
718
718
|
|
|
@@ -774,16 +774,16 @@ var MarkStroke = (_class5 = class {
|
|
|
774
774
|
if (!(r > 0.05) || !(alpha > 0)) return;
|
|
775
775
|
const dab = { x, y, radius: Math.max(0.5, r), alpha: Math.min(1, alpha), opacity: Math.min(1, opacity), angle: 0, roundness: 1 };
|
|
776
776
|
const hardness = this.brush.tip.hardness;
|
|
777
|
-
const rect =
|
|
777
|
+
const rect = _chunkPQ3H2AANcjs.dabRect.call(void 0, dab, hardness);
|
|
778
778
|
const n = rect.width * rect.height;
|
|
779
779
|
if (n <= 0) return;
|
|
780
780
|
if (this.buf.length < n) this.buf = new Float32Array(n);
|
|
781
781
|
const vals = this.buf.subarray(0, n);
|
|
782
|
-
|
|
782
|
+
_chunkPQ3H2AANcjs.rasterizeDab.call(void 0, dab, hardness, rect, vals);
|
|
783
783
|
const grain = this.options.grain;
|
|
784
784
|
if (this.depth > 0 && grain) {
|
|
785
785
|
for (let yy = 0, k = 0; yy < rect.height; yy++)
|
|
786
|
-
for (let xx = 0; xx < rect.width; xx++, k++) if (vals[k] > 0) vals[k] *=
|
|
786
|
+
for (let xx = 0; xx < rect.width; xx++, k++) if (vals[k] > 0) vals[k] *= _chunkPQ3H2AANcjs.grainCatch.call(void 0, grain.at(rect.x + xx + 0.5, rect.y + yy + 0.5), this.depth, pressure);
|
|
787
787
|
}
|
|
788
788
|
const color = this.markColor(x, y);
|
|
789
789
|
if (color && color.alpha < 1) for (let k = 0; k < n; k++) vals[k] *= color.alpha;
|
|
@@ -826,7 +826,7 @@ function curl(x, y, seed) {
|
|
|
826
826
|
const fy = v - y0;
|
|
827
827
|
const sx = fx * fx * (3 - 2 * fx);
|
|
828
828
|
const sy = fy * fy * (3 - 2 * fy);
|
|
829
|
-
const h = (a2, b2) =>
|
|
829
|
+
const h = (a2, b2) => _chunkPQ3H2AANcjs.rand01.call(void 0, seed, a2 * 73856093 + b2 * 19349663, 41);
|
|
830
830
|
const a = h(x0, y0);
|
|
831
831
|
const b = h(x0 + 1, y0);
|
|
832
832
|
const c = h(x0, y0 + 1);
|
|
@@ -850,11 +850,11 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
850
850
|
const list = this.sets[copy];
|
|
851
851
|
const size = Math.max(1, d.radius * 2);
|
|
852
852
|
for (let i = 0; i < (s.kind === "flow" ? 0 : s.count); i++) {
|
|
853
|
-
const r =
|
|
854
|
-
const a =
|
|
853
|
+
const r = _chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 3 + copy) * s.spread * size * 0.5;
|
|
854
|
+
const a = _chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 5 + copy) * Math.PI * 2;
|
|
855
855
|
const ox = Math.cos(a) * r;
|
|
856
856
|
const oy = Math.sin(a) * r;
|
|
857
|
-
const p = { x: d.x + ox, y: d.y + oy, vx: 0, vy: 0, ox, oy, k: 0.6 + 0.8 *
|
|
857
|
+
const p = { x: d.x + ox, y: d.y + oy, vx: 0, vy: 0, ox, oy, k: 0.6 + 0.8 * _chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 7), phase: a, age: 0, run: 0, bead: 0, alive: true };
|
|
858
858
|
if (s.kind === "string") p.strand = Array.from({ length: 6 }, () => ({ x: d.x + ox, y: d.y + oy, vx: 0, vy: 0 }));
|
|
859
859
|
if (s.kind === "orbit") {
|
|
860
860
|
p.ox = Math.max(1, r + size * 0.15);
|
|
@@ -879,8 +879,8 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
879
879
|
while (this.spawn >= 1) {
|
|
880
880
|
this.spawn -= 1;
|
|
881
881
|
const i = this.dabCount + list.length * 31 + Math.floor(d.index);
|
|
882
|
-
const a =
|
|
883
|
-
const r =
|
|
882
|
+
const a = _chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 11 + copy) * Math.PI * 2;
|
|
883
|
+
const r = _chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 13 + copy) * s.spread * size * 0.5;
|
|
884
884
|
list.push({ x: d.x + Math.cos(a) * r, y: d.y + Math.sin(a) * r, vx: 0, vy: 0, ox: 0, oy: 0, k: 1, phase: a, age: 0, run: 0, bead: 0, alive: true });
|
|
885
885
|
}
|
|
886
886
|
}
|
|
@@ -915,7 +915,7 @@ var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
|
915
915
|
break;
|
|
916
916
|
}
|
|
917
917
|
case "orbit": {
|
|
918
|
-
p.phase += (0.05 + 0.3 * s.speed) * (i % 2 ? -1 : 1) * (0.7 + 0.6 *
|
|
918
|
+
p.phase += (0.05 + 0.3 * s.speed) * (i % 2 ? -1 : 1) * (0.7 + 0.6 * _chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 17));
|
|
919
919
|
p.x = d.x + Math.cos(p.phase) * p.ox;
|
|
920
920
|
p.y = d.y + Math.sin(p.phase) * p.ox + g * p.ox;
|
|
921
921
|
break;
|
|
@@ -974,16 +974,16 @@ var BristleStroke = class extends MarkStroke {
|
|
|
974
974
|
const s = this.s;
|
|
975
975
|
this.tufts = this.copies.map(
|
|
976
976
|
(_, c) => Array.from({ length: s.count }, (_2, i) => {
|
|
977
|
-
const a =
|
|
978
|
-
const r = Math.sqrt(
|
|
977
|
+
const a = _chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 21 + c) * Math.PI * 2;
|
|
978
|
+
const r = Math.sqrt(_chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 23 + c));
|
|
979
979
|
return {
|
|
980
980
|
u: Math.cos(a) * r,
|
|
981
981
|
v: Math.sin(a) * r,
|
|
982
982
|
x: 0,
|
|
983
983
|
y: 0,
|
|
984
|
-
paint: 1 - s.jitter * 0.4 *
|
|
985
|
-
thirst: 1 + s.jitter * (
|
|
986
|
-
w: 1 + s.jitter * 0.6 * (
|
|
984
|
+
paint: 1 - s.jitter * 0.4 * _chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 25 + c),
|
|
985
|
+
thirst: 1 + s.jitter * (_chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 27 + c) * 2 - 1),
|
|
986
|
+
w: 1 + s.jitter * 0.6 * (_chunkPQ3H2AANcjs.rand01.call(void 0, this.seed, i, 29 + c) - 0.5),
|
|
987
987
|
started: false
|
|
988
988
|
};
|
|
989
989
|
})
|
|
@@ -1182,12 +1182,12 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1182
1182
|
if (rb.dirty !== void 0) mixerIn.cleanEachStroke = !rb.dirty;
|
|
1183
1183
|
if (rb.mixing !== void 0) mixerIn.mixing = rb.mixing;
|
|
1184
1184
|
}
|
|
1185
|
-
const mixer =
|
|
1185
|
+
const mixer = _chunkPQ3H2AANcjs.normalizeMixer.call(void 0, mixerIn);
|
|
1186
1186
|
let behavior = normalizeBehavior(rb, b.behavior);
|
|
1187
1187
|
if (engine === "mixer") behavior = { ...behavior, pickup: mixer.wet, mix: mixer.mix, dirty: !mixer.cleanEachStroke, mixing: mixer.mixing };
|
|
1188
1188
|
let paint = _nullishCoalesce(b.paint, () => ( null));
|
|
1189
1189
|
if (raw.paint !== void 0) {
|
|
1190
|
-
const p =
|
|
1190
|
+
const p = _chunkPQ3H2AANcjs.readPaintSource.call(void 0, raw.paint);
|
|
1191
1191
|
paint = p && p.type === "gradient" ? p : null;
|
|
1192
1192
|
} else if (rb.multicolor !== void 0) {
|
|
1193
1193
|
const mc = normalizeMultiColor(rb.multicolor, _nullishCoalesce(paintToMultiColor(paint), () => ( DEFAULT_MULTI_COLOR)));
|
|
@@ -1199,7 +1199,7 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1199
1199
|
name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim().slice(0, 80) : b.name,
|
|
1200
1200
|
category: PAINT_BRUSH_CATEGORIES.includes(raw.category) ? raw.category : b.category,
|
|
1201
1201
|
engine,
|
|
1202
|
-
tip:
|
|
1202
|
+
tip: _chunkPQ3H2AANcjs.normalizeBrush.call(void 0, { ...b.tip, ..._nullishCoalesce(raw.tip, () => ( {})) }),
|
|
1203
1203
|
grain: unit4(raw.grain, b.grain),
|
|
1204
1204
|
pressureSmoothing: range(raw.pressureSmoothing, 0, 0.95, b.pressureSmoothing),
|
|
1205
1205
|
rotation: BRUSH_ROTATIONS.includes(raw.rotation) ? raw.rotation : b.rotation,
|
|
@@ -1207,8 +1207,8 @@ function normalizePaintBrush(raw = {}, base) {
|
|
|
1207
1207
|
mixer,
|
|
1208
1208
|
loadsColor: typeof raw.loadsColor === "boolean" ? raw.loadsColor : b.loadsColor,
|
|
1209
1209
|
behavior,
|
|
1210
|
-
blender:
|
|
1211
|
-
smudge:
|
|
1210
|
+
blender: _chunkPQ3H2AANcjs.normalizeBlender.call(void 0, _nullishCoalesce(raw.blender, () => ( {})), b.blender),
|
|
1211
|
+
smudge: _chunkPQ3H2AANcjs.normalizeSmudge.call(void 0, _nullishCoalesce(raw.smudge, () => ( {})), b.smudge),
|
|
1212
1212
|
wet: normalizeWetBrush(_nullishCoalesce(raw.wet, () => ( {})), _nullishCoalesce(b.wet, () => ( DEFAULT_WET_BRUSH))),
|
|
1213
1213
|
impasto: normalizeImpasto(_nullishCoalesce(raw.impasto, () => ( {})), _nullishCoalesce(b.impasto, () => ( DEFAULT_IMPASTO))),
|
|
1214
1214
|
particle: normalizeParticle(_nullishCoalesce(raw.particle, () => ( {})), _nullishCoalesce(b.particle, () => ( DEFAULT_PARTICLE))),
|
|
@@ -1223,16 +1223,16 @@ var BASE_BRUSH = {
|
|
|
1223
1223
|
name: "Round",
|
|
1224
1224
|
category: "custom",
|
|
1225
1225
|
engine: "dab",
|
|
1226
|
-
tip: { ...
|
|
1226
|
+
tip: { ..._chunkPQ3H2AANcjs.DEFAULT_BRUSH },
|
|
1227
1227
|
grain: 0,
|
|
1228
1228
|
pressureSmoothing: 0,
|
|
1229
1229
|
rotation: "fixed",
|
|
1230
1230
|
dynamics: { ...DEFAULT_DYNAMICS },
|
|
1231
|
-
mixer: { ...
|
|
1231
|
+
mixer: { ..._chunkPQ3H2AANcjs.DEFAULT_MIXER },
|
|
1232
1232
|
loadsColor: true,
|
|
1233
1233
|
behavior: { ...DEFAULT_BEHAVIOR, multicolor: { ...DEFAULT_MULTI_COLOR, colors: [] } },
|
|
1234
|
-
blender: { ...
|
|
1235
|
-
smudge: { ...
|
|
1234
|
+
blender: { ..._chunkPQ3H2AANcjs.DEFAULT_BLENDER },
|
|
1235
|
+
smudge: { ..._chunkPQ3H2AANcjs.DEFAULT_SMUDGE },
|
|
1236
1236
|
wet: { ...DEFAULT_WET_BRUSH },
|
|
1237
1237
|
impasto: { ...DEFAULT_IMPASTO },
|
|
1238
1238
|
particle: { ...DEFAULT_PARTICLE },
|