@pixerate/editor 0.94.0 → 0.96.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 +2 -0
- package/dist/{chunk-ZOOEX3WT.cjs → chunk-CRMAXIUV.cjs} +369 -7
- package/dist/chunk-CRMAXIUV.cjs.map +1 -0
- package/dist/{chunk-D4ZCU72J.js → chunk-HEW6KDNI.js} +366 -4
- package/dist/chunk-HEW6KDNI.js.map +1 -0
- package/dist/{chunk-ISDCJHTO.js → chunk-IB53LVGV.js} +238 -285
- package/dist/chunk-IB53LVGV.js.map +1 -0
- package/dist/{chunk-747CGOT2.js → chunk-KFTQ2PKP.js} +29 -2
- package/dist/chunk-KFTQ2PKP.js.map +1 -0
- package/dist/{chunk-73L6TROJ.cjs → chunk-T422YCHR.cjs} +71 -44
- package/dist/chunk-T422YCHR.cjs.map +1 -0
- package/dist/{chunk-4F3YDIWW.cjs → chunk-ZZOTHJ4K.cjs} +264 -311
- package/dist/chunk-ZZOTHJ4K.cjs.map +1 -0
- package/dist/image-editor/index.cjs +1832 -632
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +179 -22
- package/dist/image-editor/index.d.ts +179 -22
- package/dist/image-editor/index.js +1463 -263
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +22 -3
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +117 -2
- package/dist/paint/index.d.ts +117 -2
- package/dist/paint/index.js +32 -13
- package/dist/raster/index.cjs +7 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +796 -5
- package/dist/raster/index.d.ts +796 -5
- package/dist/raster/index.js +6 -2
- package/dist/{surface-CuBg2c6k.d.cts → surface-DIA-XatS.d.cts} +23 -11
- package/dist/{surface-CuBg2c6k.d.ts → surface-DIA-XatS.d.ts} +23 -11
- package/package.json +1 -1
- package/skills/pixerate-image-editor/SKILL.md +39 -6
- package/dist/chunk-4F3YDIWW.cjs.map +0 -1
- package/dist/chunk-73L6TROJ.cjs.map +0 -1
- package/dist/chunk-747CGOT2.js.map +0 -1
- package/dist/chunk-D4ZCU72J.js.map +0 -1
- package/dist/chunk-ISDCJHTO.js.map +0 -1
- package/dist/chunk-ZOOEX3WT.cjs.map +0 -1
- package/dist/zlib-BJ6U7LuB.d.cts +0 -795
- package/dist/zlib-BjQkpMFi.d.ts +0 -795
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkCRMAXIUVcjs = require('./chunk-CRMAXIUV.cjs');
|
|
13
15
|
|
|
14
16
|
// src/raster/blur.ts
|
|
15
17
|
function gaussianKernel(sigma) {
|
|
@@ -370,7 +372,8 @@ function oneOf(r, key, path, values) {
|
|
|
370
372
|
if (typeof r[key] !== "string" || !values.includes(r[key])) fail(`${path}.${key}`, `must be one of ${values.join(", ")}.`);
|
|
371
373
|
}
|
|
372
374
|
function blend(r, key, path) {
|
|
373
|
-
if (!
|
|
375
|
+
if (!_chunkCRMAXIUVcjs.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])}).`);
|
|
376
|
+
if (r[key] === "pigment") fail(`${path}.${key}`, "pigment is a layer blend mode only; effects cannot use it.");
|
|
374
377
|
}
|
|
375
378
|
function contour(v, path) {
|
|
376
379
|
if (v === void 0) return;
|
|
@@ -1451,6 +1454,7 @@ function buildEffectMaps(items, shape, rect, ctx) {
|
|
|
1451
1454
|
}
|
|
1452
1455
|
var rgbScratchB = [0, 0, 0];
|
|
1453
1456
|
var rgbScratchS = [0, 0, 0];
|
|
1457
|
+
var rgbScratchM = [0, 0, 0];
|
|
1454
1458
|
function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
1455
1459
|
if (!(sa > 0)) return;
|
|
1456
1460
|
const ab = dst[i + 3];
|
|
@@ -1462,6 +1466,20 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1462
1466
|
const b0 = dst[i];
|
|
1463
1467
|
const b1 = dst[i + 1];
|
|
1464
1468
|
const b2 = dst[i + 2];
|
|
1469
|
+
if (mode === "pigment") {
|
|
1470
|
+
rgbScratchB[0] = b0;
|
|
1471
|
+
rgbScratchB[1] = b1;
|
|
1472
|
+
rgbScratchB[2] = b2;
|
|
1473
|
+
rgbScratchS[0] = sr;
|
|
1474
|
+
rgbScratchS[1] = sg;
|
|
1475
|
+
rgbScratchS[2] = sb;
|
|
1476
|
+
_chunkCRMAXIUVcjs.mixPigmentRgb.call(void 0, rgbScratchB, rgbScratchS, sa / ao, rgbScratchM);
|
|
1477
|
+
dst[i] = rgbScratchM[0];
|
|
1478
|
+
dst[i + 1] = rgbScratchM[1];
|
|
1479
|
+
dst[i + 2] = rgbScratchM[2];
|
|
1480
|
+
dst[i + 3] = ao;
|
|
1481
|
+
return;
|
|
1482
|
+
}
|
|
1465
1483
|
let m0;
|
|
1466
1484
|
let m1;
|
|
1467
1485
|
let m2;
|
|
@@ -1470,9 +1488,9 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1470
1488
|
m1 = sg;
|
|
1471
1489
|
m2 = sb;
|
|
1472
1490
|
} else if (separable) {
|
|
1473
|
-
m0 =
|
|
1474
|
-
m1 =
|
|
1475
|
-
m2 =
|
|
1491
|
+
m0 = _chunkCRMAXIUVcjs.blendChannel.call(void 0, mode, b0, sr);
|
|
1492
|
+
m1 = _chunkCRMAXIUVcjs.blendChannel.call(void 0, mode, b1, sg);
|
|
1493
|
+
m2 = _chunkCRMAXIUVcjs.blendChannel.call(void 0, mode, b2, sb);
|
|
1476
1494
|
} else {
|
|
1477
1495
|
rgbScratchB[0] = b0;
|
|
1478
1496
|
rgbScratchB[1] = b1;
|
|
@@ -1480,7 +1498,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1480
1498
|
rgbScratchS[0] = sr;
|
|
1481
1499
|
rgbScratchS[1] = sg;
|
|
1482
1500
|
rgbScratchS[2] = sb;
|
|
1483
|
-
const m =
|
|
1501
|
+
const m = _chunkCRMAXIUVcjs.blendRgb.call(void 0, mode, rgbScratchB, rgbScratchS);
|
|
1484
1502
|
m0 = m[0];
|
|
1485
1503
|
m1 = m[1];
|
|
1486
1504
|
m2 = m[2];
|
|
@@ -1494,7 +1512,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1494
1512
|
dst[i + 3] = ao;
|
|
1495
1513
|
}
|
|
1496
1514
|
function paint(dst, m, color2, mode, opacity) {
|
|
1497
|
-
const sep = mode !== "normal" &&
|
|
1515
|
+
const sep = mode !== "normal" && _chunkCRMAXIUVcjs.isSeparableBlendMode.call(void 0, mode);
|
|
1498
1516
|
const c = [0, 0, 0, 1];
|
|
1499
1517
|
const n = m.length;
|
|
1500
1518
|
for (let i = 0; i < n; i++) {
|
|
@@ -1746,7 +1764,7 @@ function compositeLayerEffects(input) {
|
|
|
1746
1764
|
}
|
|
1747
1765
|
const premerge = !normalLike;
|
|
1748
1766
|
if (premerge) {
|
|
1749
|
-
const sep2 =
|
|
1767
|
+
const sep2 = _chunkCRMAXIUVcjs.isSeparableBlendMode.call(void 0, input.blend);
|
|
1750
1768
|
for (let i = 0; i < n; i++) {
|
|
1751
1769
|
const p = i * 4;
|
|
1752
1770
|
const sr = lay[p];
|
|
@@ -1866,7 +1884,7 @@ function compositeLayerEffects(input) {
|
|
|
1866
1884
|
paintColor(work, fx(i, 1), e.shadowColor, e.shadowBlend, e.shadowOpacity);
|
|
1867
1885
|
}
|
|
1868
1886
|
const mode = premerge ? "normal" : input.blend;
|
|
1869
|
-
const sep =
|
|
1887
|
+
const sep = _chunkCRMAXIUVcjs.isSeparableBlendMode.call(void 0, mode);
|
|
1870
1888
|
for (let i = 0; i < n; i++) {
|
|
1871
1889
|
const p = i * 4;
|
|
1872
1890
|
if (lay[p + 3] > 0) compositeAt(work, p, mode, sep, lay[p], lay[p + 1], lay[p + 2], lay[p + 3]);
|
|
@@ -1911,7 +1929,7 @@ function renderLayerEffects(effects, layer, backdrop, canvas, ctx) {
|
|
|
1911
1929
|
}
|
|
1912
1930
|
|
|
1913
1931
|
// src/raster/compositor.ts
|
|
1914
|
-
var TILE_PIXELS =
|
|
1932
|
+
var TILE_PIXELS = _chunkCRMAXIUVcjs.TILE * _chunkCRMAXIUVcjs.TILE;
|
|
1915
1933
|
var TILE_BYTES = TILE_PIXELS * 4;
|
|
1916
1934
|
function sameSig(a, b) {
|
|
1917
1935
|
if (!a || a.key !== b.key || a.refs.length !== b.refs.length) return false;
|
|
@@ -1923,13 +1941,13 @@ function dirtyInTile(rects, tx, ty) {
|
|
|
1923
1941
|
let y0 = Infinity;
|
|
1924
1942
|
let x1 = -Infinity;
|
|
1925
1943
|
let y1 = -Infinity;
|
|
1926
|
-
const ox = tx *
|
|
1927
|
-
const oy = ty *
|
|
1944
|
+
const ox = tx * _chunkCRMAXIUVcjs.TILE;
|
|
1945
|
+
const oy = ty * _chunkCRMAXIUVcjs.TILE;
|
|
1928
1946
|
for (const r of rects) {
|
|
1929
1947
|
const a = Math.max(ox, Math.floor(r.x));
|
|
1930
1948
|
const b = Math.max(oy, Math.floor(r.y));
|
|
1931
|
-
const c = Math.min(ox +
|
|
1932
|
-
const d = Math.min(oy +
|
|
1949
|
+
const c = Math.min(ox + _chunkCRMAXIUVcjs.TILE, Math.ceil(r.x + r.width));
|
|
1950
|
+
const d = Math.min(oy + _chunkCRMAXIUVcjs.TILE, Math.ceil(r.y + r.height));
|
|
1933
1951
|
if (c <= a || d <= b) continue;
|
|
1934
1952
|
x0 = Math.min(x0, a);
|
|
1935
1953
|
y0 = Math.min(y0, b);
|
|
@@ -1941,7 +1959,8 @@ function dirtyInTile(rects, tx, ty) {
|
|
|
1941
1959
|
function blendTile(dst, src, mode, alpha, coverage) {
|
|
1942
1960
|
if (!(alpha > 0)) return;
|
|
1943
1961
|
const normal = mode === "normal";
|
|
1944
|
-
const
|
|
1962
|
+
const pigment = mode === "pigment";
|
|
1963
|
+
const lut = !normal && _chunkCRMAXIUVcjs.isSeparableBlendMode.call(void 0, mode) ? separableLut(mode) : null;
|
|
1945
1964
|
const cb = [0, 0, 0];
|
|
1946
1965
|
const cs = [0, 0, 0];
|
|
1947
1966
|
const n = dst.length;
|
|
@@ -1967,6 +1986,14 @@ function blendTile(dst, src, mode, alpha, coverage) {
|
|
|
1967
1986
|
const d0 = dst[i];
|
|
1968
1987
|
const d1 = dst[i + 1];
|
|
1969
1988
|
const d2 = dst[i + 2];
|
|
1989
|
+
if (pigment) {
|
|
1990
|
+
_chunkCRMAXIUVcjs.mixPigment8.call(void 0, d0, d1, d2, src[i], src[i + 1], src[i + 2], as / ao, cb);
|
|
1991
|
+
dst[i] = Math.round(cb[0] * 255);
|
|
1992
|
+
dst[i + 1] = Math.round(cb[1] * 255);
|
|
1993
|
+
dst[i + 2] = Math.round(cb[2] * 255);
|
|
1994
|
+
dst[i + 3] = Math.round(ao * 255);
|
|
1995
|
+
continue;
|
|
1996
|
+
}
|
|
1970
1997
|
const b0 = d0 / 255;
|
|
1971
1998
|
const b1 = d1 / 255;
|
|
1972
1999
|
const b2 = d2 / 255;
|
|
@@ -1991,7 +2018,7 @@ function blendTile(dst, src, mode, alpha, coverage) {
|
|
|
1991
2018
|
cs[0] = s0;
|
|
1992
2019
|
cs[1] = s1;
|
|
1993
2020
|
cs[2] = s2;
|
|
1994
|
-
const m =
|
|
2021
|
+
const m = _chunkCRMAXIUVcjs.blendRgb.call(void 0, mode, cb, cs);
|
|
1995
2022
|
m0 = m[0];
|
|
1996
2023
|
m1 = m[1];
|
|
1997
2024
|
m2 = m[2];
|
|
@@ -2010,7 +2037,7 @@ function separableLut(mode) {
|
|
|
2010
2037
|
let lut = separableLuts.get(mode);
|
|
2011
2038
|
if (!lut) {
|
|
2012
2039
|
lut = new Float64Array(65536);
|
|
2013
|
-
for (let b = 0; b < 256; b++) for (let c = 0; c < 256; c++) lut[b << 8 | c] =
|
|
2040
|
+
for (let b = 0; b < 256; b++) for (let c = 0; c < 256; c++) lut[b << 8 | c] = _chunkCRMAXIUVcjs.blendChannel.call(void 0, mode, b / 255, c / 255);
|
|
2014
2041
|
separableLuts.set(mode, lut);
|
|
2015
2042
|
}
|
|
2016
2043
|
return lut;
|
|
@@ -2082,15 +2109,15 @@ var RasterCompositor = (_class = class {
|
|
|
2082
2109
|
composite(layers, rect, sources, options = {}) {
|
|
2083
2110
|
const out = new Uint8ClampedArray(Math.max(0, rect.width * rect.height * 4));
|
|
2084
2111
|
this.compositeTiles(layers, rect, sources, (tx, ty, data) => {
|
|
2085
|
-
const ox = tx *
|
|
2086
|
-
const oy = ty *
|
|
2112
|
+
const ox = tx * _chunkCRMAXIUVcjs.TILE;
|
|
2113
|
+
const oy = ty * _chunkCRMAXIUVcjs.TILE;
|
|
2087
2114
|
const x0 = Math.max(rect.x, ox);
|
|
2088
2115
|
const y0 = Math.max(rect.y, oy);
|
|
2089
|
-
const x1 = Math.min(rect.x + rect.width, ox +
|
|
2090
|
-
const y1 = Math.min(rect.y + rect.height, oy +
|
|
2116
|
+
const x1 = Math.min(rect.x + rect.width, ox + _chunkCRMAXIUVcjs.TILE);
|
|
2117
|
+
const y1 = Math.min(rect.y + rect.height, oy + _chunkCRMAXIUVcjs.TILE);
|
|
2091
2118
|
const span = (x1 - x0) * 4;
|
|
2092
2119
|
for (let y = y0; y < y1; y++) {
|
|
2093
|
-
const s = ((y - oy) *
|
|
2120
|
+
const s = ((y - oy) * _chunkCRMAXIUVcjs.TILE + (x0 - ox)) * 4;
|
|
2094
2121
|
out.set(data.subarray(s, s + span), ((y - rect.y) * rect.width + (x0 - rect.x)) * 4);
|
|
2095
2122
|
}
|
|
2096
2123
|
}, options);
|
|
@@ -2109,9 +2136,9 @@ var RasterCompositor = (_class = class {
|
|
|
2109
2136
|
const stats = { tiles: 0, cached: 0, stepsRun: 0 };
|
|
2110
2137
|
const grow = options.dirty ? this.effectsReach(layers) : 0;
|
|
2111
2138
|
const dirty = grow > 0 ? options.dirty.map((d) => inflateRect(d, grow)) : options.dirty;
|
|
2112
|
-
for (const { tx, ty } of
|
|
2139
|
+
for (const { tx, ty } of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, rect)) {
|
|
2113
2140
|
stats.tiles++;
|
|
2114
|
-
const before = _optionalChain([this, 'access', _6 => _6.tiles, 'access', _7 => _7.get, 'call', _8 => _8(
|
|
2141
|
+
const before = _optionalChain([this, 'access', _6 => _6.tiles, 'access', _7 => _7.get, 'call', _8 => _8(_chunkCRMAXIUVcjs.tileKey.call(void 0, tx, ty)), 'optionalAccess', _9 => _9.result]);
|
|
2115
2142
|
const data = this.compositeTile(layers, steps, tx, ty, stats, dirty ? dirtyInTile(dirty, tx, ty) : null);
|
|
2116
2143
|
onTile(tx, ty, data, data !== before);
|
|
2117
2144
|
}
|
|
@@ -2187,7 +2214,7 @@ var RasterCompositor = (_class = class {
|
|
|
2187
2214
|
return key;
|
|
2188
2215
|
}
|
|
2189
2216
|
compositeTile(root, steps, tx, ty, stats, dirty = null) {
|
|
2190
|
-
const key =
|
|
2217
|
+
const key = _chunkCRMAXIUVcjs.tileKey.call(void 0, tx, ty);
|
|
2191
2218
|
const entry = this.tiles.get(key);
|
|
2192
2219
|
const sigs = steps.map((s) => this.stepSig(s, tx, ty));
|
|
2193
2220
|
let first = 0;
|
|
@@ -2209,20 +2236,20 @@ var RasterCompositor = (_class = class {
|
|
|
2209
2236
|
}
|
|
2210
2237
|
}
|
|
2211
2238
|
}
|
|
2212
|
-
const tileRect = { x: tx *
|
|
2239
|
+
const tileRect = { x: tx * _chunkCRMAXIUVcjs.TILE, y: ty * _chunkCRMAXIUVcjs.TILE, width: _chunkCRMAXIUVcjs.TILE, height: _chunkCRMAXIUVcjs.TILE };
|
|
2213
2240
|
const hint = this.hint;
|
|
2214
2241
|
const checkpoints = /* @__PURE__ */ new Map();
|
|
2215
2242
|
if (entry) {
|
|
2216
2243
|
for (const [index, cp] of entry.checkpoints) if (index <= start) checkpoints.set(index, cp);
|
|
2217
2244
|
}
|
|
2218
2245
|
let result;
|
|
2219
|
-
if (entry && dirty && (dirty.width <
|
|
2246
|
+
if (entry && dirty && (dirty.width < _chunkCRMAXIUVcjs.TILE || dirty.height < _chunkCRMAXIUVcjs.TILE)) {
|
|
2220
2247
|
const r = dirty;
|
|
2221
2248
|
const sub = (data) => {
|
|
2222
2249
|
const out = new Uint8ClampedArray(r.width * r.height * 4);
|
|
2223
2250
|
if (!data) return out;
|
|
2224
2251
|
for (let y = 0; y < r.height; y++) {
|
|
2225
|
-
const s = ((r.y - tileRect.y + y) *
|
|
2252
|
+
const s = ((r.y - tileRect.y + y) * _chunkCRMAXIUVcjs.TILE + (r.x - tileRect.x)) * 4;
|
|
2226
2253
|
out.set(data.subarray(s, s + r.width * 4), y * r.width * 4);
|
|
2227
2254
|
}
|
|
2228
2255
|
return out;
|
|
@@ -2235,7 +2262,7 @@ var RasterCompositor = (_class = class {
|
|
|
2235
2262
|
}
|
|
2236
2263
|
result = new Uint8ClampedArray(entry.result);
|
|
2237
2264
|
for (let y = 0; y < r.height; y++) {
|
|
2238
|
-
result.set(acc.subarray(y * r.width * 4, (y + 1) * r.width * 4), ((r.y - tileRect.y + y) *
|
|
2265
|
+
result.set(acc.subarray(y * r.width * 4, (y + 1) * r.width * 4), ((r.y - tileRect.y + y) * _chunkCRMAXIUVcjs.TILE + (r.x - tileRect.x)) * 4);
|
|
2239
2266
|
}
|
|
2240
2267
|
} else {
|
|
2241
2268
|
const acc = base ? new Uint8ClampedArray(base.data) : new Uint8ClampedArray(TILE_BYTES);
|
|
@@ -2330,8 +2357,8 @@ var RasterCompositor = (_class = class {
|
|
|
2330
2357
|
if (!isPixel(layer)) return { key, refs: this.maskRefs(layer, tx, ty, 0, 0) };
|
|
2331
2358
|
const { surface, dx, dy } = this.layerPixels(layer);
|
|
2332
2359
|
const refs = [surface.defaultValue];
|
|
2333
|
-
const r = { x: tx *
|
|
2334
|
-
for (const t of
|
|
2360
|
+
const r = { x: tx * _chunkCRMAXIUVcjs.TILE - dx, y: ty * _chunkCRMAXIUVcjs.TILE - dy, width: _chunkCRMAXIUVcjs.TILE, height: _chunkCRMAXIUVcjs.TILE };
|
|
2361
|
+
for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, r)) refs.push(_nullishCoalesce(surface.getTile(t.tx, t.ty), () => ( null)));
|
|
2335
2362
|
refs.push(...this.maskRefs(layer, tx, ty, _nullishCoalesce(_optionalChain([layer, 'access', _20 => _20.offset, 'optionalAccess', _21 => _21.x]), () => ( 0)), _nullishCoalesce(_optionalChain([layer, 'access', _22 => _22.offset, 'optionalAccess', _23 => _23.y]), () => ( 0))));
|
|
2336
2363
|
return { key, refs };
|
|
2337
2364
|
}
|
|
@@ -2392,7 +2419,7 @@ var RasterCompositor = (_class = class {
|
|
|
2392
2419
|
shapeRefs(layer, region) {
|
|
2393
2420
|
const refs = [];
|
|
2394
2421
|
if (region.width <= 0 || region.height <= 0) return refs;
|
|
2395
|
-
for (const t of
|
|
2422
|
+
for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, region)) {
|
|
2396
2423
|
const sig = isGroup(layer) ? this.plainGroupSig(layer, this.buildSteps(_nullishCoalesce(layer.children, () => ( []))), t.tx, t.ty) : this.plainContentSig(layer, t.tx, t.ty);
|
|
2397
2424
|
for (const r of sig.refs) refs.push(r);
|
|
2398
2425
|
}
|
|
@@ -2412,7 +2439,7 @@ var RasterCompositor = (_class = class {
|
|
|
2412
2439
|
const region = this.effectRegion(layer);
|
|
2413
2440
|
const m = effectsMargin(layer.effects);
|
|
2414
2441
|
if (effectsAreLocal(activeEffectItems(layer.effects))) {
|
|
2415
|
-
return { key, refs: this.shapeRefs(layer, intersectRect({ x: tx *
|
|
2442
|
+
return { key, refs: this.shapeRefs(layer, intersectRect({ x: tx * _chunkCRMAXIUVcjs.TILE - m, y: ty * _chunkCRMAXIUVcjs.TILE - m, width: _chunkCRMAXIUVcjs.TILE + 2 * m, height: _chunkCRMAXIUVcjs.TILE + 2 * m }, region)) };
|
|
2416
2443
|
}
|
|
2417
2444
|
return { key, refs: [`${region.x},${region.y},${region.width},${region.height}`, ...this.shapeRefs(layer, region)] };
|
|
2418
2445
|
}
|
|
@@ -2516,7 +2543,7 @@ var RasterCompositor = (_class = class {
|
|
|
2516
2543
|
if (!mask || mask.enabled === false) return [];
|
|
2517
2544
|
if (mask.source || (_nullishCoalesce(mask.feather, () => ( 0))) > 0) return [this.planeFor(mask, ox, oy)];
|
|
2518
2545
|
const refs = [];
|
|
2519
|
-
for (const t of
|
|
2546
|
+
for (const t of _chunkCRMAXIUVcjs.tilesInRect.call(void 0, { x: tx * _chunkCRMAXIUVcjs.TILE - ox, y: ty * _chunkCRMAXIUVcjs.TILE - oy, width: _chunkCRMAXIUVcjs.TILE, height: _chunkCRMAXIUVcjs.TILE })) {
|
|
2520
2547
|
refs.push(_nullishCoalesce(mask.surface.getTile(t.tx, t.ty), () => ( null)));
|
|
2521
2548
|
}
|
|
2522
2549
|
return refs;
|
|
@@ -2551,12 +2578,12 @@ var RasterCompositor = (_class = class {
|
|
|
2551
2578
|
if (!isPixel(layer)) return _nullishCoalesce(_optionalChain([this, 'access', _34 => _34.profile, 'access', _35 => _35.contentTile, 'optionalCall', _36 => _36(layer, r, this.sources)]), () => ( null));
|
|
2552
2579
|
const { surface, dx, dy, perPixel } = this.layerPixels(layer);
|
|
2553
2580
|
const src = { x: r.x - dx, y: r.y - dy, width: r.width, height: r.height };
|
|
2554
|
-
const covered =
|
|
2581
|
+
const covered = _chunkCRMAXIUVcjs.tilesInRect.call(void 0, src).map((t) => surface.getTile(t.tx, t.ty));
|
|
2555
2582
|
if (surface.defaultValue === 0 && covered.every((t) => !t)) return null;
|
|
2556
|
-
const aligned = r.width ===
|
|
2583
|
+
const aligned = r.width === _chunkCRMAXIUVcjs.TILE && r.height === _chunkCRMAXIUVcjs.TILE && src.x % _chunkCRMAXIUVcjs.TILE === 0 && src.y % _chunkCRMAXIUVcjs.TILE === 0;
|
|
2557
2584
|
if (!perPixel) {
|
|
2558
2585
|
if (aligned && covered[0]) return covered[0].data;
|
|
2559
|
-
return
|
|
2586
|
+
return _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, src);
|
|
2560
2587
|
}
|
|
2561
2588
|
const fkey = `${dx},${dy}:${perPixel.key}`;
|
|
2562
2589
|
const anchor = _nullishCoalesce(covered.find(Boolean), () => ( surface));
|
|
@@ -2566,7 +2593,7 @@ var RasterCompositor = (_class = class {
|
|
|
2566
2593
|
const hit = _optionalChain([byKey, 'optionalAccess', _37 => _37.get, 'call', _38 => _38(refsKey)]);
|
|
2567
2594
|
if (hit) return hit;
|
|
2568
2595
|
}
|
|
2569
|
-
const data =
|
|
2596
|
+
const data = _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, src);
|
|
2570
2597
|
perPixel.apply(data, r.width, r.height);
|
|
2571
2598
|
if (aligned) {
|
|
2572
2599
|
if (!byKey) {
|
|
@@ -2605,7 +2632,7 @@ var RasterCompositor = (_class = class {
|
|
|
2605
2632
|
if (!generated || generated.length !== W * H) v.fill(1);
|
|
2606
2633
|
else v.set(generated);
|
|
2607
2634
|
} else {
|
|
2608
|
-
const bytes =
|
|
2635
|
+
const bytes = _chunkCRMAXIUVcjs.readRegion.call(void 0, mask.surface, { x: -ox, y: -oy, width: W, height: H });
|
|
2609
2636
|
for (let i = 0; i < v.length; i++) v[i] = bytes[i] / 255;
|
|
2610
2637
|
}
|
|
2611
2638
|
const feather = _nullishCoalesce(mask.feather, () => ( 0));
|
|
@@ -2641,7 +2668,7 @@ var RasterCompositor = (_class = class {
|
|
|
2641
2668
|
for (let x = x0; x < x1; x++) out[d + x] = plane.data[s + x];
|
|
2642
2669
|
}
|
|
2643
2670
|
} else {
|
|
2644
|
-
const bytes =
|
|
2671
|
+
const bytes = _chunkCRMAXIUVcjs.readRegion.call(void 0, mask.surface, { x: r.x - ox, y: r.y - oy, width: r.width, height: r.height });
|
|
2645
2672
|
let all = true;
|
|
2646
2673
|
for (let i = 0; i < n; i++) {
|
|
2647
2674
|
out[i] = bytes[i] / 255;
|
|
@@ -2753,10 +2780,10 @@ var RasterCompositor = (_class = class {
|
|
|
2753
2780
|
}
|
|
2754
2781
|
}, _class);
|
|
2755
2782
|
function filterOverCanvas(surface, ox, oy, filters, width, height) {
|
|
2756
|
-
if (width <= 0 || height <= 0) return
|
|
2757
|
-
const data =
|
|
2783
|
+
if (width <= 0 || height <= 0) return _chunkCRMAXIUVcjs.emptySurface.call(void 0, 4);
|
|
2784
|
+
const data = _chunkCRMAXIUVcjs.readRegion.call(void 0, surface, { x: -ox, y: -oy, width, height });
|
|
2758
2785
|
filters.apply(data, width, height);
|
|
2759
|
-
return
|
|
2786
|
+
return _chunkCRMAXIUVcjs.surfaceFromPixels.call(void 0, { width, height, data }, 4, 0, 0);
|
|
2760
2787
|
}
|
|
2761
2788
|
function copyRect(data, r, a) {
|
|
2762
2789
|
const out = new Uint8ClampedArray(a.width * a.height * 4);
|
|
@@ -3682,4 +3709,4 @@ function pngDataUrl(width, height, data, channels = 4) {
|
|
|
3682
3709
|
|
|
3683
3710
|
|
|
3684
3711
|
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.gradientT = gradientT; exports.compositeLayerEffects = compositeLayerEffects; exports.renderLayerEffects = renderLayerEffects; exports.blendTile = blendTile; exports.RasterCompositor = RasterCompositor; exports.changedTiles = changedTiles; 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;
|
|
3685
|
-
//# sourceMappingURL=chunk-
|
|
3712
|
+
//# sourceMappingURL=chunk-T422YCHR.cjs.map
|