@pixerate/editor 0.108.0 → 0.110.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/index.cjs +5 -5
- package/dist/animation/index.cjs.map +1 -1
- package/dist/animation/index.js +9 -9
- package/dist/animation-editor/index.cjs +59 -59
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +2 -1
- package/dist/animation-editor/index.d.ts +2 -1
- package/dist/animation-editor/index.js +29 -29
- package/dist/blending-DXl06NSx.d.ts +486 -0
- package/dist/blending-aOE6Y3UE.d.cts +486 -0
- package/dist/canvas/index.cjs +27 -27
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.js +11 -11
- package/dist/{chunk-2FGRTYJN.cjs → chunk-477UVMNR.cjs} +3 -3
- package/dist/{chunk-2FGRTYJN.cjs.map → chunk-477UVMNR.cjs.map} +1 -1
- package/dist/chunk-7VOHOPLW.cjs +1136 -0
- package/dist/chunk-7VOHOPLW.cjs.map +1 -0
- package/dist/{chunk-HUQ7EHVI.js → chunk-BLWCAQCW.js} +723 -1975
- package/dist/chunk-BLWCAQCW.js.map +1 -0
- package/dist/{chunk-SOROZ2BF.js → chunk-DMRSJBJF.js} +1939 -318
- package/dist/chunk-DMRSJBJF.js.map +1 -0
- package/dist/chunk-FTBZPI77.cjs +1 -0
- package/dist/chunk-FTBZPI77.cjs.map +1 -0
- package/dist/{chunk-WMBIJCHA.js → chunk-HNS7UHCM.js} +5 -1
- package/dist/{chunk-WMBIJCHA.js.map → chunk-HNS7UHCM.js.map} +1 -1
- package/dist/chunk-JLYX4V57.cjs +2001 -0
- package/dist/chunk-JLYX4V57.cjs.map +1 -0
- package/dist/chunk-KB2YBCVS.js +2001 -0
- package/dist/chunk-KB2YBCVS.js.map +1 -0
- package/dist/{chunk-G4BIYE6R.js → chunk-LQEEDHOP.js} +40 -2
- package/dist/chunk-LQEEDHOP.js.map +1 -0
- package/dist/{chunk-FRD3FUXI.cjs → chunk-MGL4U5WA.cjs} +2144 -523
- package/dist/chunk-MGL4U5WA.cjs.map +1 -0
- package/dist/{chunk-T3QZ6S47.cjs → chunk-POGBUYWE.cjs} +131 -93
- package/dist/chunk-POGBUYWE.cjs.map +1 -0
- package/dist/chunk-VKK5VS2T.js +1 -0
- package/dist/{chunk-UTEVPQTS.cjs → chunk-W3GXSUSQ.cjs} +746 -1998
- package/dist/chunk-W3GXSUSQ.cjs.map +1 -0
- package/dist/{chunk-SZ6KMZNM.cjs → chunk-XIOMMGPD.cjs} +6 -2
- package/dist/chunk-XIOMMGPD.cjs.map +1 -0
- package/dist/{chunk-JK6M6V7G.js → chunk-Z3YWVUWT.js} +4 -4
- package/dist/{chunk-3PHA3UKI.js → chunk-Z4BC6M74.js} +523 -121
- package/dist/chunk-Z4BC6M74.js.map +1 -0
- package/dist/{export-a9bnF7Cl.d.ts → export-CO2ryu3I.d.ts} +419 -18
- package/dist/{export-JGWQEPJn.d.cts → export-DRiLzP_j.d.cts} +419 -18
- package/dist/image-editor/index.cjs +1665 -1113
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +78 -14
- package/dist/image-editor/index.d.ts +78 -14
- package/dist/image-editor/index.js +843 -291
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +28 -4
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +3 -89
- package/dist/paint/index.d.ts +3 -89
- package/dist/paint/index.js +27 -3
- package/dist/paint-editor/index.cjs +1056 -287
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +304 -22
- package/dist/paint-editor/index.d.ts +304 -22
- package/dist/paint-editor/index.js +852 -83
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +7 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +3 -129
- package/dist/raster/index.d.ts +3 -129
- package/dist/raster/index.js +6 -2
- package/dist/{compositor-D92URMlm.d.cts → render-BEriFuqK.d.cts} +136 -2
- package/dist/{compositor-Kt_M4ruo.d.ts → render-tjzKaik-.d.ts} +136 -2
- package/dist/{surface-CkKOHGPm.d.cts → surface-C8RRg_Bh.d.cts} +109 -1
- package/dist/{surface-CkKOHGPm.d.ts → surface-C8RRg_Bh.d.ts} +109 -1
- package/dist/{svg-SseJTIrA.d.ts → svg-D_cfkhlB.d.cts} +3 -629
- package/dist/{svg-ClVIG4T7.d.cts → svg-wIaKLrU0.d.ts} +3 -629
- package/dist/types-DtL_qLFz.d.ts +630 -0
- package/dist/types-DyQq-WPY.d.cts +630 -0
- package/dist/vector/index.cjs +563 -563
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +4 -2
- package/dist/vector/index.d.ts +4 -2
- package/dist/vector/index.js +69 -69
- package/dist/video-editor/index.cjs +3 -3
- package/dist/video-editor/index.js +2 -2
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +49 -13
- package/dist/chunk-3PHA3UKI.js.map +0 -1
- package/dist/chunk-6BU5WU4R.cjs +0 -1
- package/dist/chunk-6BU5WU4R.cjs.map +0 -1
- package/dist/chunk-DWGZUSES.cjs +0 -694
- package/dist/chunk-DWGZUSES.cjs.map +0 -1
- package/dist/chunk-FRD3FUXI.cjs.map +0 -1
- package/dist/chunk-G4BIYE6R.js.map +0 -1
- package/dist/chunk-HUFQD4CB.cjs +0 -734
- package/dist/chunk-HUFQD4CB.cjs.map +0 -1
- package/dist/chunk-HUQ7EHVI.js.map +0 -1
- package/dist/chunk-KKREERP2.js +0 -694
- package/dist/chunk-KKREERP2.js.map +0 -1
- package/dist/chunk-SOROZ2BF.js.map +0 -1
- package/dist/chunk-SZ6KMZNM.cjs.map +0 -1
- package/dist/chunk-T3QZ6S47.cjs.map +0 -1
- package/dist/chunk-UTEVPQTS.cjs.map +0 -1
- package/dist/chunk-XYBJKUAU.js +0 -1
- package/dist/mixer-5ziHU8OS.d.cts +0 -282
- package/dist/mixer-DNqiYXYQ.d.ts +0 -282
- /package/dist/{chunk-XYBJKUAU.js.map → chunk-VKK5VS2T.js.map} +0 -0
- /package/dist/{chunk-JK6M6V7G.js.map → chunk-Z3YWVUWT.js.map} +0 -0
|
@@ -26,7 +26,7 @@ var _chunkMUUXNRU4cjs = require('./chunk-MUUXNRU4.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkXIOMMGPDcjs = require('./chunk-XIOMMGPD.cjs');
|
|
30
30
|
|
|
31
31
|
// src/raster/blur.ts
|
|
32
32
|
function gaussianKernel(sigma) {
|
|
@@ -387,7 +387,7 @@ function oneOf(r, key, path, values) {
|
|
|
387
387
|
if (typeof r[key] !== "string" || !values.includes(r[key])) fail(`${path}.${key}`, `must be one of ${values.join(", ")}.`);
|
|
388
388
|
}
|
|
389
389
|
function blend(r, key, path) {
|
|
390
|
-
if (!
|
|
390
|
+
if (!_chunkXIOMMGPDcjs.isBlendMode.call(void 0, r[key])) fail(`${path}.${key}`, `must be a blend mode such as normal, multiply or screen (got ${JSON.stringify(r[key])}).`);
|
|
391
391
|
if (r[key] === "pigment") fail(`${path}.${key}`, "pigment is a layer blend mode only; effects cannot use it.");
|
|
392
392
|
}
|
|
393
393
|
function contour(v, path) {
|
|
@@ -1586,7 +1586,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1586
1586
|
rgbScratchS[0] = sr;
|
|
1587
1587
|
rgbScratchS[1] = sg;
|
|
1588
1588
|
rgbScratchS[2] = sb;
|
|
1589
|
-
|
|
1589
|
+
_chunkXIOMMGPDcjs.mixPigmentRgb.call(void 0, rgbScratchB, rgbScratchS, sa / ao, rgbScratchM);
|
|
1590
1590
|
dst[i] = rgbScratchM[0];
|
|
1591
1591
|
dst[i + 1] = rgbScratchM[1];
|
|
1592
1592
|
dst[i + 2] = rgbScratchM[2];
|
|
@@ -1601,9 +1601,9 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1601
1601
|
m1 = sg;
|
|
1602
1602
|
m2 = sb;
|
|
1603
1603
|
} else if (separable) {
|
|
1604
|
-
m0 =
|
|
1605
|
-
m1 =
|
|
1606
|
-
m2 =
|
|
1604
|
+
m0 = _chunkXIOMMGPDcjs.blendChannel.call(void 0, mode, b0, sr);
|
|
1605
|
+
m1 = _chunkXIOMMGPDcjs.blendChannel.call(void 0, mode, b1, sg);
|
|
1606
|
+
m2 = _chunkXIOMMGPDcjs.blendChannel.call(void 0, mode, b2, sb);
|
|
1607
1607
|
} else {
|
|
1608
1608
|
rgbScratchB[0] = b0;
|
|
1609
1609
|
rgbScratchB[1] = b1;
|
|
@@ -1611,7 +1611,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1611
1611
|
rgbScratchS[0] = sr;
|
|
1612
1612
|
rgbScratchS[1] = sg;
|
|
1613
1613
|
rgbScratchS[2] = sb;
|
|
1614
|
-
const m =
|
|
1614
|
+
const m = _chunkXIOMMGPDcjs.blendRgb.call(void 0, mode, rgbScratchB, rgbScratchS);
|
|
1615
1615
|
m0 = m[0];
|
|
1616
1616
|
m1 = m[1];
|
|
1617
1617
|
m2 = m[2];
|
|
@@ -1625,7 +1625,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1625
1625
|
dst[i + 3] = ao;
|
|
1626
1626
|
}
|
|
1627
1627
|
function paint(dst, m, color2, mode, opacity) {
|
|
1628
|
-
const sep = mode !== "normal" &&
|
|
1628
|
+
const sep = mode !== "normal" && _chunkXIOMMGPDcjs.isSeparableBlendMode.call(void 0, mode);
|
|
1629
1629
|
const c = [0, 0, 0, 1];
|
|
1630
1630
|
const n = m.length;
|
|
1631
1631
|
for (let i = 0; i < n; i++) {
|
|
@@ -1809,6 +1809,43 @@ function paintFill(dst, m, f, frame, env, mode, opacity) {
|
|
|
1809
1809
|
else if (f.type === "gradient") paintGradient(dst, m, f.gradient, f.gradient.align ? frame : env.canvas, env, mode, opacity);
|
|
1810
1810
|
else paintPattern(dst, m, f, env, mode, opacity);
|
|
1811
1811
|
}
|
|
1812
|
+
function effectFillColors(fill2, rect, frame, canvas, anchor, ctx) {
|
|
1813
|
+
const n = rect.width * rect.height;
|
|
1814
|
+
const out = new Float32Array(n * 4);
|
|
1815
|
+
const c = [0, 0, 0, 1];
|
|
1816
|
+
const { x: rx, y: ry, width: w } = rect;
|
|
1817
|
+
if (fill2.type === "color") {
|
|
1818
|
+
const [r, g, b] = rgbOf(fill2.color);
|
|
1819
|
+
for (let i = 0; i < n * 4; i += 4) {
|
|
1820
|
+
out[i] = r;
|
|
1821
|
+
out[i + 1] = g;
|
|
1822
|
+
out[i + 2] = b;
|
|
1823
|
+
out[i + 3] = 1;
|
|
1824
|
+
}
|
|
1825
|
+
return out;
|
|
1826
|
+
}
|
|
1827
|
+
if (fill2.type === "gradient") {
|
|
1828
|
+
const gr = fill2.gradient;
|
|
1829
|
+
const f = gr.align ? frame : canvas;
|
|
1830
|
+
const prepared = new PreparedGradient(gr);
|
|
1831
|
+
const [angle, scale, offset] = gradientLayout(gr.style, gr.angle, gr.scale, gr.offset, f);
|
|
1832
|
+
for (let i = 0; i < n; i++) {
|
|
1833
|
+
prepared.sample(gradientT(gr.style, angle, scale, gr.reverse, offset, f, rx + i % w + 0.5, ry + Math.floor(i / w) + 0.5), c);
|
|
1834
|
+
out.set(c, i * 4);
|
|
1835
|
+
}
|
|
1836
|
+
return out;
|
|
1837
|
+
}
|
|
1838
|
+
const tile = ctx.pattern(fill2.patternId);
|
|
1839
|
+
if (!tile) return out;
|
|
1840
|
+
const place = new PatternPlacement(anchor, _nullishCoalesce(fill2.link, () => ( true)), _nullishCoalesce(fill2.phase, () => ( { x: 0, y: 0 })), fill2.scale, _nullishCoalesce(fill2.angle, () => ( 0)));
|
|
1841
|
+
const uv = [0, 0];
|
|
1842
|
+
for (let i = 0; i < n; i++) {
|
|
1843
|
+
place.map(rx + i % w + 0.5, ry + Math.floor(i / w) + 0.5, uv);
|
|
1844
|
+
tile.sample(uv[0], uv[1], c);
|
|
1845
|
+
out.set(c, i * 4);
|
|
1846
|
+
}
|
|
1847
|
+
return out;
|
|
1848
|
+
}
|
|
1812
1849
|
function paintGlow(dst, m, g, env) {
|
|
1813
1850
|
if (g.fill.type === "color") return paintColor(dst, m, g.fill.color, g.blend, g.opacity);
|
|
1814
1851
|
const prepared = new PreparedGradient(g.fill.gradient);
|
|
@@ -1877,7 +1914,7 @@ function compositeLayerEffects(input) {
|
|
|
1877
1914
|
}
|
|
1878
1915
|
const premerge = !normalLike;
|
|
1879
1916
|
if (premerge) {
|
|
1880
|
-
const sep2 =
|
|
1917
|
+
const sep2 = _chunkXIOMMGPDcjs.isSeparableBlendMode.call(void 0, input.blend);
|
|
1881
1918
|
for (let i = 0; i < n; i++) {
|
|
1882
1919
|
const p = i * 4;
|
|
1883
1920
|
const sr = lay[p];
|
|
@@ -1997,7 +2034,7 @@ function compositeLayerEffects(input) {
|
|
|
1997
2034
|
paintColor(work, fx(i, 1), e.shadowColor, e.shadowBlend, e.shadowOpacity);
|
|
1998
2035
|
}
|
|
1999
2036
|
const mode = premerge ? "normal" : input.blend;
|
|
2000
|
-
const sep =
|
|
2037
|
+
const sep = _chunkXIOMMGPDcjs.isSeparableBlendMode.call(void 0, mode);
|
|
2001
2038
|
for (let i = 0; i < n; i++) {
|
|
2002
2039
|
const p = i * 4;
|
|
2003
2040
|
if (lay[p + 3] > 0) compositeAt(work, p, mode, sep, lay[p], lay[p + 1], lay[p + 2], lay[p + 3]);
|
|
@@ -2042,7 +2079,7 @@ function renderLayerEffects(effects, layer, backdrop, canvas, ctx) {
|
|
|
2042
2079
|
}
|
|
2043
2080
|
|
|
2044
2081
|
// src/raster/compositor.ts
|
|
2045
|
-
var TILE_PIXELS =
|
|
2082
|
+
var TILE_PIXELS = _chunkXIOMMGPDcjs.TILE * _chunkXIOMMGPDcjs.TILE;
|
|
2046
2083
|
var TILE_BYTES = TILE_PIXELS * 4;
|
|
2047
2084
|
function sameSig(a, b) {
|
|
2048
2085
|
if (!a || a.key !== b.key || a.refs.length !== b.refs.length) return false;
|
|
@@ -2054,13 +2091,13 @@ function dirtyInTile(rects, tx, ty) {
|
|
|
2054
2091
|
let y0 = Infinity;
|
|
2055
2092
|
let x1 = -Infinity;
|
|
2056
2093
|
let y1 = -Infinity;
|
|
2057
|
-
const ox = tx *
|
|
2058
|
-
const oy = ty *
|
|
2094
|
+
const ox = tx * _chunkXIOMMGPDcjs.TILE;
|
|
2095
|
+
const oy = ty * _chunkXIOMMGPDcjs.TILE;
|
|
2059
2096
|
for (const r of rects) {
|
|
2060
2097
|
const a = Math.max(ox, Math.floor(r.x));
|
|
2061
2098
|
const b = Math.max(oy, Math.floor(r.y));
|
|
2062
|
-
const c = Math.min(ox +
|
|
2063
|
-
const d = Math.min(oy +
|
|
2099
|
+
const c = Math.min(ox + _chunkXIOMMGPDcjs.TILE, Math.ceil(r.x + r.width));
|
|
2100
|
+
const d = Math.min(oy + _chunkXIOMMGPDcjs.TILE, Math.ceil(r.y + r.height));
|
|
2064
2101
|
if (c <= a || d <= b) continue;
|
|
2065
2102
|
x0 = Math.min(x0, a);
|
|
2066
2103
|
y0 = Math.min(y0, b);
|
|
@@ -2073,7 +2110,7 @@ function blendTile(dst, src, mode, alpha, coverage) {
|
|
|
2073
2110
|
if (!(alpha > 0)) return;
|
|
2074
2111
|
const normal = mode === "normal";
|
|
2075
2112
|
const pigment = mode === "pigment";
|
|
2076
|
-
const lut = !normal &&
|
|
2113
|
+
const lut = !normal && _chunkXIOMMGPDcjs.isSeparableBlendMode.call(void 0, mode) ? separableLut(mode) : null;
|
|
2077
2114
|
const cb = [0, 0, 0];
|
|
2078
2115
|
const cs = [0, 0, 0];
|
|
2079
2116
|
const n = dst.length;
|
|
@@ -2100,7 +2137,7 @@ function blendTile(dst, src, mode, alpha, coverage) {
|
|
|
2100
2137
|
const d1 = dst[i + 1];
|
|
2101
2138
|
const d2 = dst[i + 2];
|
|
2102
2139
|
if (pigment) {
|
|
2103
|
-
|
|
2140
|
+
_chunkXIOMMGPDcjs.mixPigment8.call(void 0, d0, d1, d2, src[i], src[i + 1], src[i + 2], as / ao, cb);
|
|
2104
2141
|
dst[i] = Math.round(cb[0] * 255);
|
|
2105
2142
|
dst[i + 1] = Math.round(cb[1] * 255);
|
|
2106
2143
|
dst[i + 2] = Math.round(cb[2] * 255);
|
|
@@ -2131,7 +2168,7 @@ function blendTile(dst, src, mode, alpha, coverage) {
|
|
|
2131
2168
|
cs[0] = s0;
|
|
2132
2169
|
cs[1] = s1;
|
|
2133
2170
|
cs[2] = s2;
|
|
2134
|
-
const m =
|
|
2171
|
+
const m = _chunkXIOMMGPDcjs.blendRgb.call(void 0, mode, cb, cs);
|
|
2135
2172
|
m0 = m[0];
|
|
2136
2173
|
m1 = m[1];
|
|
2137
2174
|
m2 = m[2];
|
|
@@ -2150,7 +2187,7 @@ function separableLut(mode) {
|
|
|
2150
2187
|
let lut = separableLuts.get(mode);
|
|
2151
2188
|
if (!lut) {
|
|
2152
2189
|
lut = new Float64Array(65536);
|
|
2153
|
-
for (let b = 0; b < 256; b++) for (let c = 0; c < 256; c++) lut[b << 8 | c] =
|
|
2190
|
+
for (let b = 0; b < 256; b++) for (let c = 0; c < 256; c++) lut[b << 8 | c] = _chunkXIOMMGPDcjs.blendChannel.call(void 0, mode, b / 255, c / 255);
|
|
2154
2191
|
separableLuts.set(mode, lut);
|
|
2155
2192
|
}
|
|
2156
2193
|
return lut;
|
|
@@ -2224,15 +2261,15 @@ var RasterCompositor = (_class = class {
|
|
|
2224
2261
|
composite(layers, rect, sources, options = {}) {
|
|
2225
2262
|
const out = new Uint8ClampedArray(Math.max(0, rect.width * rect.height * 4));
|
|
2226
2263
|
this.compositeTiles(layers, rect, sources, (tx, ty, data) => {
|
|
2227
|
-
const ox = tx *
|
|
2228
|
-
const oy = ty *
|
|
2264
|
+
const ox = tx * _chunkXIOMMGPDcjs.TILE;
|
|
2265
|
+
const oy = ty * _chunkXIOMMGPDcjs.TILE;
|
|
2229
2266
|
const x0 = Math.max(rect.x, ox);
|
|
2230
2267
|
const y0 = Math.max(rect.y, oy);
|
|
2231
|
-
const x1 = Math.min(rect.x + rect.width, ox +
|
|
2232
|
-
const y1 = Math.min(rect.y + rect.height, oy +
|
|
2268
|
+
const x1 = Math.min(rect.x + rect.width, ox + _chunkXIOMMGPDcjs.TILE);
|
|
2269
|
+
const y1 = Math.min(rect.y + rect.height, oy + _chunkXIOMMGPDcjs.TILE);
|
|
2233
2270
|
const span = (x1 - x0) * 4;
|
|
2234
2271
|
for (let y = y0; y < y1; y++) {
|
|
2235
|
-
const s = ((y - oy) *
|
|
2272
|
+
const s = ((y - oy) * _chunkXIOMMGPDcjs.TILE + (x0 - ox)) * 4;
|
|
2236
2273
|
out.set(data.subarray(s, s + span), ((y - rect.y) * rect.width + (x0 - rect.x)) * 4);
|
|
2237
2274
|
}
|
|
2238
2275
|
}, options);
|
|
@@ -2253,9 +2290,9 @@ var RasterCompositor = (_class = class {
|
|
|
2253
2290
|
this.callStats = stats;
|
|
2254
2291
|
const grow = options.dirty ? this.effectsReach(layers) : 0;
|
|
2255
2292
|
const dirty = grow > 0 ? options.dirty.map((d) => inflateRect(d, grow)) : options.dirty;
|
|
2256
|
-
for (const { tx, ty } of
|
|
2293
|
+
for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, rect)) {
|
|
2257
2294
|
stats.tiles++;
|
|
2258
|
-
const before = _optionalChain([this, 'access', _6 => _6.tiles, 'access', _7 => _7.get, 'call', _8 => _8(
|
|
2295
|
+
const before = _optionalChain([this, 'access', _6 => _6.tiles, 'access', _7 => _7.get, 'call', _8 => _8(_chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _9 => _9.result]);
|
|
2259
2296
|
const data = this.compositeTile(layers, steps, tx, ty, stats, dirty ? dirtyInTile(dirty, tx, ty) : null);
|
|
2260
2297
|
onTile(tx, ty, data, data !== before);
|
|
2261
2298
|
}
|
|
@@ -2337,7 +2374,7 @@ var RasterCompositor = (_class = class {
|
|
|
2337
2374
|
return key;
|
|
2338
2375
|
}
|
|
2339
2376
|
compositeTile(root, steps, tx, ty, stats, dirty = null) {
|
|
2340
|
-
const key =
|
|
2377
|
+
const key = _chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty);
|
|
2341
2378
|
const entry = this.tiles.get(key);
|
|
2342
2379
|
const sigs = steps.map((s) => this.stepSig(s, tx, ty));
|
|
2343
2380
|
let first = 0;
|
|
@@ -2360,20 +2397,20 @@ var RasterCompositor = (_class = class {
|
|
|
2360
2397
|
}
|
|
2361
2398
|
}
|
|
2362
2399
|
}
|
|
2363
|
-
const tileRect = { x: tx *
|
|
2400
|
+
const tileRect = { x: tx * _chunkXIOMMGPDcjs.TILE, y: ty * _chunkXIOMMGPDcjs.TILE, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE };
|
|
2364
2401
|
const hint = this.hint;
|
|
2365
2402
|
const checkpoints = /* @__PURE__ */ new Map();
|
|
2366
2403
|
if (entry) {
|
|
2367
2404
|
for (const [index, cp] of entry.checkpoints) if (index <= start) checkpoints.set(index, cp);
|
|
2368
2405
|
}
|
|
2369
2406
|
let result;
|
|
2370
|
-
if (entry && dirty && (dirty.width <
|
|
2407
|
+
if (entry && dirty && (dirty.width < _chunkXIOMMGPDcjs.TILE || dirty.height < _chunkXIOMMGPDcjs.TILE)) {
|
|
2371
2408
|
const r = dirty;
|
|
2372
2409
|
const sub = (data) => {
|
|
2373
2410
|
const out = new Uint8ClampedArray(r.width * r.height * 4);
|
|
2374
2411
|
if (!data) return out;
|
|
2375
2412
|
for (let y = 0; y < r.height; y++) {
|
|
2376
|
-
const s = ((r.y - tileRect.y + y) *
|
|
2413
|
+
const s = ((r.y - tileRect.y + y) * _chunkXIOMMGPDcjs.TILE + (r.x - tileRect.x)) * 4;
|
|
2377
2414
|
out.set(data.subarray(s, s + r.width * 4), y * r.width * 4);
|
|
2378
2415
|
}
|
|
2379
2416
|
return out;
|
|
@@ -2386,7 +2423,7 @@ var RasterCompositor = (_class = class {
|
|
|
2386
2423
|
}
|
|
2387
2424
|
result = new Uint8ClampedArray(entry.result);
|
|
2388
2425
|
for (let y = 0; y < r.height; y++) {
|
|
2389
|
-
result.set(acc.subarray(y * r.width * 4, (y + 1) * r.width * 4), ((r.y - tileRect.y + y) *
|
|
2426
|
+
result.set(acc.subarray(y * r.width * 4, (y + 1) * r.width * 4), ((r.y - tileRect.y + y) * _chunkXIOMMGPDcjs.TILE + (r.x - tileRect.x)) * 4);
|
|
2390
2427
|
}
|
|
2391
2428
|
} else {
|
|
2392
2429
|
const acc = base ? new Uint8ClampedArray(base.data) : new Uint8ClampedArray(TILE_BYTES);
|
|
@@ -2495,8 +2532,8 @@ var RasterCompositor = (_class = class {
|
|
|
2495
2532
|
if (!this.isPixel(layer)) return { key, refs: this.maskRefs(layer, tx, ty, 0, 0) };
|
|
2496
2533
|
const { surface, dx, dy } = this.layerPixels(layer);
|
|
2497
2534
|
const refs = [surface.defaultValue];
|
|
2498
|
-
const r = { x: tx *
|
|
2499
|
-
for (const t of
|
|
2535
|
+
const r = { x: tx * _chunkXIOMMGPDcjs.TILE - dx, y: ty * _chunkXIOMMGPDcjs.TILE - dy, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE };
|
|
2536
|
+
for (const t of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, r)) refs.push(_nullishCoalesce(surface.getTile(t.tx, t.ty), () => ( null)));
|
|
2500
2537
|
refs.push(...this.maskRefs(layer, tx, ty, _nullishCoalesce(_optionalChain([layer, 'access', _23 => _23.offset, 'optionalAccess', _24 => _24.x]), () => ( 0)), _nullishCoalesce(_optionalChain([layer, 'access', _25 => _25.offset, 'optionalAccess', _26 => _26.y]), () => ( 0))));
|
|
2501
2538
|
return { key, refs };
|
|
2502
2539
|
}
|
|
@@ -2558,8 +2595,8 @@ var RasterCompositor = (_class = class {
|
|
|
2558
2595
|
const sigs = /* @__PURE__ */ new Map();
|
|
2559
2596
|
if (region.width <= 0 || region.height <= 0) return sigs;
|
|
2560
2597
|
const steps = isGroup(layer) ? this.buildSteps(_nullishCoalesce(layer.children, () => ( []))) : null;
|
|
2561
|
-
for (const t of
|
|
2562
|
-
sigs.set(
|
|
2598
|
+
for (const t of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, region)) {
|
|
2599
|
+
sigs.set(_chunkXIOMMGPDcjs.tileKey.call(void 0, t.tx, t.ty), steps ? this.plainGroupSig(layer, steps, t.tx, t.ty) : this.plainContentSig(layer, t.tx, t.ty));
|
|
2563
2600
|
}
|
|
2564
2601
|
return sigs;
|
|
2565
2602
|
}
|
|
@@ -2583,7 +2620,7 @@ var RasterCompositor = (_class = class {
|
|
|
2583
2620
|
const region = this.effectRegion(layer);
|
|
2584
2621
|
const m = effectsMargin(layer.effects);
|
|
2585
2622
|
if (effectsAreLocal(activeEffectItems(layer.effects))) {
|
|
2586
|
-
return { key, refs: this.shapeRefs(layer, intersectRect({ x: tx *
|
|
2623
|
+
return { key, refs: this.shapeRefs(layer, intersectRect({ x: tx * _chunkXIOMMGPDcjs.TILE - m, y: ty * _chunkXIOMMGPDcjs.TILE - m, width: _chunkXIOMMGPDcjs.TILE + 2 * m, height: _chunkXIOMMGPDcjs.TILE + 2 * m }, region)) };
|
|
2587
2624
|
}
|
|
2588
2625
|
return { key, refs: [`${region.x},${region.y},${region.width},${region.height}`, ...this.shapeRefs(layer, region)] };
|
|
2589
2626
|
}
|
|
@@ -2632,11 +2669,11 @@ var RasterCompositor = (_class = class {
|
|
|
2632
2669
|
*/
|
|
2633
2670
|
shapeChanges(layer, prev, tiles, region) {
|
|
2634
2671
|
const out = [];
|
|
2635
|
-
for (const { tx, ty } of
|
|
2636
|
-
const sig = tiles.get(
|
|
2637
|
-
const old = prev.tiles.get(
|
|
2672
|
+
for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, region)) {
|
|
2673
|
+
const sig = tiles.get(_chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty));
|
|
2674
|
+
const old = prev.tiles.get(_chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty));
|
|
2638
2675
|
if (old ? sameSig(old, sig) : sig.refs.every((r2) => r2 === null || r2 === 0)) continue;
|
|
2639
|
-
const r = intersectRect({ x: tx *
|
|
2676
|
+
const r = intersectRect({ x: tx * _chunkXIOMMGPDcjs.TILE, y: ty * _chunkXIOMMGPDcjs.TILE, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE }, region);
|
|
2640
2677
|
if (r.width > 0 && r.height > 0) out.push(r);
|
|
2641
2678
|
}
|
|
2642
2679
|
const dirty = this.callDirty;
|
|
@@ -2731,7 +2768,7 @@ var RasterCompositor = (_class = class {
|
|
|
2731
2768
|
if (!mask || mask.enabled === false) return [];
|
|
2732
2769
|
if (mask.source || (_nullishCoalesce(mask.feather, () => ( 0))) > 0) return [this.planeFor(mask, ox, oy)];
|
|
2733
2770
|
const refs = [];
|
|
2734
|
-
for (const t of
|
|
2771
|
+
for (const t of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, { x: tx * _chunkXIOMMGPDcjs.TILE - ox, y: ty * _chunkXIOMMGPDcjs.TILE - oy, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE })) {
|
|
2735
2772
|
refs.push(_nullishCoalesce(mask.surface.getTile(t.tx, t.ty), () => ( null)));
|
|
2736
2773
|
}
|
|
2737
2774
|
return refs;
|
|
@@ -2766,12 +2803,12 @@ var RasterCompositor = (_class = class {
|
|
|
2766
2803
|
if (!this.isPixel(layer)) return _nullishCoalesce(_optionalChain([this, 'access', _40 => _40.profile, 'access', _41 => _41.contentTile, 'optionalCall', _42 => _42(layer, r, this.sources)]), () => ( null));
|
|
2767
2804
|
const { surface, dx, dy, perPixel } = this.layerPixels(layer);
|
|
2768
2805
|
const src = { x: r.x - dx, y: r.y - dy, width: r.width, height: r.height };
|
|
2769
|
-
const covered =
|
|
2806
|
+
const covered = _chunkXIOMMGPDcjs.tilesInRect.call(void 0, src).map((t) => surface.getTile(t.tx, t.ty));
|
|
2770
2807
|
if (surface.defaultValue === 0 && covered.every((t) => !t)) return null;
|
|
2771
|
-
const aligned = r.width ===
|
|
2808
|
+
const aligned = r.width === _chunkXIOMMGPDcjs.TILE && r.height === _chunkXIOMMGPDcjs.TILE && src.x % _chunkXIOMMGPDcjs.TILE === 0 && src.y % _chunkXIOMMGPDcjs.TILE === 0;
|
|
2772
2809
|
if (!perPixel) {
|
|
2773
2810
|
if (aligned && covered[0]) return covered[0].data;
|
|
2774
|
-
return
|
|
2811
|
+
return _chunkXIOMMGPDcjs.readRegion.call(void 0, surface, src);
|
|
2775
2812
|
}
|
|
2776
2813
|
const fkey = `${dx},${dy}:${perPixel.key}`;
|
|
2777
2814
|
const anchor = _nullishCoalesce(covered.find(Boolean), () => ( surface));
|
|
@@ -2781,7 +2818,7 @@ var RasterCompositor = (_class = class {
|
|
|
2781
2818
|
const hit = _optionalChain([byKey, 'optionalAccess', _43 => _43.get, 'call', _44 => _44(refsKey)]);
|
|
2782
2819
|
if (hit) return hit;
|
|
2783
2820
|
}
|
|
2784
|
-
const data =
|
|
2821
|
+
const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, surface, src);
|
|
2785
2822
|
perPixel.apply(data, r.width, r.height);
|
|
2786
2823
|
if (aligned) {
|
|
2787
2824
|
if (!byKey) {
|
|
@@ -2820,7 +2857,7 @@ var RasterCompositor = (_class = class {
|
|
|
2820
2857
|
if (!generated || generated.length !== W * H) v.fill(1);
|
|
2821
2858
|
else v.set(generated);
|
|
2822
2859
|
} else {
|
|
2823
|
-
const bytes =
|
|
2860
|
+
const bytes = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, { x: -ox, y: -oy, width: W, height: H });
|
|
2824
2861
|
for (let i = 0; i < v.length; i++) v[i] = bytes[i] / 255;
|
|
2825
2862
|
}
|
|
2826
2863
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
@@ -2856,7 +2893,7 @@ var RasterCompositor = (_class = class {
|
|
|
2856
2893
|
for (let x = x0; x < x1; x++) out[d + x] = plane.data[s + x];
|
|
2857
2894
|
}
|
|
2858
2895
|
} else {
|
|
2859
|
-
const bytes =
|
|
2896
|
+
const bytes = _chunkXIOMMGPDcjs.readRegion.call(void 0, mask.surface, { x: r.x - ox, y: r.y - oy, width: r.width, height: r.height });
|
|
2860
2897
|
let all = true;
|
|
2861
2898
|
for (let i = 0; i < n; i++) {
|
|
2862
2899
|
out[i] = bytes[i] / 255;
|
|
@@ -2968,10 +3005,10 @@ var RasterCompositor = (_class = class {
|
|
|
2968
3005
|
}
|
|
2969
3006
|
}, _class);
|
|
2970
3007
|
function filterOverCanvas(surface, ox, oy, filters, width, height) {
|
|
2971
|
-
if (width <= 0 || height <= 0) return
|
|
2972
|
-
const data =
|
|
3008
|
+
if (width <= 0 || height <= 0) return _chunkXIOMMGPDcjs.emptySurface.call(void 0, 4);
|
|
3009
|
+
const data = _chunkXIOMMGPDcjs.readRegion.call(void 0, surface, { x: -ox, y: -oy, width, height });
|
|
2973
3010
|
filters.apply(data, width, height);
|
|
2974
|
-
return
|
|
3011
|
+
return _chunkXIOMMGPDcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, 0, 0);
|
|
2975
3012
|
}
|
|
2976
3013
|
function copyRect(data, r, a) {
|
|
2977
3014
|
const out = new Uint8ClampedArray(a.width * a.height * 4);
|
|
@@ -3060,7 +3097,7 @@ function intersect(a, b) {
|
|
|
3060
3097
|
return x1 > x && y1 > y ? { x, y, width: x1 - x, height: y1 - y } : null;
|
|
3061
3098
|
}
|
|
3062
3099
|
function hasTilesIn(src, r) {
|
|
3063
|
-
for (const { tx, ty } of
|
|
3100
|
+
for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, r)) if (src.getTile(tx, ty)) return true;
|
|
3064
3101
|
return false;
|
|
3065
3102
|
}
|
|
3066
3103
|
function readWindow(src, srcRect, rect) {
|
|
@@ -3069,7 +3106,7 @@ function readWindow(src, srcRect, rect) {
|
|
|
3069
3106
|
const win = { x: rect.x, y: rect.y, w: rect.width, h: rect.height, n, data };
|
|
3070
3107
|
const r = intersect(rect, srcRect);
|
|
3071
3108
|
if (!r) return win;
|
|
3072
|
-
const px =
|
|
3109
|
+
const px = _chunkXIOMMGPDcjs.readRegion.call(void 0, src, r);
|
|
3073
3110
|
for (let y = 0; y < r.height; y++) {
|
|
3074
3111
|
let s = y * r.width * src.channels;
|
|
3075
3112
|
let d = ((r.y - rect.y + y) * rect.width + (r.x - rect.x)) * n;
|
|
@@ -3211,13 +3248,13 @@ function boxReduce(src, srcRect, kx, ky) {
|
|
|
3211
3248
|
const ry1 = Math.ceil((srcRect.y + srcRect.height) / ky);
|
|
3212
3249
|
const rw = rx1 - rx0;
|
|
3213
3250
|
const rect = { x: rx0, y: ry0, width: rw, height: ry1 - ry0 };
|
|
3214
|
-
let out =
|
|
3215
|
-
const rowsPer = Math.max(1, Math.floor(
|
|
3251
|
+
let out = _chunkXIOMMGPDcjs.emptySurface.call(void 0, ch, src.defaultValue);
|
|
3252
|
+
const rowsPer = Math.max(1, Math.floor(_chunkXIOMMGPDcjs.TILE / ky));
|
|
3216
3253
|
const area = kx * ky;
|
|
3217
3254
|
for (let ry = ry0; ry < ry1; ry += rowsPer) {
|
|
3218
3255
|
const rows = Math.min(rowsPer, ry1 - ry);
|
|
3219
3256
|
const strip = { x: rx0 * kx, y: ry * ky, width: rw * kx, height: rows * ky };
|
|
3220
|
-
const px =
|
|
3257
|
+
const px = _chunkXIOMMGPDcjs.readRegion.call(void 0, src, strip);
|
|
3221
3258
|
const red = new Uint8ClampedArray(rw * rows * ch);
|
|
3222
3259
|
for (let j = 0; j < rows; j++) {
|
|
3223
3260
|
for (let i = 0; i < rw; i++) {
|
|
@@ -3253,13 +3290,13 @@ function boxReduce(src, srcRect, kx, ky) {
|
|
|
3253
3290
|
}
|
|
3254
3291
|
}
|
|
3255
3292
|
}
|
|
3256
|
-
out =
|
|
3293
|
+
out = _chunkXIOMMGPDcjs.writeRegion.call(void 0, out, { x: rx0, y: ry, width: rw, height: rows }, red);
|
|
3257
3294
|
}
|
|
3258
3295
|
return { surface: out, rect };
|
|
3259
3296
|
}
|
|
3260
3297
|
function reduceSurface(src, factor) {
|
|
3261
3298
|
const k = Math.max(1, Math.floor(factor));
|
|
3262
|
-
const b =
|
|
3299
|
+
const b = _chunkXIOMMGPDcjs.contentBounds.call(void 0, src);
|
|
3263
3300
|
if (k === 1 || !b) return src;
|
|
3264
3301
|
return boxReduce(src, b, k, k).surface;
|
|
3265
3302
|
}
|
|
@@ -3287,7 +3324,7 @@ function checkBudget(dst, what = "result") {
|
|
|
3287
3324
|
}
|
|
3288
3325
|
}
|
|
3289
3326
|
function assemble(src, tiles) {
|
|
3290
|
-
return new (0,
|
|
3327
|
+
return new (0, _chunkXIOMMGPDcjs.TiledSurface)(src.channels, tiles, src.defaultValue);
|
|
3291
3328
|
}
|
|
3292
3329
|
function transformedBounds(source, h) {
|
|
3293
3330
|
if (!(source.width > 0 && source.height > 0) || !_chunkMUUXNRU4cjs.invertHomography.call(void 0, h)) return null;
|
|
@@ -3299,16 +3336,16 @@ function transformSurface(src, h, options = {}) {
|
|
|
3299
3336
|
const interp = _nullishCoalesce(options.interpolation, () => ( "bicubic"));
|
|
3300
3337
|
const ch = src.channels;
|
|
3301
3338
|
const def = src.defaultValue;
|
|
3302
|
-
const empty =
|
|
3339
|
+
const empty = _chunkXIOMMGPDcjs.emptySurface.call(void 0, ch, def);
|
|
3303
3340
|
const given = options.source;
|
|
3304
3341
|
const step = normalizeStep(options.step);
|
|
3305
3342
|
if (_chunkMUUXNRU4cjs.isIdentityHomography.call(void 0, h, 1e-12) && !given && !options.clip) return src;
|
|
3306
3343
|
const dx = h[2] / h[8];
|
|
3307
3344
|
const dy = h[5] / h[8];
|
|
3308
3345
|
if (!given && !options.clip && _chunkMUUXNRU4cjs.isIdentityHomography.call(void 0, [h[0], h[1], 0, h[3], h[4], 0, h[6], h[7], h[8]], 1e-12) && Math.abs(dx - Math.round(dx)) < 1e-9 && Math.abs(dy - Math.round(dy)) < 1e-9) {
|
|
3309
|
-
return
|
|
3346
|
+
return _chunkXIOMMGPDcjs.translateSurface.call(void 0, src, Math.round(dx), Math.round(dy));
|
|
3310
3347
|
}
|
|
3311
|
-
let srcRect = given ? intersect(given, given) :
|
|
3348
|
+
let srcRect = given ? intersect(given, given) : _chunkXIOMMGPDcjs.contentBounds.call(void 0, src);
|
|
3312
3349
|
if (!srcRect) return empty;
|
|
3313
3350
|
let H = h;
|
|
3314
3351
|
let S = src;
|
|
@@ -3358,8 +3395,8 @@ function transformSurface(src, h, options = {}) {
|
|
|
3358
3395
|
const sy0 = sr.y;
|
|
3359
3396
|
const sx1 = sr.x + sr.width - 1;
|
|
3360
3397
|
const sy1 = sr.y + sr.height - 1;
|
|
3361
|
-
for (const { tx, ty } of
|
|
3362
|
-
const t = intersect({ x: tx *
|
|
3398
|
+
for (const { tx, ty } of _chunkXIOMMGPDcjs.tilesInRect.call(void 0, dst)) {
|
|
3399
|
+
const t = intersect({ x: tx * _chunkXIOMMGPDcjs.TILE, y: ty * _chunkXIOMMGPDcjs.TILE, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE }, dst);
|
|
3363
3400
|
if (!t) continue;
|
|
3364
3401
|
const tc = [
|
|
3365
3402
|
{ x: t.x, y: t.y },
|
|
@@ -3405,11 +3442,11 @@ function transformSurface(src, h, options = {}) {
|
|
|
3405
3442
|
const readable = intersect(foot, sr);
|
|
3406
3443
|
if (!readable || !hasTilesIn(S, readable)) continue;
|
|
3407
3444
|
const win = readWindow(S, sr, foot);
|
|
3408
|
-
const out = new Uint8ClampedArray(
|
|
3445
|
+
const out = new Uint8ClampedArray(_chunkXIOMMGPDcjs.TILE * _chunkXIOMMGPDcjs.TILE * ch);
|
|
3409
3446
|
if (def) out.fill(def);
|
|
3410
3447
|
let any = false;
|
|
3411
|
-
const ox = tx *
|
|
3412
|
-
const oy = ty *
|
|
3448
|
+
const ox = tx * _chunkXIOMMGPDcjs.TILE;
|
|
3449
|
+
const oy = ty * _chunkXIOMMGPDcjs.TILE;
|
|
3413
3450
|
let su = widen(su0);
|
|
3414
3451
|
let sv = widen(sv0);
|
|
3415
3452
|
const ystart = t.y - ((t.y - oy) % step + step) % step;
|
|
@@ -3445,7 +3482,7 @@ function transformSurface(src, h, options = {}) {
|
|
|
3445
3482
|
const y0 = Math.max(y, t.y);
|
|
3446
3483
|
const y1 = Math.min(y + step, t.y + t.height);
|
|
3447
3484
|
for (let yy = y0; yy < y1; yy++) {
|
|
3448
|
-
const row = (yy - oy) *
|
|
3485
|
+
const row = (yy - oy) * _chunkXIOMMGPDcjs.TILE - ox;
|
|
3449
3486
|
for (let bi = 0, x = xstart; bi < blocks; bi++, x += step) {
|
|
3450
3487
|
if (!rowSet[bi]) continue;
|
|
3451
3488
|
const x0 = Math.max(x, t.x);
|
|
@@ -3457,8 +3494,8 @@ function transformSurface(src, h, options = {}) {
|
|
|
3457
3494
|
}
|
|
3458
3495
|
}
|
|
3459
3496
|
if (!any) continue;
|
|
3460
|
-
const tile =
|
|
3461
|
-
if (tile) tiles.set(
|
|
3497
|
+
const tile = _chunkXIOMMGPDcjs.finishTile.call(void 0, out, ch, def);
|
|
3498
|
+
if (tile) tiles.set(_chunkXIOMMGPDcjs.tileKey.call(void 0, tx, ty), tile);
|
|
3462
3499
|
}
|
|
3463
3500
|
return assemble(src, tiles);
|
|
3464
3501
|
}
|
|
@@ -3469,8 +3506,8 @@ function warpSurface(src, f, options = {}) {
|
|
|
3469
3506
|
const interp = _nullishCoalesce(options.interpolation, () => ( "bicubic"));
|
|
3470
3507
|
const ch = src.channels;
|
|
3471
3508
|
const def = src.defaultValue;
|
|
3472
|
-
const empty =
|
|
3473
|
-
const sr = options.source ? intersect(options.source, options.source) :
|
|
3509
|
+
const empty = _chunkXIOMMGPDcjs.emptySurface.call(void 0, ch, def);
|
|
3510
|
+
const sr = options.source ? intersect(options.source, options.source) : _chunkXIOMMGPDcjs.contentBounds.call(void 0, src);
|
|
3474
3511
|
if (!sr) return empty;
|
|
3475
3512
|
const step = normalizeStep(options.step);
|
|
3476
3513
|
const nx = Math.min(MAX_CELLS, Math.max(1, Math.ceil(sr.width / CELL)));
|
|
@@ -3521,10 +3558,10 @@ function warpSurface(src, f, options = {}) {
|
|
|
3521
3558
|
tris[t++] = a + w1;
|
|
3522
3559
|
}
|
|
3523
3560
|
}
|
|
3524
|
-
const tx0 = Math.floor(dst.x /
|
|
3525
|
-
const ty0 = Math.floor(dst.y /
|
|
3526
|
-
const cols = Math.floor((dst.x + dst.width - 1) /
|
|
3527
|
-
const rows = Math.floor((dst.y + dst.height - 1) /
|
|
3561
|
+
const tx0 = Math.floor(dst.x / _chunkXIOMMGPDcjs.TILE);
|
|
3562
|
+
const ty0 = Math.floor(dst.y / _chunkXIOMMGPDcjs.TILE);
|
|
3563
|
+
const cols = Math.floor((dst.x + dst.width - 1) / _chunkXIOMMGPDcjs.TILE) - tx0 + 1;
|
|
3564
|
+
const rows = Math.floor((dst.y + dst.height - 1) / _chunkXIOMMGPDcjs.TILE) - ty0 + 1;
|
|
3528
3565
|
const bins = Array.from({ length: cols * rows }, () => []);
|
|
3529
3566
|
for (let k = 0; k < triCount; k++) {
|
|
3530
3567
|
const a = tris[3 * k];
|
|
@@ -3534,10 +3571,10 @@ function warpSurface(src, f, options = {}) {
|
|
|
3534
3571
|
const tminy = Math.floor(Math.min(dvy[a], dvy[b], dvy[c]));
|
|
3535
3572
|
const tmaxx = Math.ceil(Math.max(dvx[a], dvx[b], dvx[c]));
|
|
3536
3573
|
const tmaxy = Math.ceil(Math.max(dvy[a], dvy[b], dvy[c]));
|
|
3537
|
-
const cx0 = Math.max(0, Math.floor(Math.max(tminx, dst.x) /
|
|
3538
|
-
const cy0 = Math.max(0, Math.floor(Math.max(tminy, dst.y) /
|
|
3539
|
-
const cx1 = Math.min(cols - 1, Math.floor(Math.min(tmaxx, dst.x + dst.width - 1) /
|
|
3540
|
-
const cy1 = Math.min(rows - 1, Math.floor(Math.min(tmaxy, dst.y + dst.height - 1) /
|
|
3574
|
+
const cx0 = Math.max(0, Math.floor(Math.max(tminx, dst.x) / _chunkXIOMMGPDcjs.TILE) - tx0);
|
|
3575
|
+
const cy0 = Math.max(0, Math.floor(Math.max(tminy, dst.y) / _chunkXIOMMGPDcjs.TILE) - ty0);
|
|
3576
|
+
const cx1 = Math.min(cols - 1, Math.floor(Math.min(tmaxx, dst.x + dst.width - 1) / _chunkXIOMMGPDcjs.TILE) - tx0);
|
|
3577
|
+
const cy1 = Math.min(rows - 1, Math.floor(Math.min(tmaxy, dst.y + dst.height - 1) / _chunkXIOMMGPDcjs.TILE) - ty0);
|
|
3541
3578
|
for (let cy = cy0; cy <= cy1; cy++) for (let cx = cx0; cx <= cx1; cx++) bins[cy * cols + cx].push(k);
|
|
3542
3579
|
}
|
|
3543
3580
|
const tiles = /* @__PURE__ */ new Map();
|
|
@@ -3551,7 +3588,7 @@ function warpSurface(src, f, options = {}) {
|
|
|
3551
3588
|
if (!list.length) continue;
|
|
3552
3589
|
const ttx = tx0 + cx;
|
|
3553
3590
|
const tty = ty0 + cy;
|
|
3554
|
-
const t = intersect({ x: ttx *
|
|
3591
|
+
const t = intersect({ x: ttx * _chunkXIOMMGPDcjs.TILE, y: tty * _chunkXIOMMGPDcjs.TILE, width: _chunkXIOMMGPDcjs.TILE, height: _chunkXIOMMGPDcjs.TILE }, dst);
|
|
3555
3592
|
if (!t) continue;
|
|
3556
3593
|
const tw = t.width;
|
|
3557
3594
|
const th = t.height;
|
|
@@ -3641,11 +3678,11 @@ function warpSurface(src, f, options = {}) {
|
|
|
3641
3678
|
const foot = intersect({ x: Math.floor(fx0) - 3, y: Math.floor(fy0) - 3, width: Math.ceil(fx1) - Math.floor(fx0) + 6, height: Math.ceil(fy1) - Math.floor(fy0) + 6 }, sr);
|
|
3642
3679
|
if (!foot || !hasTilesIn(src, foot)) continue;
|
|
3643
3680
|
const win = readWindow(src, sr, foot);
|
|
3644
|
-
const out = new Uint8ClampedArray(
|
|
3681
|
+
const out = new Uint8ClampedArray(_chunkXIOMMGPDcjs.TILE * _chunkXIOMMGPDcjs.TILE * ch);
|
|
3645
3682
|
if (def) out.fill(def);
|
|
3646
3683
|
let any = false;
|
|
3647
|
-
const ox = ttx *
|
|
3648
|
-
const oy = tty *
|
|
3684
|
+
const ox = ttx * _chunkXIOMMGPDcjs.TILE;
|
|
3685
|
+
const oy = tty * _chunkXIOMMGPDcjs.TILE;
|
|
3649
3686
|
const pointAt = (o, into) => {
|
|
3650
3687
|
const li = owner[o];
|
|
3651
3688
|
const cnx = ssx[li];
|
|
@@ -3676,7 +3713,7 @@ function warpSurface(src, f, options = {}) {
|
|
|
3676
3713
|
pointAt(o, acc);
|
|
3677
3714
|
const x = t.x + o % tw;
|
|
3678
3715
|
const y = t.y + Math.floor(o / tw);
|
|
3679
|
-
if (store(out, ((y - oy) *
|
|
3716
|
+
if (store(out, ((y - oy) * _chunkXIOMMGPDcjs.TILE + (x - ox)) * ch, acc, ch, def)) any = true;
|
|
3680
3717
|
}
|
|
3681
3718
|
} else {
|
|
3682
3719
|
for (let by = 0; by < th; by += step) {
|
|
@@ -3684,19 +3721,19 @@ function warpSurface(src, f, options = {}) {
|
|
|
3684
3721
|
const o = by * tw + bx;
|
|
3685
3722
|
if (Number.isNaN(us[o])) continue;
|
|
3686
3723
|
pointAt(o, acc);
|
|
3687
|
-
const first = ((t.y + by - oy) *
|
|
3724
|
+
const first = ((t.y + by - oy) * _chunkXIOMMGPDcjs.TILE + (t.x + bx - ox)) * ch;
|
|
3688
3725
|
if (!store(out, first, acc, ch, def)) continue;
|
|
3689
3726
|
any = true;
|
|
3690
3727
|
for (let yy = by; yy < Math.min(th, by + step); yy++) {
|
|
3691
|
-
const row = ((t.y + yy - oy) *
|
|
3728
|
+
const row = ((t.y + yy - oy) * _chunkXIOMMGPDcjs.TILE + (t.x - ox)) * ch;
|
|
3692
3729
|
for (let xx = bx; xx < Math.min(tw, bx + step); xx++) for (let c = 0; c < ch; c++) out[row + xx * ch + c] = out[first + c];
|
|
3693
3730
|
}
|
|
3694
3731
|
}
|
|
3695
3732
|
}
|
|
3696
3733
|
}
|
|
3697
3734
|
if (!any) continue;
|
|
3698
|
-
const tile =
|
|
3699
|
-
if (tile) tiles.set(
|
|
3735
|
+
const tile = _chunkXIOMMGPDcjs.finishTile.call(void 0, out, ch, def);
|
|
3736
|
+
if (tile) tiles.set(_chunkXIOMMGPDcjs.tileKey.call(void 0, ttx, tty), tile);
|
|
3700
3737
|
}
|
|
3701
3738
|
}
|
|
3702
3739
|
return assemble(src, tiles);
|
|
@@ -3712,7 +3749,7 @@ function compositeSurfaceOver(base, top) {
|
|
|
3712
3749
|
tiles.set(key, t);
|
|
3713
3750
|
continue;
|
|
3714
3751
|
}
|
|
3715
|
-
const d = new Uint8ClampedArray(
|
|
3752
|
+
const d = new Uint8ClampedArray(_chunkXIOMMGPDcjs.TILE * _chunkXIOMMGPDcjs.TILE * ch);
|
|
3716
3753
|
if (under) d.set(under.data);
|
|
3717
3754
|
else if (base.defaultValue) d.fill(base.defaultValue);
|
|
3718
3755
|
const s = t.data;
|
|
@@ -3738,11 +3775,11 @@ function compositeSurfaceOver(base, top) {
|
|
|
3738
3775
|
if (ta > 0) d[p] = s[i] * ta + d[p] * (1 - ta);
|
|
3739
3776
|
}
|
|
3740
3777
|
}
|
|
3741
|
-
const tile =
|
|
3778
|
+
const tile = _chunkXIOMMGPDcjs.finishTile.call(void 0, d, ch, base.defaultValue);
|
|
3742
3779
|
if (tile) tiles.set(key, tile);
|
|
3743
3780
|
else tiles.delete(key);
|
|
3744
3781
|
}
|
|
3745
|
-
return new (0,
|
|
3782
|
+
return new (0, _chunkXIOMMGPDcjs.TiledSurface)(ch, tiles, base.defaultValue);
|
|
3746
3783
|
}
|
|
3747
3784
|
|
|
3748
3785
|
// src/raster/zlib.ts
|
|
@@ -4651,5 +4688,6 @@ function pngDataUrl(width, height, data, channels = 4) {
|
|
|
4651
4688
|
|
|
4652
4689
|
|
|
4653
4690
|
|
|
4654
|
-
|
|
4655
|
-
|
|
4691
|
+
|
|
4692
|
+
exports.DIRECT_GAUSSIAN_MAX_SIGMA = DIRECT_GAUSSIAN_MAX_SIGMA; exports.gaussianBlur = gaussianBlur; exports.flattenLayers = flattenLayers; exports.findLayer = findLayer; exports.mapLayer = mapLayer; exports.insertLayer = insertLayer; exports.isLayerLocked = isLayerLocked; exports.DEFAULT_GLOBAL_LIGHT = DEFAULT_GLOBAL_LIGHT; exports.LAYER_EFFECT_KINDS = LAYER_EFFECT_KINDS; exports.layerEffectLabel = layerEffectLabel; exports.isLayerEffectKind = isLayerEffectKind; exports.defaultEffectGradient = defaultEffectGradient; exports.newEffectId = newEffectId; exports.defaultLayerEffect = defaultLayerEffect; exports.hasActiveEffects = hasActiveEffects; exports.MAX_EFFECT_REACH = MAX_EFFECT_REACH; exports.effectReach = effectReach; exports.effectsMargin = effectsMargin; exports.effectsScale = effectsScale; exports.scaleLayerEffect = scaleLayerEffect; exports.parseEffectColor = parseEffectColor; exports.effectColorHex = effectColorHex; exports.LayerEffectError = LayerEffectError; exports.validateEffectGradient = validateEffectGradient; exports.layerEffectFields = layerEffectFields; exports.validateLayerEffect = validateLayerEffect; exports.mergeLayerEffect = mergeLayerEffect; exports.validateLayerEffects = validateLayerEffects; exports.normalizeLayerEffects = normalizeLayerEffects; exports.effectsFingerprint = effectsFingerprint; exports.PatternTile = PatternTile; exports.PatternPlacement = PatternPlacement; exports.builtinPatternIds = builtinPatternIds; exports.builtinPattern = builtinPattern; exports.hashNoise = hashNoise; exports.CURVE_LUT_SIZE = CURVE_LUT_SIZE; exports.curveLut = curveLut; exports.STROKE_CHAMFER_MAX = STROKE_CHAMFER_MAX; exports.contourLut = contourLut; exports.activeEffectItems = activeEffectItems; exports.effectsAreLocal = effectsAreLocal; exports.buildEffectMaps = buildEffectMaps; exports.patchEffectMaps = patchEffectMaps; exports.gradientT = gradientT; exports.effectFillColors = effectFillColors; exports.compositeLayerEffects = compositeLayerEffects; exports.renderLayerEffects = renderLayerEffects; exports.blendTile = blendTile; exports.RasterCompositor = RasterCompositor; exports.changedTiles = changedTiles; exports.INTERPOLATIONS = INTERPOLATIONS; exports.isInterpolation = isInterpolation; exports.MAX_TRANSFORM_PIXELS = MAX_TRANSFORM_PIXELS; exports.TransformTooLargeError = TransformTooLargeError; exports.keysWeight = keysWeight; exports.reduceSurface = reduceSurface; exports.transformedBounds = transformedBounds; exports.transformSurface = transformSurface; exports.warpSurface = warpSurface; exports.compositeSurfaceOver = compositeSurfaceOver; exports.ZlibError = ZlibError; exports.inflateRaw = inflateRaw; exports.adler32 = adler32; exports.inflate = inflate; exports.deflateRaw = deflateRaw; exports.deflate = deflate; exports.encodePng = encodePng; exports.isPng = isPng; exports.decodePng = decodePng; exports.bytesToBase64 = bytesToBase64; exports.base64ToBytes = base64ToBytes; exports.parseDataUrl = parseDataUrl; exports.pngDataUrl = pngDataUrl;
|
|
4693
|
+
//# sourceMappingURL=chunk-POGBUYWE.cjs.map
|