@pixerate/editor 0.115.0 → 0.117.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/THIRD_PARTY_NOTICES.md +3 -0
- package/dist/animation-editor/index.cjs +54 -54
- package/dist/animation-editor/index.d.cts +2 -2
- package/dist/animation-editor/index.d.ts +2 -2
- package/dist/animation-editor/index.js +2 -2
- package/dist/{chunk-I7FQBWMQ.cjs → chunk-2J3LS7JZ.cjs} +333 -333
- package/dist/{chunk-I7FQBWMQ.cjs.map → chunk-2J3LS7JZ.cjs.map} +1 -1
- package/dist/{chunk-TFOPHZ3U.cjs → chunk-7ISPWEJA.cjs} +302 -5
- package/dist/chunk-7ISPWEJA.cjs.map +1 -0
- package/dist/{chunk-VXR7XWMF.js → chunk-7LNZAWSJ.js} +437 -41
- package/dist/chunk-7LNZAWSJ.js.map +1 -0
- package/dist/{chunk-DFQEX3AM.cjs → chunk-BYAWOAST.cjs} +223 -30
- package/dist/chunk-BYAWOAST.cjs.map +1 -0
- package/dist/chunk-COAMRKVI.cjs +159 -0
- package/dist/chunk-COAMRKVI.cjs.map +1 -0
- package/dist/{chunk-ST7E3NEE.cjs → chunk-EBSYZRSW.cjs} +230 -732
- package/dist/chunk-EBSYZRSW.cjs.map +1 -0
- package/dist/chunk-EJVDBITD.cjs +501 -0
- package/dist/chunk-EJVDBITD.cjs.map +1 -0
- package/dist/{chunk-LPLCWZTM.cjs → chunk-FODKPD44.cjs} +555 -159
- package/dist/chunk-FODKPD44.cjs.map +1 -0
- package/dist/{chunk-XK5LZKBD.js → chunk-HKDTM6VC.js} +298 -1
- package/dist/chunk-HKDTM6VC.js.map +1 -0
- package/dist/chunk-IPFRWILU.js +1908 -0
- package/dist/chunk-IPFRWILU.js.map +1 -0
- package/dist/chunk-IVSNUXW7.js +3339 -0
- package/dist/chunk-IVSNUXW7.js.map +1 -0
- package/dist/{chunk-LKCYANMW.js → chunk-JHXMNOMF.js} +198 -5
- package/dist/chunk-JHXMNOMF.js.map +1 -0
- package/dist/{chunk-FV5AXTSF.cjs → chunk-JSSBHMMU.cjs} +36 -188
- package/dist/chunk-JSSBHMMU.cjs.map +1 -0
- package/dist/chunk-L2T6EJ5S.cjs +3339 -0
- package/dist/chunk-L2T6EJ5S.cjs.map +1 -0
- package/dist/chunk-LF4WOZXZ.js +159 -0
- package/dist/chunk-LF4WOZXZ.js.map +1 -0
- package/dist/{chunk-26PGXHY7.cjs → chunk-M7O4BJRH.cjs} +36 -36
- package/dist/{chunk-26PGXHY7.cjs.map → chunk-M7O4BJRH.cjs.map} +1 -1
- package/dist/chunk-N3467VD6.js +501 -0
- package/dist/chunk-N3467VD6.js.map +1 -0
- package/dist/{chunk-XICA4PVO.js → chunk-R2JE6SA7.js} +17 -17
- package/dist/chunk-SMJGE7HM.cjs +1908 -0
- package/dist/chunk-SMJGE7HM.cjs.map +1 -0
- package/dist/{chunk-MMVHBKMM.js → chunk-T2P5TIZ6.js} +2 -2
- package/dist/{chunk-C6C5PDKU.js → chunk-VD2UDVF7.js} +102 -604
- package/dist/chunk-VD2UDVF7.js.map +1 -0
- package/dist/{chunk-FGW5OWJ4.js → chunk-VJUML33I.js} +4 -156
- package/dist/chunk-VJUML33I.js.map +1 -0
- package/dist/export/index.cjs +4 -2
- package/dist/export/index.cjs.map +1 -1
- package/dist/export/index.js +5 -3
- package/dist/{export-BJE8T0YA.d.cts → export-DMOuzgZZ.d.cts} +9 -4
- package/dist/{export-Con3UKkm.d.ts → export-Dul1SbPv.d.ts} +9 -4
- package/dist/export-Dv0-ZVrV.d.cts +501 -0
- package/dist/export-Dv0-ZVrV.d.ts +501 -0
- package/dist/{retouch-Bxkuc0KH.d.cts → flow-4-OC-UkQ.d.cts} +582 -2
- package/dist/{retouch-Do6tBs2H.d.ts → flow-Cb7lkPm8.d.ts} +582 -2
- package/dist/image-editor/index.cjs +1345 -1095
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +8 -8
- package/dist/image-editor/index.d.ts +8 -8
- package/dist/image-editor/index.js +300 -50
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/kernel-wasm-WYCGNZR4.js +10 -0
- package/dist/kernel-wasm-WYCGNZR4.js.map +1 -0
- package/dist/kernel-wasm-YPVAEMVN.cjs +10 -0
- package/dist/kernel-wasm-YPVAEMVN.cjs.map +1 -0
- package/dist/paint/index.cjs +170 -4
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +225 -3
- package/dist/paint/index.d.ts +225 -3
- package/dist/paint/index.js +171 -5
- package/dist/paint-editor/index.cjs +4735 -890
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +1526 -278
- package/dist/paint-editor/index.d.ts +1526 -278
- package/dist/paint-editor/index.js +4561 -716
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +7 -4
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +2 -2
- package/dist/raster/index.d.ts +2 -2
- package/dist/raster/index.js +36 -33
- package/dist/{render-CrmHOgpo.d.ts → render-B05K68_h.d.ts} +9 -1
- package/dist/{render-B1K_OoLy.d.cts → render-DnAbIKcs.d.cts} +9 -1
- package/dist/{svg-BnRj0q8i.d.cts → svg-CVdFc80-.d.cts} +2 -2
- package/dist/{svg-CmmBFfGT.d.ts → svg-DlEuhwoX.d.ts} +2 -2
- package/dist/{types-1SUQKDAw.d.ts → types-CDLGhAZp.d.ts} +40 -2
- package/dist/{types-yINF17Ta.d.cts → types-Tfly4Aya.d.cts} +40 -2
- package/dist/vector/index.cjs +6536 -4525
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +426 -32
- package/dist/vector/index.d.ts +426 -32
- package/dist/vector/index.js +11397 -9386
- package/dist/vector/index.js.map +1 -1
- package/dist/video-editor/index.cjs +502 -2165
- package/dist/video-editor/index.cjs.map +1 -1
- package/dist/video-editor/index.d.cts +3 -501
- package/dist/video-editor/index.d.ts +3 -501
- package/dist/video-editor/index.js +151 -1814
- package/dist/video-editor/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/pixerate-image-editor/references/photoshop-files.md +7 -3
- package/skills/pixerate-vector/SKILL.md +3 -0
- package/dist/chunk-C6C5PDKU.js.map +0 -1
- package/dist/chunk-DFQEX3AM.cjs.map +0 -1
- package/dist/chunk-FGW5OWJ4.js.map +0 -1
- package/dist/chunk-FV5AXTSF.cjs.map +0 -1
- package/dist/chunk-GX332W2C.js +0 -181
- package/dist/chunk-GX332W2C.js.map +0 -1
- package/dist/chunk-LKCYANMW.js.map +0 -1
- package/dist/chunk-LPLCWZTM.cjs.map +0 -1
- package/dist/chunk-MUUXNRU4.cjs +0 -181
- package/dist/chunk-MUUXNRU4.cjs.map +0 -1
- package/dist/chunk-ST7E3NEE.cjs.map +0 -1
- package/dist/chunk-TCKIXI46.cjs +0 -1136
- package/dist/chunk-TCKIXI46.cjs.map +0 -1
- package/dist/chunk-TFOPHZ3U.cjs.map +0 -1
- package/dist/chunk-UBIXVXPR.js +0 -1136
- package/dist/chunk-UBIXVXPR.js.map +0 -1
- package/dist/chunk-VXR7XWMF.js.map +0 -1
- package/dist/chunk-XK5LZKBD.js.map +0 -1
- /package/dist/{chunk-XICA4PVO.js.map → chunk-R2JE6SA7.js.map} +0 -0
- /package/dist/{chunk-MMVHBKMM.js.map → chunk-T2P5TIZ6.js.map} +0 -0
|
@@ -4,12 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _chunkTCKIXI46cjs = require('./chunk-TCKIXI46.cjs');
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
|
|
10
|
+
var _chunkL2T6EJ5Scjs = require('./chunk-L2T6EJ5S.cjs');
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunk7ISPWEJAcjs = require('./chunk-7ISPWEJA.cjs');
|
|
13
21
|
|
|
14
22
|
// src/paint/heal.ts
|
|
15
23
|
var TOL = 2e-3;
|
|
@@ -369,9 +377,9 @@ var TilePixelSource = (_class = class {
|
|
|
369
377
|
sample(x, y, out) {
|
|
370
378
|
const lx = x - this.offset.x;
|
|
371
379
|
const ly = y - this.offset.y;
|
|
372
|
-
const tx = Math.floor(lx /
|
|
373
|
-
const ty = Math.floor(ly /
|
|
374
|
-
const key =
|
|
380
|
+
const tx = Math.floor(lx / _chunk7ISPWEJAcjs.TILE);
|
|
381
|
+
const ty = Math.floor(ly / _chunk7ISPWEJAcjs.TILE);
|
|
382
|
+
const key = _chunk7ISPWEJAcjs.tileKey.call(void 0, tx, ty);
|
|
375
383
|
if (key !== this.lastKey) {
|
|
376
384
|
let t2 = this.cache.get(key);
|
|
377
385
|
if (t2 === void 0) {
|
|
@@ -386,7 +394,7 @@ var TilePixelSource = (_class = class {
|
|
|
386
394
|
out[0] = out[1] = out[2] = out[3] = 0;
|
|
387
395
|
return false;
|
|
388
396
|
}
|
|
389
|
-
const p = (ly - ty *
|
|
397
|
+
const p = (ly - ty * _chunk7ISPWEJAcjs.TILE) * _chunk7ISPWEJAcjs.TILE + (lx - tx * _chunk7ISPWEJAcjs.TILE);
|
|
390
398
|
if (this.channels === 1) {
|
|
391
399
|
out[0] = out[1] = out[2] = t[p];
|
|
392
400
|
out[3] = 255;
|
|
@@ -440,21 +448,21 @@ function readSourceRegion(source, rect, dx = 0, dy = 0) {
|
|
|
440
448
|
}
|
|
441
449
|
function applyRetouchToTile(coverage, tileData, channels, tx, ty, paint, s, options = {}) {
|
|
442
450
|
const out = options.into ? new Uint8ClampedArray(options.into) : new Uint8ClampedArray(tileData);
|
|
443
|
-
const ox = tx *
|
|
444
|
-
const oy = ty *
|
|
451
|
+
const ox = tx * _chunk7ISPWEJAcjs.TILE + s.offset.x;
|
|
452
|
+
const oy = ty * _chunk7ISPWEJAcjs.TILE + s.offset.y;
|
|
445
453
|
let x0 = 0;
|
|
446
454
|
let y0 = 0;
|
|
447
|
-
let x1 =
|
|
448
|
-
let y1 =
|
|
455
|
+
let x1 = _chunk7ISPWEJAcjs.TILE;
|
|
456
|
+
let y1 = _chunk7ISPWEJAcjs.TILE;
|
|
449
457
|
if (options.region) {
|
|
450
458
|
const r = options.region;
|
|
451
459
|
x0 = Math.max(0, Math.floor(r.x) - ox);
|
|
452
460
|
y0 = Math.max(0, Math.floor(r.y) - oy);
|
|
453
|
-
x1 = Math.min(
|
|
454
|
-
y1 = Math.min(
|
|
461
|
+
x1 = Math.min(_chunk7ISPWEJAcjs.TILE, Math.ceil(r.x + r.width) - ox);
|
|
462
|
+
y1 = Math.min(_chunk7ISPWEJAcjs.TILE, Math.ceil(r.y + r.height) - oy);
|
|
455
463
|
if (x1 <= x0 || y1 <= y0) return out;
|
|
456
464
|
if (options.into) {
|
|
457
|
-
for (let y = y0; y < y1; y++) out.set(tileData.subarray((y *
|
|
465
|
+
for (let y = y0; y < y1; y++) out.set(tileData.subarray((y * _chunk7ISPWEJAcjs.TILE + x0) * channels, (y * _chunk7ISPWEJAcjs.TILE + x1) * channels), (y * _chunk7ISPWEJAcjs.TILE + x0) * channels);
|
|
458
466
|
}
|
|
459
467
|
}
|
|
460
468
|
const sel = s.selection;
|
|
@@ -467,17 +475,17 @@ function applyRetouchToTile(coverage, tileData, channels, tx, ty, paint, s, opti
|
|
|
467
475
|
let covTile;
|
|
468
476
|
for (let y = y0; y < y1; y++) {
|
|
469
477
|
const dy = oy + y;
|
|
470
|
-
const cty = Math.floor(dy /
|
|
478
|
+
const cty = Math.floor(dy / _chunk7ISPWEJAcjs.TILE);
|
|
471
479
|
for (let x = x0; x < x1; x++) {
|
|
472
480
|
const dx = ox + x;
|
|
473
|
-
const ctx = Math.floor(dx /
|
|
474
|
-
const key =
|
|
481
|
+
const ctx = Math.floor(dx / _chunk7ISPWEJAcjs.TILE);
|
|
482
|
+
const key = _chunk7ISPWEJAcjs.tileKey.call(void 0, ctx, cty);
|
|
475
483
|
if (key !== covKey) {
|
|
476
484
|
covKey = key;
|
|
477
485
|
covTile = coverage.tiles.get(key);
|
|
478
486
|
}
|
|
479
487
|
if (!covTile) continue;
|
|
480
|
-
const c = covTile[(dy - cty *
|
|
488
|
+
const c = covTile[(dy - cty * _chunk7ISPWEJAcjs.TILE) * _chunk7ISPWEJAcjs.TILE + (dx - ctx * _chunk7ISPWEJAcjs.TILE)];
|
|
481
489
|
if (c <= 0) continue;
|
|
482
490
|
let k = c * s.opacity;
|
|
483
491
|
if (sel) {
|
|
@@ -486,7 +494,7 @@ function applyRetouchToTile(coverage, tileData, channels, tx, ty, paint, s, opti
|
|
|
486
494
|
}
|
|
487
495
|
if (k > 1) k = 1;
|
|
488
496
|
if (k <= 0) continue;
|
|
489
|
-
const p = y *
|
|
497
|
+
const p = y * _chunk7ISPWEJAcjs.TILE + x;
|
|
490
498
|
if (channels === 1) {
|
|
491
499
|
const g = out[p];
|
|
492
500
|
let t;
|
|
@@ -530,7 +538,7 @@ function applyRetouchToTile(coverage, tileData, channels, tx, ty, paint, s, opti
|
|
|
530
538
|
cb[ch] = out[i + ch] / 255;
|
|
531
539
|
cs[ch] = src[ch] / 255;
|
|
532
540
|
}
|
|
533
|
-
const o =
|
|
541
|
+
const o = _chunk7ISPWEJAcjs.blendPixel.call(void 0, blend, cb, cs, k);
|
|
534
542
|
out[i] = Math.round(o[0] * 255);
|
|
535
543
|
out[i + 1] = Math.round(o[1] * 255);
|
|
536
544
|
out[i + 2] = Math.round(o[2] * 255);
|
|
@@ -539,6 +547,71 @@ function applyRetouchToTile(coverage, tileData, channels, tx, ty, paint, s, opti
|
|
|
539
547
|
}
|
|
540
548
|
return out;
|
|
541
549
|
}
|
|
550
|
+
function applyToneToDeepTile(coverage, samples, tx, ty, tone, s, options = {}) {
|
|
551
|
+
const linear = samples instanceof Float32Array;
|
|
552
|
+
const out = (_nullishCoalesce(options.into, () => ( samples))).slice();
|
|
553
|
+
const ox = tx * _chunk7ISPWEJAcjs.TILE + s.offset.x;
|
|
554
|
+
const oy = ty * _chunk7ISPWEJAcjs.TILE + s.offset.y;
|
|
555
|
+
let x0 = 0;
|
|
556
|
+
let y0 = 0;
|
|
557
|
+
let x1 = _chunk7ISPWEJAcjs.TILE;
|
|
558
|
+
let y1 = _chunk7ISPWEJAcjs.TILE;
|
|
559
|
+
if (options.region) {
|
|
560
|
+
const r = options.region;
|
|
561
|
+
x0 = Math.max(0, Math.floor(r.x) - ox);
|
|
562
|
+
y0 = Math.max(0, Math.floor(r.y) - oy);
|
|
563
|
+
x1 = Math.min(_chunk7ISPWEJAcjs.TILE, Math.ceil(r.x + r.width) - ox);
|
|
564
|
+
y1 = Math.min(_chunk7ISPWEJAcjs.TILE, Math.ceil(r.y + r.height) - oy);
|
|
565
|
+
if (x1 <= x0 || y1 <= y0) return out;
|
|
566
|
+
if (options.into) for (let y = y0; y < y1; y++) out.set(samples.subarray((y * _chunk7ISPWEJAcjs.TILE + x0) * 4, (y * _chunk7ISPWEJAcjs.TILE + x1) * 4), (y * _chunk7ISPWEJAcjs.TILE + x0) * 4);
|
|
567
|
+
}
|
|
568
|
+
const sel = s.selection;
|
|
569
|
+
const rgb = [0, 0, 0];
|
|
570
|
+
const before = [0, 0, 0];
|
|
571
|
+
const excess = [0, 0, 0];
|
|
572
|
+
let covKey = NaN;
|
|
573
|
+
let covTile;
|
|
574
|
+
for (let y = y0; y < y1; y++) {
|
|
575
|
+
const dy = oy + y;
|
|
576
|
+
const cty = Math.floor(dy / _chunk7ISPWEJAcjs.TILE);
|
|
577
|
+
for (let x = x0; x < x1; x++) {
|
|
578
|
+
const dx = ox + x;
|
|
579
|
+
const ctx = Math.floor(dx / _chunk7ISPWEJAcjs.TILE);
|
|
580
|
+
const key = _chunk7ISPWEJAcjs.tileKey.call(void 0, ctx, cty);
|
|
581
|
+
if (key !== covKey) {
|
|
582
|
+
covKey = key;
|
|
583
|
+
covTile = coverage.tiles.get(key);
|
|
584
|
+
}
|
|
585
|
+
if (!covTile) continue;
|
|
586
|
+
const c = covTile[(dy - cty * _chunk7ISPWEJAcjs.TILE) * _chunk7ISPWEJAcjs.TILE + (dx - ctx * _chunk7ISPWEJAcjs.TILE)];
|
|
587
|
+
if (c <= 0) continue;
|
|
588
|
+
let k = c * s.opacity;
|
|
589
|
+
if (sel) {
|
|
590
|
+
if (dx < 0 || dy < 0 || dx >= sel.width || dy >= sel.height) continue;
|
|
591
|
+
k *= sel.data[dy * sel.width + dx] / 255;
|
|
592
|
+
}
|
|
593
|
+
if (k > 1) k = 1;
|
|
594
|
+
if (k <= 0) continue;
|
|
595
|
+
const i = (y * _chunk7ISPWEJAcjs.TILE + x) * 4;
|
|
596
|
+
if (out[i + 3] === 0) continue;
|
|
597
|
+
for (let ch = 0; ch < 3; ch++) {
|
|
598
|
+
const v = out[i + ch];
|
|
599
|
+
if (linear) {
|
|
600
|
+
excess[ch] = v > 1 ? v - 1 : 0;
|
|
601
|
+
rgb[ch] = _chunk7ISPWEJAcjs.srgbEncode.call(void 0, v > 1 ? 1 : v < 0 ? 0 : v);
|
|
602
|
+
} else rgb[ch] = v / 65535;
|
|
603
|
+
before[ch] = rgb[ch];
|
|
604
|
+
}
|
|
605
|
+
tone(rgb);
|
|
606
|
+
for (let ch = 0; ch < 3; ch++) {
|
|
607
|
+
const e = before[ch] + (rgb[ch] - before[ch]) * k;
|
|
608
|
+
if (linear) out[i + ch] = _chunk7ISPWEJAcjs.srgbDecode.call(void 0, e) + excess[ch];
|
|
609
|
+
else out[i + ch] = e <= 0 ? 0 : e >= 1 ? 65535 : Math.round(e * 65535);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return out;
|
|
614
|
+
}
|
|
542
615
|
function toneOf(tool, settings) {
|
|
543
616
|
const burn = tool === "burn";
|
|
544
617
|
return (rgb) => {
|
|
@@ -616,8 +689,8 @@ var RetouchDabStroke = (_class2 = class {
|
|
|
616
689
|
constructor(brush, target, effect) {;_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);
|
|
617
690
|
this.brush = brush;
|
|
618
691
|
this.effect = effect;
|
|
619
|
-
this.walker = new (0,
|
|
620
|
-
this.medium = new (0,
|
|
692
|
+
this.walker = new (0, _chunkL2T6EJ5Scjs.DabWalker)(brush);
|
|
693
|
+
this.medium = new (0, _chunkL2T6EJ5Scjs.TileMedium)(target);
|
|
621
694
|
}
|
|
622
695
|
|
|
623
696
|
|
|
@@ -648,11 +721,11 @@ var RetouchDabStroke = (_class2 = class {
|
|
|
648
721
|
paint(dabs) {
|
|
649
722
|
const rects = [];
|
|
650
723
|
for (const d of dabs) {
|
|
651
|
-
const rect =
|
|
724
|
+
const rect = _chunkL2T6EJ5Scjs.dabRect.call(void 0, d, this.brush.hardness);
|
|
652
725
|
const n = rect.width * rect.height;
|
|
653
726
|
if (this.buf.length < n) this.buf = new Float32Array(n);
|
|
654
727
|
const cov = this.buf.subarray(0, n);
|
|
655
|
-
|
|
728
|
+
_chunkL2T6EJ5Scjs.rasterizeDab.call(void 0, { ...d, alpha: 1 }, this.brush.hardness, rect, cov);
|
|
656
729
|
this.medium.reset();
|
|
657
730
|
this.effect(this.medium, d, rect, cov);
|
|
658
731
|
rects.push(rect);
|
|
@@ -664,7 +737,7 @@ var RetouchDabStroke = (_class2 = class {
|
|
|
664
737
|
}, _class2);
|
|
665
738
|
function smudgeEffect(brush, strength, mixing = "rgb") {
|
|
666
739
|
const s = Math.min(1, Math.max(0, strength));
|
|
667
|
-
const tip = new (0,
|
|
740
|
+
const tip = new (0, _chunkL2T6EJ5Scjs.SmudgeTip)({ strength: s, length: s, mixing }, brush.size);
|
|
668
741
|
return (medium, d, rect, cov) => tip.dab(medium, { x: d.x, y: d.y, radius: d.radius, opacity: d.opacity * d.alpha }, rect, cov);
|
|
669
742
|
}
|
|
670
743
|
function spongeEffect(brush, saturate, vibrance) {
|
|
@@ -710,19 +783,19 @@ function rgbaViewOfGrey(target) {
|
|
|
710
783
|
lockTransparency: true,
|
|
711
784
|
selection: target.selection,
|
|
712
785
|
readTile: (tx, ty) => {
|
|
713
|
-
const key =
|
|
786
|
+
const key = _chunk7ISPWEJAcjs.tileKey.call(void 0, tx, ty);
|
|
714
787
|
let v = views.get(key);
|
|
715
788
|
if (!v) {
|
|
716
|
-
v = expand(_nullishCoalesce(target.readTile(tx, ty), () => ( new Uint8ClampedArray(
|
|
789
|
+
v = expand(_nullishCoalesce(target.readTile(tx, ty), () => ( new Uint8ClampedArray(_chunk7ISPWEJAcjs.TILE * _chunk7ISPWEJAcjs.TILE))));
|
|
717
790
|
views.set(key, v);
|
|
718
791
|
}
|
|
719
792
|
return v;
|
|
720
793
|
},
|
|
721
794
|
writeTile: (tx, ty) => {
|
|
722
|
-
const key =
|
|
795
|
+
const key = _chunk7ISPWEJAcjs.tileKey.call(void 0, tx, ty);
|
|
723
796
|
let v = views.get(key);
|
|
724
797
|
if (!v) {
|
|
725
|
-
v = expand(_nullishCoalesce(target.readTile(tx, ty), () => ( new Uint8ClampedArray(
|
|
798
|
+
v = expand(_nullishCoalesce(target.readTile(tx, ty), () => ( new Uint8ClampedArray(_chunk7ISPWEJAcjs.TILE * _chunk7ISPWEJAcjs.TILE))));
|
|
726
799
|
views.set(key, v);
|
|
727
800
|
}
|
|
728
801
|
dirty.set(key, { tx, ty, data: v });
|
|
@@ -747,6 +820,126 @@ function unionRect(a, b) {
|
|
|
747
820
|
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 };
|
|
748
821
|
}
|
|
749
822
|
|
|
823
|
+
// src/paint/path-stroke.ts
|
|
824
|
+
function lean(s) {
|
|
825
|
+
if (typeof s.altitude === "number" && Number.isFinite(s.altitude)) {
|
|
826
|
+
return { amount: 1 - Math.min(1, Math.max(0, s.altitude / (Math.PI / 2))), azimuth: _nullishCoalesce(s.azimuth, () => ( 0)) };
|
|
827
|
+
}
|
|
828
|
+
if (typeof s.tiltX === "number" || typeof s.tiltY === "number") {
|
|
829
|
+
const tx = (_nullishCoalesce(s.tiltX, () => ( 0))) * Math.PI / 180;
|
|
830
|
+
const ty = (_nullishCoalesce(s.tiltY, () => ( 0))) * Math.PI / 180;
|
|
831
|
+
if (tx === 0 && ty === 0) return { amount: 0, azimuth: 0 };
|
|
832
|
+
const az = Math.atan2(Math.tan(ty), Math.tan(tx));
|
|
833
|
+
const alt = Math.atan(1 / Math.hypot(Math.tan(tx), Math.tan(ty)));
|
|
834
|
+
return { amount: 1 - alt / (Math.PI / 2), azimuth: az };
|
|
835
|
+
}
|
|
836
|
+
return null;
|
|
837
|
+
}
|
|
838
|
+
function pathStrokeDabs(samples, options) {
|
|
839
|
+
const brush = _chunkL2T6EJ5Scjs.normalizeBrush.call(void 0, options.brush);
|
|
840
|
+
const pts = options.closed && samples.length > 2 ? [...samples, samples[0]] : [...samples];
|
|
841
|
+
if (!pts.length) return [];
|
|
842
|
+
const tilt = _nullishCoalesce(options.tilt, () => ( {}));
|
|
843
|
+
const minSize = Math.min(1, Math.max(0, _nullishCoalesce(options.minSize, () => ( 0))));
|
|
844
|
+
const dab = (x, y, p, l, dir) => {
|
|
845
|
+
const pr = Math.min(1, Math.max(0, p));
|
|
846
|
+
const lean0 = _nullishCoalesce(_optionalChain([l, 'optionalAccess', _2 => _2.amount]), () => ( 0));
|
|
847
|
+
const size = brush.size * (brush.pressureSize ? minSize + (1 - minSize) * pr : 1) * (1 + 1.5 * (_nullishCoalesce(tilt.size, () => ( 0))) * lean0);
|
|
848
|
+
let angle = brush.angle * Math.PI / 180;
|
|
849
|
+
if (options.followPath) angle += dir;
|
|
850
|
+
if (tilt.followAzimuth && l) angle = -l.azimuth;
|
|
851
|
+
const roundness = Math.max(0.05, brush.roundness * (1 - 0.85 * (_nullishCoalesce(tilt.roundness, () => ( 0))) * lean0));
|
|
852
|
+
const op = brush.pressureOpacity ? pr : 1;
|
|
853
|
+
return { x, y, radius: Math.max(0.5, size / 2), alpha: brush.flow, opacity: brush.opacity * op, angle, roundness };
|
|
854
|
+
};
|
|
855
|
+
const out = [];
|
|
856
|
+
const pressure = (s) => typeof s.pressure === "number" && Number.isFinite(s.pressure) ? s.pressure : 1;
|
|
857
|
+
if (pts.length === 1) {
|
|
858
|
+
out.push(dab(pts[0].x, pts[0].y, pressure(pts[0]), lean(pts[0]), 0));
|
|
859
|
+
return out;
|
|
860
|
+
}
|
|
861
|
+
let carry = 0;
|
|
862
|
+
out.push(dab(pts[0].x, pts[0].y, pressure(pts[0]), lean(pts[0]), Math.atan2(-(pts[1].y - pts[0].y), pts[1].x - pts[0].x)));
|
|
863
|
+
for (let i = 0; i + 1 < pts.length; i++) {
|
|
864
|
+
const a = pts[i];
|
|
865
|
+
const b = pts[i + 1];
|
|
866
|
+
const dx = b.x - a.x;
|
|
867
|
+
const dy = b.y - a.y;
|
|
868
|
+
const len = Math.hypot(dx, dy);
|
|
869
|
+
if (len === 0) continue;
|
|
870
|
+
const dir = Math.atan2(-dy, dx);
|
|
871
|
+
const la = lean(a);
|
|
872
|
+
const lb = lean(b);
|
|
873
|
+
let t = carry;
|
|
874
|
+
for (; ; ) {
|
|
875
|
+
const f = t / len;
|
|
876
|
+
if (f > 1) break;
|
|
877
|
+
const p = pressure(a) + (pressure(b) - pressure(a)) * f;
|
|
878
|
+
const l = la && lb ? { amount: la.amount + (lb.amount - la.amount) * f, azimuth: la.azimuth + (lb.azimuth - la.azimuth) * f } : _nullishCoalesce(la, () => ( lb));
|
|
879
|
+
const size = brush.size * (brush.pressureSize ? minSize + (1 - minSize) * p : 1);
|
|
880
|
+
const step = Math.max(0.5, size * brush.spacing);
|
|
881
|
+
if (t > 0 || i > 0) out.push(dab(a.x + dx * f, a.y + dy * f, p, l, dir));
|
|
882
|
+
t += step;
|
|
883
|
+
}
|
|
884
|
+
carry = t - len;
|
|
885
|
+
}
|
|
886
|
+
return out;
|
|
887
|
+
}
|
|
888
|
+
function pathStrokeCoverage(samples, options) {
|
|
889
|
+
const brush = _chunkL2T6EJ5Scjs.normalizeBrush.call(void 0, options.brush);
|
|
890
|
+
const coverage = new (0, _chunkL2T6EJ5Scjs.CoverageMap)();
|
|
891
|
+
const dabs = pathStrokeDabs(samples, options);
|
|
892
|
+
let buf = new Float32Array(0);
|
|
893
|
+
let bounds = null;
|
|
894
|
+
for (const d of dabs) {
|
|
895
|
+
const rect = _chunkL2T6EJ5Scjs.dabRect.call(void 0, d, brush.hardness);
|
|
896
|
+
const n = rect.width * rect.height;
|
|
897
|
+
if (n <= 0) continue;
|
|
898
|
+
if (buf.length < n) buf = new Float32Array(n);
|
|
899
|
+
const vals = buf.subarray(0, n);
|
|
900
|
+
_chunkL2T6EJ5Scjs.rasterizeDab.call(void 0, d, brush.hardness, rect, vals);
|
|
901
|
+
coverage.accumulate(rect, vals, d.opacity);
|
|
902
|
+
if (!bounds) bounds = { ...rect };
|
|
903
|
+
else {
|
|
904
|
+
const x = Math.min(bounds.x, rect.x);
|
|
905
|
+
const y = Math.min(bounds.y, rect.y);
|
|
906
|
+
bounds = { x, y, width: Math.max(bounds.x + bounds.width, rect.x + rect.width) - x, height: Math.max(bounds.y + bounds.height, rect.y + rect.height) - y };
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
return { coverage, bounds, dabs: dabs.length };
|
|
910
|
+
}
|
|
911
|
+
function paintPathStroke(surface, samples, options) {
|
|
912
|
+
if (surface.channels !== 4) throw new Error("paintPathStroke paints RGBA surfaces (4 channels).");
|
|
913
|
+
const brush = _chunkL2T6EJ5Scjs.normalizeBrush.call(void 0, options.brush);
|
|
914
|
+
const { coverage, bounds, dabs } = pathStrokeCoverage(samples, options);
|
|
915
|
+
if (!bounds) return { surface, bounds: null, dabs };
|
|
916
|
+
const offset = _nullishCoalesce(options.offset, () => ( { x: 0, y: 0 }));
|
|
917
|
+
const apply = {
|
|
918
|
+
mode: _nullishCoalesce(options.mode, () => ( "paint")),
|
|
919
|
+
color: options.color,
|
|
920
|
+
background: [0, 0, 0, 0],
|
|
921
|
+
opacity: brush.opacity,
|
|
922
|
+
blend: _nullishCoalesce(options.blend, () => ( brush.blend)),
|
|
923
|
+
lockTransparency: _nullishCoalesce(options.lockTransparency, () => ( false)),
|
|
924
|
+
selection: _nullishCoalesce(options.selection, () => ( null)),
|
|
925
|
+
offset
|
|
926
|
+
};
|
|
927
|
+
const tiles = new Map(surface.tiles);
|
|
928
|
+
for (const { tx, ty } of _chunk7ISPWEJAcjs.tilesInRect.call(void 0, { x: bounds.x - offset.x, y: bounds.y - offset.y, width: bounds.width, height: bounds.height })) {
|
|
929
|
+
const key = _chunk7ISPWEJAcjs.tileKey.call(void 0, tx, ty);
|
|
930
|
+
const src = _optionalChain([surface, 'access', _3 => _3.tiles, 'access', _4 => _4.get, 'call', _5 => _5(key), 'optionalAccess', _6 => _6.data]);
|
|
931
|
+
const base = src && src.length === _chunk7ISPWEJAcjs.TILE * _chunk7ISPWEJAcjs.TILE * 4 ? src : new Uint8ClampedArray(_chunk7ISPWEJAcjs.TILE * _chunk7ISPWEJAcjs.TILE * 4);
|
|
932
|
+
const t = _chunk7ISPWEJAcjs.finishTile.call(void 0, _chunkL2T6EJ5Scjs.applyStrokeToTile.call(void 0, coverage, base, 4, tx, ty, apply), 4, surface.defaultValue);
|
|
933
|
+
if (t) tiles.set(key, t);
|
|
934
|
+
else tiles.delete(key);
|
|
935
|
+
}
|
|
936
|
+
return { surface: new (0, _chunk7ISPWEJAcjs.TiledSurface)(4, tiles, surface.defaultValue), bounds, dabs };
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
750
943
|
|
|
751
944
|
|
|
752
945
|
|
|
@@ -777,5 +970,5 @@ function unionRect(a, b) {
|
|
|
777
970
|
|
|
778
971
|
|
|
779
972
|
|
|
780
|
-
exports.solveMembrane = solveMembrane; exports.seamlessClone = seamlessClone; exports.membraneFill = membraneFill; exports.dilateMask = dilateMask; exports.maskBounds = maskBounds; exports.bestOffset = bestOffset; exports.TONE_RANGES = TONE_RANGES; exports.luma = luma; exports.dodgeBurnCurve = dodgeBurnCurve; exports.dodgeBurn = dodgeBurn; exports.saturationOf = saturationOf; exports.sponge = sponge; exports.perDabStrength = perDabStrength; exports.RETOUCH_SAMPLES = RETOUCH_SAMPLES; exports.SPOT_HEAL_TYPES = SPOT_HEAL_TYPES; exports.DEFAULT_RETOUCH = DEFAULT_RETOUCH; exports.normalizeRetouch = normalizeRetouch; exports.TilePixelSource = TilePixelSource; exports.RegionPixelSource = RegionPixelSource; exports.readSourceRegion = readSourceRegion; exports.applyRetouchToTile = applyRetouchToTile; exports.toneOf = toneOf; exports.healPixels = healPixels; exports.spotHealPixels = spotHealPixels; exports.spotHealWindow = spotHealWindow; exports.RetouchDabStroke = RetouchDabStroke; exports.smudgeEffect = smudgeEffect; exports.spongeEffect = spongeEffect; exports.rgbaViewOfGrey = rgbaViewOfGrey;
|
|
781
|
-
//# sourceMappingURL=chunk-
|
|
973
|
+
exports.solveMembrane = solveMembrane; exports.seamlessClone = seamlessClone; exports.membraneFill = membraneFill; exports.dilateMask = dilateMask; exports.maskBounds = maskBounds; exports.bestOffset = bestOffset; exports.TONE_RANGES = TONE_RANGES; exports.luma = luma; exports.dodgeBurnCurve = dodgeBurnCurve; exports.dodgeBurn = dodgeBurn; exports.saturationOf = saturationOf; exports.sponge = sponge; exports.perDabStrength = perDabStrength; exports.RETOUCH_SAMPLES = RETOUCH_SAMPLES; exports.SPOT_HEAL_TYPES = SPOT_HEAL_TYPES; exports.DEFAULT_RETOUCH = DEFAULT_RETOUCH; exports.normalizeRetouch = normalizeRetouch; exports.TilePixelSource = TilePixelSource; exports.RegionPixelSource = RegionPixelSource; exports.readSourceRegion = readSourceRegion; exports.applyRetouchToTile = applyRetouchToTile; exports.applyToneToDeepTile = applyToneToDeepTile; exports.toneOf = toneOf; exports.healPixels = healPixels; exports.spotHealPixels = spotHealPixels; exports.spotHealWindow = spotHealWindow; exports.RetouchDabStroke = RetouchDabStroke; exports.smudgeEffect = smudgeEffect; exports.spongeEffect = spongeEffect; exports.rgbaViewOfGrey = rgbaViewOfGrey; exports.pathStrokeDabs = pathStrokeDabs; exports.pathStrokeCoverage = pathStrokeCoverage; exports.paintPathStroke = paintPathStroke;
|
|
974
|
+
//# sourceMappingURL=chunk-BYAWOAST.cjs.map
|