@pixerate/editor 0.225.0 → 0.227.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 +66 -66
- package/dist/animation-editor/index.js +4 -4
- package/dist/{brushstrokeRender-C3UU6GVC.js → brushstrokeRender-MAHOXL7K.js} +2 -2
- package/dist/{brushstrokeRender-EAJNE6WP.cjs → brushstrokeRender-WDTKD54B.cjs} +5 -5
- package/dist/canvas/index.cjs +15 -15
- package/dist/canvas/index.js +2 -2
- package/dist/{chunk-WA4IS2EY.js → chunk-4MDWEX44.js} +1 -1
- package/dist/{chunk-7AAS3JO6.cjs → chunk-4PA6YS6W.cjs} +14 -14
- package/dist/{chunk-RDTCG5MS.js → chunk-56RFHF7O.js} +1 -1
- package/dist/{chunk-HKPLKISO.js → chunk-7DZ55AIE.js} +10 -5
- package/dist/{chunk-NTWR5TQB.cjs → chunk-ABQ2VGUB.cjs} +10 -5
- package/dist/{chunk-LCCMOWR7.cjs → chunk-ATKKG76G.cjs} +23 -23
- package/dist/{chunk-QAUIZPYI.cjs → chunk-BQE3Y6ZO.cjs} +2 -2
- package/dist/{chunk-MDNYYOBZ.cjs → chunk-C6CMQXMI.cjs} +7 -7
- package/dist/{chunk-G4E6RUPC.js → chunk-CDP2AKMA.js} +1 -1
- package/dist/{chunk-NDMXB4PR.js → chunk-CU6ANS5L.js} +1 -1
- package/dist/{chunk-ROVK6AXX.cjs → chunk-GNZI3KYK.cjs} +95 -23
- package/dist/{chunk-I7G3RSUJ.cjs → chunk-GXLZZVR5.cjs} +35 -35
- package/dist/{chunk-S6KKLFZO.js → chunk-KN3Y3FRY.js} +19 -4
- package/dist/{chunk-R35YOUP2.cjs → chunk-MXJP77K4.cjs} +104 -89
- package/dist/{chunk-F7YA3MMC.js → chunk-TQOL6CF7.js} +76 -4
- package/dist/{chunk-ZMHPQ6HP.cjs → chunk-V3L7U63N.cjs} +1 -1
- package/dist/{chunk-DJBYJOHM.js → chunk-XSVUNSDJ.js} +1 -1
- package/dist/{chunk-BGOCAUXH.js → chunk-YMREOA67.js} +1 -1
- package/dist/effects/index.cjs +44 -44
- package/dist/effects/index.js +2 -2
- package/dist/effects/tools.d.cts +6 -0
- package/dist/effects/tools.d.ts +6 -0
- package/dist/image-editor/controller.d.cts +12 -4
- package/dist/image-editor/controller.d.ts +12 -4
- package/dist/image-editor/index.cjs +944 -922
- package/dist/image-editor/index.js +49 -27
- package/dist/image-editor/layers/model.d.cts +6 -0
- package/dist/image-editor/layers/model.d.ts +6 -0
- package/dist/paint-editor/controller.d.cts +54 -3
- package/dist/paint-editor/controller.d.ts +54 -3
- package/dist/paint-editor/dab-stroke.d.cts +3 -0
- package/dist/paint-editor/dab-stroke.d.ts +3 -0
- package/dist/paint-editor/effect-paint.d.cts +47 -0
- package/dist/paint-editor/effect-paint.d.ts +47 -0
- package/dist/paint-editor/effect-tools.d.cts +4 -2
- package/dist/paint-editor/effect-tools.d.ts +4 -2
- package/dist/paint-editor/effects.d.cts +3 -0
- package/dist/paint-editor/effects.d.ts +3 -0
- package/dist/paint-editor/engine.d.cts +4 -0
- package/dist/paint-editor/engine.d.ts +4 -0
- package/dist/paint-editor/index.cjs +542 -315
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +252 -25
- package/dist/paint-editor/procedural.d.cts +4 -0
- package/dist/paint-editor/procedural.d.ts +4 -0
- package/dist/paint-editor/stroke.d.cts +9 -0
- package/dist/paint-editor/stroke.d.ts +9 -0
- package/dist/paint-editor/strokes.d.cts +6 -2
- package/dist/paint-editor/strokes.d.ts +6 -2
- package/dist/vector/index.cjs +968 -968
- package/dist/vector/index.js +5 -5
- package/dist/video-editor/index.cjs +309 -309
- package/dist/video-editor/index.js +3 -3
- package/package.json +1 -1
- package/skills/pixerate-canvas/SKILL.md +2 -1
- package/skills/pixerate-paint-editor/SKILL.md +42 -6
- package/skills/pixerate-paint-sketch-to-finish/SKILL.md +7 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkBQE3Y6ZOcjs = require('./chunk-BQE3Y6ZO.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkGF2RBSDMcjs = require('./chunk-GF2RBSDM.cjs');
|
|
@@ -1361,12 +1361,12 @@ var unit = (x, y) => {
|
|
|
1361
1361
|
return l > 1e-12 && Number.isFinite(l) ? [x / l, y / l] : null;
|
|
1362
1362
|
};
|
|
1363
1363
|
function cubicOf(sp, i) {
|
|
1364
|
-
const s =
|
|
1364
|
+
const s = _chunkBQE3Y6ZOcjs.subpathSegment.call(void 0, sp, i);
|
|
1365
1365
|
if (s.length === 4) return s;
|
|
1366
1366
|
const [a, b] = s;
|
|
1367
1367
|
return [a, [a[0] + (b[0] - a[0]) / 3, a[1] + (b[1] - a[1]) / 3], [a[0] + 2 * (b[0] - a[0]) / 3, a[1] + 2 * (b[1] - a[1]) / 3], b];
|
|
1368
1368
|
}
|
|
1369
|
-
var isLine = (sp, i) =>
|
|
1369
|
+
var isLine = (sp, i) => _chunkBQE3Y6ZOcjs.subpathSegment.call(void 0, sp, i).length === 2;
|
|
1370
1370
|
function startTangent(c) {
|
|
1371
1371
|
for (let k = 1; k < 4; k++) {
|
|
1372
1372
|
const u = unit(c[k][0] - c[0][0], c[k][1] - c[0][1]);
|
|
@@ -1386,10 +1386,10 @@ function sample(c, n, out, withStart) {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
var onAnchor = (a, h) => !h || Math.abs(h.x - a.x) < EPS && Math.abs(h.y - a.y) < EPS;
|
|
1388
1388
|
function tidy(a, keepType = true) {
|
|
1389
|
-
const next =
|
|
1389
|
+
const next = _chunkBQE3Y6ZOcjs.cloneAnchor.call(void 0, a);
|
|
1390
1390
|
if (onAnchor(next, next.in)) delete next.in;
|
|
1391
1391
|
if (onAnchor(next, next.out)) delete next.out;
|
|
1392
|
-
const shown =
|
|
1392
|
+
const shown = _chunkBQE3Y6ZOcjs.inferAnchorType.call(void 0, next);
|
|
1393
1393
|
const type = keepType && a.type ? a.type === "symmetric" && shown !== "symmetric" ? shown === "corner" ? "corner" : "smooth" : a.type === "smooth" && shown === "corner" ? "corner" : a.type : shown;
|
|
1394
1394
|
if (type === "corner") delete next.type;
|
|
1395
1395
|
else next.type = type;
|
|
@@ -1433,7 +1433,7 @@ function fitAcross(pts, N, t0, t1) {
|
|
|
1433
1433
|
return goldenMin(fit, 0, 1);
|
|
1434
1434
|
}
|
|
1435
1435
|
function removeAnchorKeepingShape(sp, index) {
|
|
1436
|
-
const anchors = sp.anchors.map(
|
|
1436
|
+
const anchors = sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor);
|
|
1437
1437
|
const n = anchors.length;
|
|
1438
1438
|
if (index < 0 || index >= n) return { anchors, closed: sp.closed };
|
|
1439
1439
|
if ((sp.closed || index > 0 && index < n - 1) && n >= 3) {
|
|
@@ -1467,12 +1467,12 @@ function removeAnchorKeepingShape(sp, index) {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
function removeAnchorsKeepingShape(sp, indices) {
|
|
1469
1469
|
const order = [...new Set(indices)].filter((i) => i >= 0 && i < sp.anchors.length).sort((a, b) => b - a);
|
|
1470
|
-
return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(
|
|
1470
|
+
return order.reduce((acc, i) => removeAnchorKeepingShape(acc, i), { anchors: sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor), closed: sp.closed });
|
|
1471
1471
|
}
|
|
1472
1472
|
function bendSegment(sp, segment, t, p) {
|
|
1473
|
-
const anchors = sp.anchors.map(
|
|
1473
|
+
const anchors = sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor);
|
|
1474
1474
|
const n = anchors.length;
|
|
1475
|
-
if (segment < 0 || segment >=
|
|
1475
|
+
if (segment < 0 || segment >= _chunkBQE3Y6ZOcjs.subpathSegmentCount.call(void 0, sp) || !Number.isFinite(t) || !Number.isFinite(p.x) || !Number.isFinite(p.y)) return { anchors, closed: sp.closed };
|
|
1476
1476
|
const tc = Math.min(0.95, Math.max(0.05, t));
|
|
1477
1477
|
const ia = segment;
|
|
1478
1478
|
const ib = (segment + 1) % n;
|
|
@@ -1483,16 +1483,16 @@ function bendSegment(sp, segment, t, p) {
|
|
|
1483
1483
|
const oy = (p.y - (a.y + (b.y - a.y) * tc)) / k;
|
|
1484
1484
|
const c1 = { x: a.x + (b.x - a.x) / 3 + ox, y: a.y + (b.y - a.y) / 3 + oy };
|
|
1485
1485
|
const c2 = { x: b.x + (a.x - b.x) / 3 + ox, y: b.y + (a.y - b.y) / 3 + oy };
|
|
1486
|
-
anchors[ia] =
|
|
1487
|
-
anchors[ib] =
|
|
1486
|
+
anchors[ia] = _chunkBQE3Y6ZOcjs.moveAnchorHandle.call(void 0, a, "out", c1);
|
|
1487
|
+
anchors[ib] = _chunkBQE3Y6ZOcjs.moveAnchorHandle.call(void 0, b, "in", c2);
|
|
1488
1488
|
return { anchors, closed: sp.closed };
|
|
1489
1489
|
}
|
|
1490
1490
|
function subpathPointAt(sp, segment, t) {
|
|
1491
|
-
const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0,
|
|
1491
|
+
const [x, y] = _chunkGF2RBSDMcjs.segmentPoint.call(void 0, _chunkBQE3Y6ZOcjs.subpathSegment.call(void 0, sp, segment), t);
|
|
1492
1492
|
return { x, y };
|
|
1493
1493
|
}
|
|
1494
1494
|
function curvatureMoveAnchor(sp, index, q) {
|
|
1495
|
-
const anchors = sp.anchors.map(
|
|
1495
|
+
const anchors = sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor);
|
|
1496
1496
|
const a = sp.anchors[index];
|
|
1497
1497
|
if (!a) return { anchors, closed: sp.closed };
|
|
1498
1498
|
const own = [
|
|
@@ -1538,7 +1538,7 @@ function curvatureMoveAnchor(sp, index, q) {
|
|
|
1538
1538
|
function cutSubpathAt(sp, at) {
|
|
1539
1539
|
const n = sp.anchors.length;
|
|
1540
1540
|
const cuts = [...new Set(at)].filter((i) => Number.isInteger(i) && i >= 0 && i < n && (sp.closed || i > 0 && i < n - 1)).sort((a, b) => a - b);
|
|
1541
|
-
if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(
|
|
1541
|
+
if (!cuts.length || n < 2) return [{ anchors: sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor), closed: sp.closed }];
|
|
1542
1542
|
const first = cuts[0];
|
|
1543
1543
|
const run = sp.closed ? Array.from({ length: n + 1 }, (_, i) => sp.anchors[(first + i) % n]) : sp.anchors;
|
|
1544
1544
|
const cutSet = new Set(sp.closed ? [...cuts.map((c) => (c - first + n) % n), n] : cuts);
|
|
@@ -1546,7 +1546,7 @@ function cutSubpathAt(sp, at) {
|
|
|
1546
1546
|
let cur = [];
|
|
1547
1547
|
run.forEach((a, i) => {
|
|
1548
1548
|
if (!cutSet.has(i)) {
|
|
1549
|
-
cur.push(
|
|
1549
|
+
cur.push(_chunkBQE3Y6ZOcjs.cloneAnchor.call(void 0, a));
|
|
1550
1550
|
return;
|
|
1551
1551
|
}
|
|
1552
1552
|
if (cur.length) {
|
|
@@ -1561,10 +1561,10 @@ function cutSubpathAt(sp, at) {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
function splitSubpathAt(sp, segment, t, endTolerance = 1e-6) {
|
|
1563
1563
|
const n = sp.anchors.length;
|
|
1564
|
-
if (segment < 0 || segment >=
|
|
1564
|
+
if (segment < 0 || segment >= _chunkBQE3Y6ZOcjs.subpathSegmentCount.call(void 0, sp)) return [{ anchors: sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor), closed: sp.closed }];
|
|
1565
1565
|
if (t <= endTolerance) return cutSubpathAt(sp, [segment]);
|
|
1566
1566
|
if (t >= 1 - endTolerance) return cutSubpathAt(sp, [(segment + 1) % n]);
|
|
1567
|
-
const { subpath, index } =
|
|
1567
|
+
const { subpath, index } = _chunkBQE3Y6ZOcjs.insertAnchor.call(void 0, sp, segment, t);
|
|
1568
1568
|
return cutSubpathAt(subpath, [index]);
|
|
1569
1569
|
}
|
|
1570
1570
|
var endOf = (sp, last) => sp.anchors[last ? sp.anchors.length - 1 : 0];
|
|
@@ -1587,7 +1587,7 @@ function joinSubpaths(subpaths, tolerance) {
|
|
|
1587
1587
|
const closed = [];
|
|
1588
1588
|
let open = [];
|
|
1589
1589
|
for (const sp of subpaths) {
|
|
1590
|
-
const copy = { anchors: sp.anchors.map(
|
|
1590
|
+
const copy = { anchors: sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor), closed: sp.closed };
|
|
1591
1591
|
if (sp.closed || sp.anchors.length < 2) {
|
|
1592
1592
|
if (sp.anchors.length) closed.push(copy);
|
|
1593
1593
|
} else open.push(copy);
|
|
@@ -1642,7 +1642,7 @@ function smoothSubpath(sp, amount = 1, only) {
|
|
|
1642
1642
|
const t = Math.min(1, Math.max(0, amount));
|
|
1643
1643
|
const orig = sp.anchors;
|
|
1644
1644
|
const n = orig.length;
|
|
1645
|
-
const anchors = orig.map(
|
|
1645
|
+
const anchors = orig.map(_chunkBQE3Y6ZOcjs.cloneAnchor);
|
|
1646
1646
|
if (n < 3 || t === 0) return { anchors, closed: sp.closed };
|
|
1647
1647
|
for (let i = 0; i < n; i++) {
|
|
1648
1648
|
if (!sp.closed && (i === 0 || i === n - 1)) continue;
|
|
@@ -1671,8 +1671,8 @@ function smoothSubpath(sp, amount = 1, only) {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
function segsOf(sp) {
|
|
1673
1673
|
const out = [];
|
|
1674
|
-
for (let i = 0; i <
|
|
1675
|
-
const s =
|
|
1674
|
+
for (let i = 0; i < _chunkBQE3Y6ZOcjs.subpathSegmentCount.call(void 0, sp); i++) {
|
|
1675
|
+
const s = _chunkBQE3Y6ZOcjs.subpathSegment.call(void 0, sp, i);
|
|
1676
1676
|
out.push(s.length === 2 ? { c: s, line: true } : { c: s, line: false });
|
|
1677
1677
|
}
|
|
1678
1678
|
return out;
|
|
@@ -1729,7 +1729,7 @@ function removeRedundantPoints(sp, tolerance) {
|
|
|
1729
1729
|
const tol = Math.max(tolerance, 1e-9);
|
|
1730
1730
|
const types = new Map(sp.anchors.filter((a) => a.type).map((a) => [`${a.x},${a.y}`, a.type]));
|
|
1731
1731
|
const segs = segsOf(sp).filter((s) => !isZeroSeg(s));
|
|
1732
|
-
if (!segs.length) return { anchors: sp.anchors.map(
|
|
1732
|
+
if (!segs.length) return { anchors: sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor), closed: sp.closed };
|
|
1733
1733
|
const minSegs = sp.closed ? 2 : 1;
|
|
1734
1734
|
let changed = true;
|
|
1735
1735
|
while (changed && segs.length > minSegs) {
|
|
@@ -1747,7 +1747,7 @@ function removeRedundantPoints(sp, tolerance) {
|
|
|
1747
1747
|
break;
|
|
1748
1748
|
}
|
|
1749
1749
|
}
|
|
1750
|
-
return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(
|
|
1750
|
+
return _nullishCoalesce(segsToSubpath(segs, sp.closed, types), () => ( { anchors: sp.anchors.map(_chunkBQE3Y6ZOcjs.cloneAnchor), closed: sp.closed }));
|
|
1751
1751
|
}
|
|
1752
1752
|
|
|
1753
1753
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkGNZI3KYKcjs = require('./chunk-GNZI3KYK.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkCVFAAZXEcjs = require('./chunk-CVFAAZXE.cjs');
|
|
@@ -2527,7 +2527,7 @@ function vectorExtrudeFaces(path, params) {
|
|
|
2527
2527
|
// src/vector/brushstroke.ts
|
|
2528
2528
|
var VECTOR_BRUSHSTROKE_SCALE = 2;
|
|
2529
2529
|
function vectorBrushstrokeBrushes() {
|
|
2530
|
-
return
|
|
2530
|
+
return _chunkGNZI3KYKcjs.BUILTIN_BRUSHES.filter((b) => _chunkPQ3H2AANcjs.isBrushstrokeBrush.call(void 0, b));
|
|
2531
2531
|
}
|
|
2532
2532
|
function vectorBrushstrokeBrush(id) {
|
|
2533
2533
|
return _nullishCoalesce(vectorBrushstrokeBrushes().find((b) => b.id === id), () => ( null));
|
|
@@ -7,7 +7,7 @@ var _chunkPY4GWSE2cjs = require('./chunk-PY4GWSE2.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkABQ2VGUBcjs = require('./chunk-ABQ2VGUB.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkWOFXZ3XUcjs = require('./chunk-WOFXZ3XU.cjs');
|
|
@@ -1307,12 +1307,12 @@ function videoEffectLayerKey(layer, width, height) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
function mixEffectPixels(a, b, k) {
|
|
1309
1309
|
if (k >= 1) return b;
|
|
1310
|
-
const out =
|
|
1310
|
+
const out = _chunkABQ2VGUBcjs.createEffectPixels.call(void 0, a.width, a.height);
|
|
1311
1311
|
for (let i = 0; i < out.data.length; i++) out.data[i] = a.data[i] + (b.data[i] - a.data[i]) * k;
|
|
1312
1312
|
return out;
|
|
1313
1313
|
}
|
|
1314
1314
|
function overEffectPixels(base, top, opacity = 1) {
|
|
1315
|
-
const out =
|
|
1315
|
+
const out = _chunkABQ2VGUBcjs.createEffectPixels.call(void 0, base.width, base.height);
|
|
1316
1316
|
const o = out.data;
|
|
1317
1317
|
const b = base.data;
|
|
1318
1318
|
const t = top.data;
|
|
@@ -1357,7 +1357,7 @@ var VideoEffectsEngine = (_class2 = class {
|
|
|
1357
1357
|
__init10() {this.generation = 0}
|
|
1358
1358
|
|
|
1359
1359
|
constructor(options = {}) {;_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);
|
|
1360
|
-
this.slot = _nullishCoalesce(options.slot, () => ( new (0,
|
|
1360
|
+
this.slot = _nullishCoalesce(options.slot, () => ( new (0, _chunkABQ2VGUBcjs.EffectsSlot)()));
|
|
1361
1361
|
this.maxEntries = _nullishCoalesce(options.maxEntries, () => ( 120));
|
|
1362
1362
|
this.toImage = _nullishCoalesce(options.toImage, () => ( defaultToImage));
|
|
1363
1363
|
this.pool = new (0, _chunkPY4GWSE2cjs.EffectRendererPool)({ maxRenderers: options.maxRenderers });
|
|
@@ -1499,7 +1499,7 @@ function checkVideoEffectPlace(d, place) {
|
|
|
1499
1499
|
if (d.kind === "motion" || !d.uses.some((u) => allowed.includes(u))) {
|
|
1500
1500
|
const where = place === "clip" ? "on a clip" : place === "transition" ? "as a transition" : "as an effect clip";
|
|
1501
1501
|
const instead = d.uses.includes("transition") ? "set_video_effect_transition" : d.uses.some((u) => VIDEO_EFFECT_PLACES.generator.includes(u)) ? "add_video_effect_clip" : d.uses.some((u) => u === "filter") ? "apply_effect" : null;
|
|
1502
|
-
throw new (0,
|
|
1502
|
+
throw new (0, _chunkABQ2VGUBcjs.EffectUnsupportedError)(
|
|
1503
1503
|
`"${d.id}" (${d.name}) is a ${d.uses.join(" / ")} effect and cannot be used ${where}, which takes ${allowed.join(" or ")} effects${instead ? `; use ${instead} instead` : ""}. search_effects with use "${allowed[0]}" lists ones that fit.`,
|
|
1504
1504
|
d.id
|
|
1505
1505
|
);
|
|
@@ -1520,12 +1520,12 @@ function checkVideoEffectValues(d, values, options = {}) {
|
|
|
1520
1520
|
else if (type !== "number" && type !== "integer") errors.push({ path: `/${k}`, message: "only number controls can be keyframed." });
|
|
1521
1521
|
else for (const [i, key] of v.keys.entries()) for (const e of _chunkWOFXZ3XUcjs.validateJsonSchema.call(void 0, key.v, schema)) errors.push({ path: `/${k}/keys/${i}/v`, message: e.message });
|
|
1522
1522
|
}
|
|
1523
|
-
for (const e of
|
|
1523
|
+
for (const e of _chunkABQ2VGUBcjs.effectValueErrors.call(void 0, d, plain)) {
|
|
1524
1524
|
const name = e.path.split("/")[1];
|
|
1525
1525
|
const about = name && _optionalChain([d, 'access', _46 => _46.controls, 'access', _47 => _47.properties, 'access', _48 => _48[name], 'optionalAccess', _49 => _49.description]);
|
|
1526
1526
|
errors.push(about ? { path: e.path, message: `${e.message} (${about})` } : e);
|
|
1527
1527
|
}
|
|
1528
|
-
if (errors.length) throw new (0,
|
|
1528
|
+
if (errors.length) throw new (0, _chunkABQ2VGUBcjs.EffectControlError)(d.id, errors);
|
|
1529
1529
|
return { ..._nullishCoalesce(options.base, () => ( d.defaults)), ..._nullishCoalesce(values, () => ( {})) };
|
|
1530
1530
|
}
|
|
1531
1531
|
|
|
@@ -74,7 +74,7 @@ function profileAlongPolyline(points, values, count = 32) {
|
|
|
74
74
|
var round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
75
75
|
var loading = null;
|
|
76
76
|
function loadCanvasBrushstrokeRenderer() {
|
|
77
|
-
loading ??= import("./brushstrokeRender-
|
|
77
|
+
loading ??= import("./brushstrokeRender-MAHOXL7K.js").catch((error) => {
|
|
78
78
|
loading = null;
|
|
79
79
|
throw error;
|
|
80
80
|
});
|
|
@@ -28,6 +28,58 @@ var _chunkPQ3H2AANcjs = require('./chunk-PQ3H2AAN.cjs');
|
|
|
28
28
|
|
|
29
29
|
var _chunk474IQG74cjs = require('./chunk-474IQG74.cjs');
|
|
30
30
|
|
|
31
|
+
// src/paint-editor/effect-paint.ts
|
|
32
|
+
function effectPaintKey(p) {
|
|
33
|
+
return JSON.stringify({ type: "effect", effect: p.effect, provider: p.provider, values: p.values, time: p.time });
|
|
34
|
+
}
|
|
35
|
+
function isPaintEffectPaint(raw) {
|
|
36
|
+
return Boolean(raw) && typeof raw === "object" && raw.type === "effect";
|
|
37
|
+
}
|
|
38
|
+
function readPaintEffectPaint(raw) {
|
|
39
|
+
if (!isPaintEffectPaint(raw)) return null;
|
|
40
|
+
const r = raw;
|
|
41
|
+
if (typeof r.effect !== "string" || !r.effect || !r.values || typeof r.values !== "object" || Array.isArray(r.values)) return null;
|
|
42
|
+
return {
|
|
43
|
+
type: "effect",
|
|
44
|
+
effect: r.effect,
|
|
45
|
+
provider: typeof r.provider === "string" ? r.provider : "",
|
|
46
|
+
values: JSON.parse(JSON.stringify(r.values)),
|
|
47
|
+
time: typeof r.time === "number" && Number.isFinite(r.time) && r.time > 0 ? r.time : 0
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function sampleEffectField(img, rect, vals, field) {
|
|
51
|
+
const { width, height, data } = img;
|
|
52
|
+
for (let yy = 0, k = 0; yy < rect.height; yy++) {
|
|
53
|
+
const y = rect.y + yy;
|
|
54
|
+
const inY = y >= 0 && y < height;
|
|
55
|
+
for (let xx = 0; xx < rect.width; xx++, k++) {
|
|
56
|
+
const x = rect.x + xx;
|
|
57
|
+
const f = k * 3;
|
|
58
|
+
if (!inY || x < 0 || x >= width) {
|
|
59
|
+
vals[k] = 0;
|
|
60
|
+
field[f] = field[f + 1] = field[f + 2] = 0;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const i = (y * width + x) * 4;
|
|
64
|
+
const a = data[i + 3];
|
|
65
|
+
if (a < 255) vals[k] *= a / 255;
|
|
66
|
+
field[f] = data[i] / 255;
|
|
67
|
+
field[f + 1] = data[i + 1] / 255;
|
|
68
|
+
field[f + 2] = data[i + 2] / 255;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function sampleEffectAt(img, x, y, out) {
|
|
73
|
+
const px = Math.floor(x);
|
|
74
|
+
const py = Math.floor(y);
|
|
75
|
+
if (px < 0 || py < 0 || px >= img.width || py >= img.height) return 0;
|
|
76
|
+
const i = (py * img.width + px) * 4;
|
|
77
|
+
out[0] = img.data[i] / 255;
|
|
78
|
+
out[1] = img.data[i + 1] / 255;
|
|
79
|
+
out[2] = img.data[i + 2] / 255;
|
|
80
|
+
return img.data[i + 3] / 255;
|
|
81
|
+
}
|
|
82
|
+
|
|
31
83
|
// src/paint-editor/paper.ts
|
|
32
84
|
var PAPER_FAMILIES = ["watercolor", "drawing", "pastel", "canvas", "panel", "smooth"];
|
|
33
85
|
var unit = (v, d) => typeof v === "number" && Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : d;
|
|
@@ -369,7 +421,7 @@ function lerpDegrees(a, b, t) {
|
|
|
369
421
|
return a + d * t;
|
|
370
422
|
}
|
|
371
423
|
var DryStroke = (_class3 = class {
|
|
372
|
-
constructor(brush, options) {;_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);
|
|
424
|
+
constructor(brush, options) {;_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);
|
|
373
425
|
this.brush = brush;
|
|
374
426
|
this.options = options;
|
|
375
427
|
this.smoother = new PenSmoother(brush.tip.smoothing, brush.pressureSmoothing);
|
|
@@ -386,8 +438,9 @@ var DryStroke = (_class3 = class {
|
|
|
386
438
|
|
|
387
439
|
|
|
388
440
|
__init14() {this.buf = new Float32Array(0)}
|
|
389
|
-
__init15() {this.
|
|
390
|
-
__init16() {this.
|
|
441
|
+
__init15() {this.field = new Float32Array(0)}
|
|
442
|
+
__init16() {this.lastRaw = null}
|
|
443
|
+
__init17() {this.lastFed = null}
|
|
391
444
|
/** Feeds raw pen samples; returns the document rectangles the new dabs touched. */
|
|
392
445
|
push(points) {
|
|
393
446
|
const dabs = [];
|
|
@@ -426,7 +479,13 @@ var DryStroke = (_class3 = class {
|
|
|
426
479
|
}
|
|
427
480
|
}
|
|
428
481
|
}
|
|
429
|
-
|
|
482
|
+
let field = null;
|
|
483
|
+
if (this.options.effect) {
|
|
484
|
+
if (this.field.length < n * 3) this.field = new Float32Array(n * 3);
|
|
485
|
+
field = this.field.subarray(0, n * 3);
|
|
486
|
+
sampleEffectField(this.options.effect, rect, vals, field);
|
|
487
|
+
}
|
|
488
|
+
this.coverage.accumulate(rect, vals, d.opacity, null, field);
|
|
430
489
|
rects.push(rect);
|
|
431
490
|
this.dabCount++;
|
|
432
491
|
}
|
|
@@ -559,7 +618,7 @@ function jitterColor(hex, amount, seed, i) {
|
|
|
559
618
|
return "#" + out.map((c) => Math.round(c * 255).toString(16).padStart(2, "0")).join("");
|
|
560
619
|
}
|
|
561
620
|
var StickerSpray = (_class4 = class {
|
|
562
|
-
constructor(init) {;_class4.prototype.
|
|
621
|
+
constructor(init) {;_class4.prototype.__init18.call(this);_class4.prototype.__init19.call(this);_class4.prototype.__init20.call(this);_class4.prototype.__init21.call(this);
|
|
563
622
|
this.init = init;
|
|
564
623
|
const b = init.brush;
|
|
565
624
|
this.smoother = new PenSmoother(b.tip.smoothing, b.pressureSmoothing);
|
|
@@ -571,14 +630,14 @@ var StickerSpray = (_class4 = class {
|
|
|
571
630
|
this.next = init.nextId;
|
|
572
631
|
}
|
|
573
632
|
|
|
574
|
-
|
|
575
|
-
|
|
633
|
+
__init18() {this.dabCount = 0}
|
|
634
|
+
__init19() {this.stickers = []}
|
|
576
635
|
|
|
577
636
|
|
|
578
637
|
|
|
579
638
|
|
|
580
|
-
|
|
581
|
-
|
|
639
|
+
__init20() {this.lastRaw = null}
|
|
640
|
+
__init21() {this.lastFed = null}
|
|
582
641
|
|
|
583
642
|
push(points) {
|
|
584
643
|
const rects = [];
|
|
@@ -698,7 +757,7 @@ function stickerSurface(stickers) {
|
|
|
698
757
|
// src/paint-editor/procedural.ts
|
|
699
758
|
var STEP_PX = 1.5;
|
|
700
759
|
var MarkStroke = (_class5 = class {
|
|
701
|
-
constructor(brush, options) {;_class5.prototype.
|
|
760
|
+
constructor(brush, options) {;_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);_class5.prototype.__init28.call(this);_class5.prototype.__init29.call(this);
|
|
702
761
|
this.brush = brush;
|
|
703
762
|
this.options = options;
|
|
704
763
|
this.sampler = options.paint ? new (0, _chunkPQ3H2AANcjs.PaintGradientSampler)(options.paint, _nullishCoalesce(options.seed, () => ( 0))) : null;
|
|
@@ -712,21 +771,22 @@ var MarkStroke = (_class5 = class {
|
|
|
712
771
|
}
|
|
713
772
|
|
|
714
773
|
|
|
715
|
-
|
|
716
|
-
|
|
774
|
+
__init22() {this.coverage = new (0, _chunkPQ3H2AANcjs.CoverageMap)()}
|
|
775
|
+
__init23() {this.dabCount = 0}
|
|
717
776
|
|
|
718
777
|
|
|
719
778
|
|
|
720
779
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
780
|
+
__init24() {this.buf = new Float32Array(0)}
|
|
781
|
+
__init25() {this.field = new Float32Array(0)}
|
|
782
|
+
__init26() {this.lastRaw = null}
|
|
783
|
+
__init27() {this.lastFed = null}
|
|
724
784
|
|
|
725
785
|
|
|
726
786
|
|
|
727
787
|
/** The pen dab the marks being made belong to, and its gradient colour. */
|
|
728
|
-
|
|
729
|
-
|
|
788
|
+
__init28() {this.pen = null}
|
|
789
|
+
__init29() {this.penColor = { rgb: [0, 0, 0], alpha: 1 }}
|
|
730
790
|
push(points) {
|
|
731
791
|
const rects = [];
|
|
732
792
|
for (const raw of points) {
|
|
@@ -785,9 +845,16 @@ var MarkStroke = (_class5 = class {
|
|
|
785
845
|
for (let yy = 0, k = 0; yy < rect.height; yy++)
|
|
786
846
|
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
847
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
848
|
+
if (this.options.effect) {
|
|
849
|
+
if (this.field.length < n * 3) this.field = new Float32Array(n * 3);
|
|
850
|
+
const field = this.field.subarray(0, n * 3);
|
|
851
|
+
sampleEffectField(this.options.effect, rect, vals, field);
|
|
852
|
+
this.coverage.accumulate(rect, vals, dab.opacity, null, field);
|
|
853
|
+
} else {
|
|
854
|
+
const color = this.markColor(x, y);
|
|
855
|
+
if (color && color.alpha < 1) for (let k = 0; k < n; k++) vals[k] *= color.alpha;
|
|
856
|
+
this.coverage.accumulate(rect, vals, dab.opacity, color ? color.rgb : null);
|
|
857
|
+
}
|
|
791
858
|
rects.push(rect);
|
|
792
859
|
this.dabCount++;
|
|
793
860
|
}
|
|
@@ -839,9 +906,9 @@ function curl(x, y, seed) {
|
|
|
839
906
|
var ParticleStroke = (_class6 = class extends MarkStroke {
|
|
840
907
|
|
|
841
908
|
|
|
842
|
-
|
|
909
|
+
__init30() {this.spawn = 0}
|
|
843
910
|
constructor(brush, options) {
|
|
844
|
-
super(brush, options);_class6.prototype.
|
|
911
|
+
super(brush, options);_class6.prototype.__init30.call(this);;
|
|
845
912
|
this.s = brush.particle;
|
|
846
913
|
this.sets = this.copies.map(() => []);
|
|
847
914
|
}
|
|
@@ -1845,4 +1912,9 @@ function parseBrushLibrary(raw, problems = []) {
|
|
|
1845
1912
|
|
|
1846
1913
|
|
|
1847
1914
|
|
|
1848
|
-
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
exports.effectPaintKey = effectPaintKey; exports.isPaintEffectPaint = isPaintEffectPaint; exports.readPaintEffectPaint = readPaintEffectPaint; exports.sampleEffectField = sampleEffectField; exports.sampleEffectAt = sampleEffectAt; 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.STAMP_KINDS = STAMP_KINDS; exports.DEFAULT_STICKER = DEFAULT_STICKER; exports.normalizeStickerSettings = normalizeStickerSettings; exports.stampCoverage = stampCoverage; exports.stickerRect = stickerRect; exports.drawSticker = drawSticker; exports.StickerSpray = StickerSpray; exports.renderStickers = renderStickers; exports.normalizeStickerUpdate = normalizeStickerUpdate; exports.stickerSurface = stickerSurface; exports.PARTICLE_KINDS = PARTICLE_KINDS; exports.PARTICLE_RENDERS = PARTICLE_RENDERS; exports.DEFAULT_PARTICLE = DEFAULT_PARTICLE; exports.normalizeParticle = normalizeParticle; 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.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;
|