@pixerate/editor 0.246.0 → 0.249.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/README.md +1 -0
- package/dist/animation-editor/index.cjs +64 -61
- package/dist/animation-editor/index.js +8 -5
- package/dist/{brushstrokeRender-ZDHMXJAE.cjs → brushstrokeRender-GCKK7V2I.cjs} +14 -11
- package/dist/{brushstrokeRender-AKUI3SEJ.js → brushstrokeRender-T3JZST44.js} +7 -4
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-UVPD55UZ.cjs → chunk-2SMMZDMG.cjs} +35 -35
- package/dist/chunk-2VJAVXLI.js +192 -0
- package/dist/{chunk-OLNIPTB3.cjs → chunk-2VX55NFM.cjs} +1 -320
- package/dist/chunk-3K6HWEXZ.cjs +92 -0
- package/dist/{chunk-UOOK7HTX.js → chunk-3PPJRMIG.js} +1 -1
- package/dist/chunk-4D6KP5BV.js +92 -0
- package/dist/chunk-5RH3VXAK.js +269 -0
- package/dist/{chunk-LDPLEZ5T.js → chunk-6BIDVPED.js} +1 -1
- package/dist/{chunk-2ONK3ERD.cjs → chunk-75K3W4D6.cjs} +20 -20
- package/dist/chunk-BOHDJJ2O.cjs +192 -0
- package/dist/{chunk-2PBZBRP5.js → chunk-D5KGAO4Z.js} +10 -92
- package/dist/{chunk-DQWPMGH2.js → chunk-DOIU7VJG.js} +1 -1
- package/dist/{chunk-HB4ICNNA.cjs → chunk-DPYAO5U6.cjs} +42 -42
- package/dist/chunk-EJLRBS5Q.js +301 -0
- package/dist/{chunk-Q2UYUWAZ.cjs → chunk-H4AOUUBE.cjs} +679 -164
- package/dist/{chunk-PQ3H2AAN.cjs → chunk-I7NJPHWV.cjs} +122 -204
- package/dist/{chunk-FK5LTDOO.cjs → chunk-IOFVM3L3.cjs} +7 -7
- package/dist/{chunk-42TWUPNJ.js → chunk-IRSTHLQQ.js} +1 -320
- package/dist/{chunk-VDAWA546.js → chunk-J7T5QZ45.js} +614 -99
- package/dist/{chunk-VMROIWLL.cjs → chunk-KBYB7OWB.cjs} +3 -3
- package/dist/{chunk-5MFDD7SP.cjs → chunk-KYX7NZ5V.cjs} +1 -1
- package/dist/chunk-LJRCU3BJ.cjs +301 -0
- package/dist/{chunk-XTWXBQD4.cjs → chunk-LP2MCSBE.cjs} +593 -236
- package/dist/{chunk-A23PSOBB.js → chunk-O75V4ZS3.js} +1 -1
- package/dist/chunk-OTTT5N3K.js +322 -0
- package/dist/{chunk-N6WUB3Y5.js → chunk-PZP2SZIZ.js} +2 -2
- package/dist/{chunk-4PMCMWQS.js → chunk-UBRJOIR5.js} +367 -10
- package/dist/chunk-W5M3J7PV.cjs +322 -0
- package/dist/{chunk-4P6H35HU.js → chunk-WA44NKPF.js} +2 -2
- package/dist/{chunk-CEPKXLBS.cjs → chunk-WLJZZHUZ.cjs} +23 -23
- package/dist/{chunk-P3NIPIKS.js → chunk-WQCNC4DK.js} +1 -1
- package/dist/chunk-ZEYMKDYS.cjs +269 -0
- package/dist/image-editor/effect-tools.d.cts +37 -4
- package/dist/image-editor/effect-tools.d.ts +37 -4
- package/dist/image-editor/index.cjs +1340 -1828
- package/dist/image-editor/index.d.cts +1 -1
- package/dist/image-editor/index.d.ts +1 -1
- package/dist/image-editor/index.js +298 -786
- package/dist/paint/index.cjs +8 -5
- package/dist/paint/index.js +13 -10
- package/dist/paint-editor/controller.d.cts +71 -2
- package/dist/paint-editor/controller.d.ts +71 -2
- package/dist/paint-editor/index.cjs +901 -589
- package/dist/paint-editor/index.d.cts +3 -0
- package/dist/paint-editor/index.d.ts +3 -0
- package/dist/paint-editor/index.js +365 -53
- package/dist/paint-editor/procedural.d.cts +82 -5
- package/dist/paint-editor/procedural.d.ts +82 -5
- package/dist/paint-editor/sticker-art.d.cts +55 -0
- package/dist/paint-editor/sticker-art.d.ts +55 -0
- package/dist/paint-editor/stickers.d.cts +30 -17
- package/dist/paint-editor/stickers.d.ts +30 -17
- package/dist/paint-editor/stroke.d.cts +4 -0
- package/dist/paint-editor/stroke.d.ts +4 -0
- package/dist/paint-editor/tools.d.cts +1 -1
- package/dist/paint-editor/tools.d.ts +1 -1
- package/dist/paint-editor/ui.d.cts +25 -4
- package/dist/paint-editor/ui.d.ts +25 -4
- package/dist/{image-editor/layers/effects-ui.d.cts → raster/effects/ui.d.cts} +32 -5
- package/dist/{image-editor/layers/effects-ui.d.ts → raster/effects/ui.d.ts} +32 -5
- package/dist/raster/index.cjs +17 -3
- package/dist/raster/index.d.cts +1 -0
- package/dist/raster/index.d.ts +1 -0
- package/dist/raster/index.js +23 -9
- package/dist/stickers/browser.d.cts +48 -0
- package/dist/stickers/browser.d.ts +48 -0
- package/dist/stickers/combine.d.cts +10 -0
- package/dist/stickers/combine.d.ts +10 -0
- package/dist/stickers/conformance.d.cts +18 -0
- package/dist/stickers/conformance.d.ts +18 -0
- package/dist/stickers/editor.d.cts +14 -0
- package/dist/stickers/editor.d.ts +14 -0
- package/dist/stickers/errors.d.cts +6 -0
- package/dist/stickers/errors.d.ts +6 -0
- package/dist/stickers/fake.d.cts +16 -0
- package/dist/stickers/fake.d.ts +16 -0
- package/dist/stickers/helpers.d.cts +51 -0
- package/dist/stickers/helpers.d.ts +51 -0
- package/dist/stickers/index.cjs +331 -0
- package/dist/stickers/index.d.cts +16 -0
- package/dist/stickers/index.d.ts +16 -0
- package/dist/stickers/index.js +331 -0
- package/dist/stickers/stamps.d.cts +13 -0
- package/dist/stickers/stamps.d.ts +13 -0
- package/dist/stickers/tools.d.cts +25 -0
- package/dist/stickers/tools.d.ts +25 -0
- package/dist/stickers/types.d.cts +123 -0
- package/dist/stickers/types.d.ts +123 -0
- package/dist/vector/index.cjs +978 -975
- package/dist/vector/index.js +9 -6
- package/package.json +11 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +26 -32
- package/skills/pixerate-paint-editor/references/gradient-paint.md +23 -0
- package/skills/pixerate-paint-editor/references/layer-effects.md +28 -0
- package/skills/pixerate-paint-editor/references/light-paint.md +10 -2
- package/skills/pixerate-paint-editor/references/particle-brushes.md +66 -0
- package/skills/pixerate-stickers/SKILL.md +45 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TileableNoise,
|
|
3
|
+
hash2,
|
|
4
|
+
rand01,
|
|
5
|
+
randSigned
|
|
6
|
+
} from "./chunk-4D6KP5BV.js";
|
|
1
7
|
import {
|
|
2
8
|
BRUSHSTROKE_MAX_SCALE,
|
|
3
9
|
BRUSHSTROKE_MIN_SCALE
|
|
@@ -10,11 +16,13 @@ import {
|
|
|
10
16
|
mixPigment8,
|
|
11
17
|
mixPigmentRgb,
|
|
12
18
|
pigment8,
|
|
13
|
-
pngDataUrl,
|
|
14
19
|
setPigmentColor,
|
|
15
20
|
srgbDecode,
|
|
16
21
|
srgbEncode
|
|
17
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-IRSTHLQQ.js";
|
|
23
|
+
import {
|
|
24
|
+
pngDataUrl
|
|
25
|
+
} from "./chunk-OTTT5N3K.js";
|
|
18
26
|
import {
|
|
19
27
|
TILE,
|
|
20
28
|
TiledSurface,
|
|
@@ -26,90 +34,6 @@ import {
|
|
|
26
34
|
tilesInRect
|
|
27
35
|
} from "./chunk-HVVR5PZW.js";
|
|
28
36
|
|
|
29
|
-
// src/paint/rand.ts
|
|
30
|
-
function mix32(h) {
|
|
31
|
-
h ^= h >>> 16;
|
|
32
|
-
h = Math.imul(h, 2246822507);
|
|
33
|
-
h ^= h >>> 13;
|
|
34
|
-
h = Math.imul(h, 3266489909);
|
|
35
|
-
h ^= h >>> 16;
|
|
36
|
-
return h >>> 0;
|
|
37
|
-
}
|
|
38
|
-
function hash2(x, y, salt) {
|
|
39
|
-
const h = mix32((Math.imul(x | 0, 668265261) ^ mix32((y | 0) + Math.imul(salt | 0, 374761393))) >>> 0);
|
|
40
|
-
return h / 4294967296;
|
|
41
|
-
}
|
|
42
|
-
function rand01(seed, index, stream) {
|
|
43
|
-
return hash2(index, stream, seed);
|
|
44
|
-
}
|
|
45
|
-
function randSigned(seed, index, stream) {
|
|
46
|
-
return rand01(seed, index, stream) * 2 - 1;
|
|
47
|
-
}
|
|
48
|
-
function seedFromString(text) {
|
|
49
|
-
let h = 2166136261;
|
|
50
|
-
for (let i = 0; i < text.length; i++) {
|
|
51
|
-
h ^= text.charCodeAt(i);
|
|
52
|
-
h = Math.imul(h, 16777619);
|
|
53
|
-
}
|
|
54
|
-
return mix32(h >>> 0);
|
|
55
|
-
}
|
|
56
|
-
var smooth = (t) => t * t * (3 - 2 * t);
|
|
57
|
-
var Lattice = class {
|
|
58
|
-
constructor(px, py, salt) {
|
|
59
|
-
this.px = px;
|
|
60
|
-
this.py = py;
|
|
61
|
-
this.values = new Float32Array(px * py);
|
|
62
|
-
for (let j = 0; j < py; j++) for (let i = 0; i < px; i++) this.values[j * px + i] = hash2(i, j, salt);
|
|
63
|
-
}
|
|
64
|
-
px;
|
|
65
|
-
py;
|
|
66
|
-
values;
|
|
67
|
-
/** Value noise at (x, y) in lattice cells; wraps every `px` / `py` cells. */
|
|
68
|
-
at(x, y) {
|
|
69
|
-
const { px, py } = this;
|
|
70
|
-
const x0 = Math.floor(x);
|
|
71
|
-
const y0 = Math.floor(y);
|
|
72
|
-
const tx = smooth(x - x0);
|
|
73
|
-
const ty = smooth(y - y0);
|
|
74
|
-
const i0 = (x0 % px + px) % px;
|
|
75
|
-
const j0 = (y0 % py + py) % py;
|
|
76
|
-
const i1 = (i0 + 1) % px;
|
|
77
|
-
const j1 = (j0 + 1) % py;
|
|
78
|
-
const v = this.values;
|
|
79
|
-
const a = v[j0 * px + i0] + (v[j0 * px + i1] - v[j0 * px + i0]) * tx;
|
|
80
|
-
const b = v[j1 * px + i0] + (v[j1 * px + i1] - v[j1 * px + i0]) * tx;
|
|
81
|
-
return a + (b - a) * ty;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
var TileableNoise = class {
|
|
85
|
-
constructor(size, cellsX, cellsY, octaves, salt) {
|
|
86
|
-
this.size = size;
|
|
87
|
-
let cx = Math.max(1, Math.round(cellsX));
|
|
88
|
-
let cy = Math.max(1, Math.round(cellsY));
|
|
89
|
-
for (let o = 0; o < octaves; o++) {
|
|
90
|
-
this.octaves.push(new Lattice(cx, cy, salt + o * 7919 | 0));
|
|
91
|
-
cx *= 2;
|
|
92
|
-
cy *= 2;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
size;
|
|
96
|
-
octaves = [];
|
|
97
|
-
/** Fractal noise at pixel (x, y). */
|
|
98
|
-
at(x, y) {
|
|
99
|
-
let sum = 0;
|
|
100
|
-
let amp = 1;
|
|
101
|
-
let norm = 0;
|
|
102
|
-
const u = x / this.size;
|
|
103
|
-
const v = y / this.size;
|
|
104
|
-
for (const l of this.octaves) {
|
|
105
|
-
sum += l.at(u * l.px, v * l.py) * amp;
|
|
106
|
-
norm += amp;
|
|
107
|
-
amp *= 0.5;
|
|
108
|
-
}
|
|
109
|
-
return norm > 0 ? sum / norm : 0.5;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
|
|
113
37
|
// src/paint/gradient-paint.ts
|
|
114
38
|
var PAINT_GRADIENT_SPACES = ["pigment", "oklab", "srgb"];
|
|
115
39
|
var PAINT_GRADIENT_REPEATS = ["clamp", "repeat", "mirror"];
|
|
@@ -2321,12 +2245,6 @@ function union(a, b) {
|
|
|
2321
2245
|
}
|
|
2322
2246
|
|
|
2323
2247
|
export {
|
|
2324
|
-
mix32,
|
|
2325
|
-
hash2,
|
|
2326
|
-
rand01,
|
|
2327
|
-
randSigned,
|
|
2328
|
-
seedFromString,
|
|
2329
|
-
TileableNoise,
|
|
2330
2248
|
PAINT_GRADIENT_SPACES,
|
|
2331
2249
|
PAINT_GRADIENT_REPEATS,
|
|
2332
2250
|
PAINT_GRADIENT_MAPPINGS,
|
|
@@ -26,7 +26,7 @@ var _chunkK6PXS6DOcjs = require('./chunk-K6PXS6DO.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunk2VX55NFMcjs = require('./chunk-2VX55NFM.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
@@ -232,7 +232,7 @@ function oneOf(r, key, path, values) {
|
|
|
232
232
|
if (typeof r[key] !== "string" || !values.includes(r[key])) fail(`${path}.${key}`, `must be one of ${values.join(", ")}.`);
|
|
233
233
|
}
|
|
234
234
|
function blend(r, key, path) {
|
|
235
|
-
if (!
|
|
235
|
+
if (!_chunk2VX55NFMcjs.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])}).`);
|
|
236
236
|
if (r[key] === "pigment") fail(`${path}.${key}`, "pigment is a layer blend mode only; effects cannot use it.");
|
|
237
237
|
}
|
|
238
238
|
function contour(v, path) {
|
|
@@ -1431,7 +1431,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1431
1431
|
rgbScratchS[0] = sr;
|
|
1432
1432
|
rgbScratchS[1] = sg;
|
|
1433
1433
|
rgbScratchS[2] = sb;
|
|
1434
|
-
|
|
1434
|
+
_chunk2VX55NFMcjs.mixPigmentRgb.call(void 0, rgbScratchB, rgbScratchS, sa / ao, rgbScratchM);
|
|
1435
1435
|
dst[i] = rgbScratchM[0];
|
|
1436
1436
|
dst[i + 1] = rgbScratchM[1];
|
|
1437
1437
|
dst[i + 2] = rgbScratchM[2];
|
|
@@ -1446,9 +1446,9 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1446
1446
|
m1 = sg;
|
|
1447
1447
|
m2 = sb;
|
|
1448
1448
|
} else if (separable) {
|
|
1449
|
-
m0 =
|
|
1450
|
-
m1 =
|
|
1451
|
-
m2 =
|
|
1449
|
+
m0 = _chunk2VX55NFMcjs.blendChannel.call(void 0, mode, b0, sr);
|
|
1450
|
+
m1 = _chunk2VX55NFMcjs.blendChannel.call(void 0, mode, b1, sg);
|
|
1451
|
+
m2 = _chunk2VX55NFMcjs.blendChannel.call(void 0, mode, b2, sb);
|
|
1452
1452
|
} else {
|
|
1453
1453
|
rgbScratchB[0] = b0;
|
|
1454
1454
|
rgbScratchB[1] = b1;
|
|
@@ -1456,7 +1456,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1456
1456
|
rgbScratchS[0] = sr;
|
|
1457
1457
|
rgbScratchS[1] = sg;
|
|
1458
1458
|
rgbScratchS[2] = sb;
|
|
1459
|
-
const m =
|
|
1459
|
+
const m = _chunk2VX55NFMcjs.blendRgb.call(void 0, mode, rgbScratchB, rgbScratchS);
|
|
1460
1460
|
m0 = m[0];
|
|
1461
1461
|
m1 = m[1];
|
|
1462
1462
|
m2 = m[2];
|
|
@@ -1470,7 +1470,7 @@ function compositeAt(dst, i, mode, separable, sr, sg, sb, sa) {
|
|
|
1470
1470
|
dst[i + 3] = ao;
|
|
1471
1471
|
}
|
|
1472
1472
|
function paint(dst, m, color2, mode, opacity) {
|
|
1473
|
-
const sep = mode !== "normal" &&
|
|
1473
|
+
const sep = mode !== "normal" && _chunk2VX55NFMcjs.isSeparableBlendMode.call(void 0, mode);
|
|
1474
1474
|
const c = [0, 0, 0, 1];
|
|
1475
1475
|
const n = m.length;
|
|
1476
1476
|
for (let i = 0; i < n; i++) {
|
|
@@ -1762,7 +1762,7 @@ function compositeLayerEffects(input) {
|
|
|
1762
1762
|
}
|
|
1763
1763
|
const premerge = !normalLike;
|
|
1764
1764
|
if (premerge) {
|
|
1765
|
-
const sep2 =
|
|
1765
|
+
const sep2 = _chunk2VX55NFMcjs.isSeparableBlendMode.call(void 0, input.blend);
|
|
1766
1766
|
for (let i = 0; i < n; i++) {
|
|
1767
1767
|
const p = i * 4;
|
|
1768
1768
|
const sr = lay[p];
|
|
@@ -1882,7 +1882,7 @@ function compositeLayerEffects(input) {
|
|
|
1882
1882
|
paintColor(work, fx(i, 1), e.shadowColor, e.shadowBlend, e.shadowOpacity);
|
|
1883
1883
|
}
|
|
1884
1884
|
const mode = premerge ? "normal" : input.blend;
|
|
1885
|
-
const sep =
|
|
1885
|
+
const sep = _chunk2VX55NFMcjs.isSeparableBlendMode.call(void 0, mode);
|
|
1886
1886
|
for (let i = 0; i < n; i++) {
|
|
1887
1887
|
const p = i * 4;
|
|
1888
1888
|
if (lay[p + 3] > 0) compositeAt(work, p, mode, sep, lay[p], lay[p + 1], lay[p + 2], lay[p + 3]);
|
|
@@ -1986,7 +1986,7 @@ function blendTile(dst, src, mode, alpha, coverage) {
|
|
|
1986
1986
|
if (!(alpha > 0)) return;
|
|
1987
1987
|
const normal = mode === "normal";
|
|
1988
1988
|
const pigment = mode === "pigment";
|
|
1989
|
-
const lut = !normal &&
|
|
1989
|
+
const lut = !normal && _chunk2VX55NFMcjs.isSeparableBlendMode.call(void 0, mode) ? separableLut(mode) : null;
|
|
1990
1990
|
const cb = [0, 0, 0];
|
|
1991
1991
|
const cs = [0, 0, 0];
|
|
1992
1992
|
const n = dst.length;
|
|
@@ -2013,7 +2013,7 @@ function blendTile(dst, src, mode, alpha, coverage) {
|
|
|
2013
2013
|
const d1 = dst[i + 1];
|
|
2014
2014
|
const d2 = dst[i + 2];
|
|
2015
2015
|
if (pigment) {
|
|
2016
|
-
|
|
2016
|
+
_chunk2VX55NFMcjs.mixPigment8.call(void 0, d0, d1, d2, src[i], src[i + 1], src[i + 2], as / ao, cb);
|
|
2017
2017
|
dst[i] = Math.round(cb[0] * 255);
|
|
2018
2018
|
dst[i + 1] = Math.round(cb[1] * 255);
|
|
2019
2019
|
dst[i + 2] = Math.round(cb[2] * 255);
|
|
@@ -2044,7 +2044,7 @@ function blendTile(dst, src, mode, alpha, coverage) {
|
|
|
2044
2044
|
cs[0] = s0;
|
|
2045
2045
|
cs[1] = s1;
|
|
2046
2046
|
cs[2] = s2;
|
|
2047
|
-
const m =
|
|
2047
|
+
const m = _chunk2VX55NFMcjs.blendRgb.call(void 0, mode, cb, cs);
|
|
2048
2048
|
m0 = m[0];
|
|
2049
2049
|
m1 = m[1];
|
|
2050
2050
|
m2 = m[2];
|
|
@@ -2063,7 +2063,7 @@ function separableLut(mode) {
|
|
|
2063
2063
|
let lut = separableLuts.get(mode);
|
|
2064
2064
|
if (!lut) {
|
|
2065
2065
|
lut = new Float64Array(65536);
|
|
2066
|
-
for (let b = 0; b < 256; b++) for (let c = 0; c < 256; c++) lut[b << 8 | c] =
|
|
2066
|
+
for (let b = 0; b < 256; b++) for (let c = 0; c < 256; c++) lut[b << 8 | c] = _chunk2VX55NFMcjs.blendChannel.call(void 0, mode, b / 255, c / 255);
|
|
2067
2067
|
separableLuts.set(mode, lut);
|
|
2068
2068
|
}
|
|
2069
2069
|
return lut;
|
|
@@ -2086,7 +2086,7 @@ var isGroup = (l) => l.type === "group";
|
|
|
2086
2086
|
var maskDepths = /* @__PURE__ */ new WeakMap();
|
|
2087
2087
|
function maskDepth(surface) {
|
|
2088
2088
|
let d = maskDepths.get(surface);
|
|
2089
|
-
if (d === void 0) maskDepths.set(surface, d =
|
|
2089
|
+
if (d === void 0) maskDepths.set(surface, d = _chunk2VX55NFMcjs.surfaceDepth.call(void 0, surface));
|
|
2090
2090
|
return d;
|
|
2091
2091
|
}
|
|
2092
2092
|
var RasterCompositor = (_class = class {
|
|
@@ -2799,7 +2799,7 @@ var RasterCompositor = (_class = class {
|
|
|
2799
2799
|
const rect = { x: r.x - ox, y: r.y - oy, width: r.width, height: r.height };
|
|
2800
2800
|
let all = true;
|
|
2801
2801
|
if (maskDepth(mask.surface) !== 8) {
|
|
2802
|
-
const d =
|
|
2802
|
+
const d = _chunk2VX55NFMcjs.readDeepRegion.call(void 0, mask.surface, rect, 32);
|
|
2803
2803
|
for (let i = 0; i < n; i++) {
|
|
2804
2804
|
const v = d[i] <= 0 ? 0 : d[i] >= 1 ? 1 : d[i];
|
|
2805
2805
|
out[i] = v;
|
|
@@ -3041,7 +3041,7 @@ var DeepCompositor = class {
|
|
|
3041
3041
|
const ambient = _nullishCoalesce(_optionalChain([layer, 'access', _66 => _66.edge, 'optionalAccess', _67 => _67.ambient]), () => ( 0));
|
|
3042
3042
|
if (ambient > 0) {
|
|
3043
3043
|
const c = _optionalChain([layer, 'access', _68 => _68.edge, 'optionalAccess', _69 => _69.ambientColor]);
|
|
3044
|
-
const color2 = c ? c.map((v) => this.linear ?
|
|
3044
|
+
const color2 = c ? c.map((v) => this.linear ? _chunk2VX55NFMcjs.srgbDecode.call(void 0, v / 255) : v / 255) : null;
|
|
3045
3045
|
if (color2 || !empty) applyEdgeAmbient(content, acc, coverage, ambient, color2, 1);
|
|
3046
3046
|
}
|
|
3047
3047
|
const alone = this.renderedAlone(layer);
|
|
@@ -3131,9 +3131,9 @@ var DeepCompositor = class {
|
|
|
3131
3131
|
}
|
|
3132
3132
|
if (!visible.length) return;
|
|
3133
3133
|
if (this.deep.applyFilterRunDeep) {
|
|
3134
|
-
if (this.linear) mapColour(acc,
|
|
3134
|
+
if (this.linear) mapColour(acc, _chunk2VX55NFMcjs.srgbEncode);
|
|
3135
3135
|
this.deep.applyFilterRunDeep(visible, acc, r, masks, this.sources);
|
|
3136
|
-
if (this.linear) mapColour(acc,
|
|
3136
|
+
if (this.linear) mapColour(acc, _chunk2VX55NFMcjs.srgbDecode);
|
|
3137
3137
|
return;
|
|
3138
3138
|
}
|
|
3139
3139
|
const bytes = this.to8(acc);
|
|
@@ -3199,7 +3199,7 @@ var DeepCompositor = class {
|
|
|
3199
3199
|
}
|
|
3200
3200
|
/** A surface's samples over `rect` (layer space) in the working space. */
|
|
3201
3201
|
samples(surface, rect) {
|
|
3202
|
-
const samples =
|
|
3202
|
+
const samples = _chunk2VX55NFMcjs.readDeepRegion.call(void 0, surface, rect, this.depth);
|
|
3203
3203
|
if (samples instanceof Float32Array) return samples;
|
|
3204
3204
|
const out = new Float32Array(samples.length);
|
|
3205
3205
|
for (let i = 0; i < samples.length; i++) out[i] = samples[i] / 65535;
|
|
@@ -3207,7 +3207,7 @@ var DeepCompositor = class {
|
|
|
3207
3207
|
}
|
|
3208
3208
|
/** 8-bit RGBA to the working space. */
|
|
3209
3209
|
from8(bytes) {
|
|
3210
|
-
if (this.linear) return
|
|
3210
|
+
if (this.linear) return _chunk2VX55NFMcjs.to32From8.call(void 0, bytes, 4);
|
|
3211
3211
|
const out = new Float32Array(bytes.length);
|
|
3212
3212
|
for (let i = 0; i < bytes.length; i++) out[i] = bytes[i] / 255;
|
|
3213
3213
|
return out;
|
|
@@ -3216,7 +3216,7 @@ var DeepCompositor = class {
|
|
|
3216
3216
|
to8(acc) {
|
|
3217
3217
|
const out = new Uint8ClampedArray(acc.length);
|
|
3218
3218
|
for (let i = 0; i < acc.length; i += 4) {
|
|
3219
|
-
for (let c = 0; c < 3; c++) out[i + c] = Math.round((this.linear ?
|
|
3219
|
+
for (let c = 0; c < 3; c++) out[i + c] = Math.round((this.linear ? _chunk2VX55NFMcjs.srgbEncode.call(void 0, acc[i + c]) : acc[i + c]) * 255);
|
|
3220
3220
|
out[i + 3] = Math.round(acc[i + 3] * 255);
|
|
3221
3221
|
}
|
|
3222
3222
|
return out;
|
|
@@ -3254,13 +3254,13 @@ var DeepCompositor = class {
|
|
|
3254
3254
|
cs[c] = src[i + c];
|
|
3255
3255
|
}
|
|
3256
3256
|
if (pigment) {
|
|
3257
|
-
if (this.linear) for (let c = 0; c < 3; c++) cb[c] =
|
|
3258
|
-
|
|
3259
|
-
for (let c = 0; c < 3; c++) dst[i + c] = this.linear ?
|
|
3257
|
+
if (this.linear) for (let c = 0; c < 3; c++) cb[c] = _chunk2VX55NFMcjs.srgbEncode.call(void 0, cb[c]), cs[c] = _chunk2VX55NFMcjs.srgbEncode.call(void 0, cs[c]);
|
|
3258
|
+
_chunk2VX55NFMcjs.mixPigmentRgb.call(void 0, cb, cs, as / ao, mix);
|
|
3259
|
+
for (let c = 0; c < 3; c++) dst[i + c] = this.linear ? _chunk2VX55NFMcjs.srgbDecode.call(void 0, mix[c]) : mix[c];
|
|
3260
3260
|
dst[i + 3] = ao;
|
|
3261
3261
|
continue;
|
|
3262
3262
|
}
|
|
3263
|
-
const m = normal ? cs :
|
|
3263
|
+
const m = normal ? cs : _chunk2VX55NFMcjs.blendRgb.call(void 0, mode, cb, cs);
|
|
3264
3264
|
const wb = (1 - as) * ab;
|
|
3265
3265
|
const ws = (1 - ab) * as;
|
|
3266
3266
|
const wm = as * ab;
|
|
@@ -3294,16 +3294,16 @@ function workingToSamples(data, depth) {
|
|
|
3294
3294
|
}
|
|
3295
3295
|
function encodeInPlace(d) {
|
|
3296
3296
|
for (let i = 0; i < d.length; i += 4) {
|
|
3297
|
-
d[i] =
|
|
3298
|
-
d[i + 1] =
|
|
3299
|
-
d[i + 2] =
|
|
3297
|
+
d[i] = _chunk2VX55NFMcjs.srgbEncode.call(void 0, d[i]);
|
|
3298
|
+
d[i + 1] = _chunk2VX55NFMcjs.srgbEncode.call(void 0, d[i + 1]);
|
|
3299
|
+
d[i + 2] = _chunk2VX55NFMcjs.srgbEncode.call(void 0, d[i + 2]);
|
|
3300
3300
|
}
|
|
3301
3301
|
}
|
|
3302
3302
|
function decodeInPlace(d) {
|
|
3303
3303
|
for (let i = 0; i < d.length; i += 4) {
|
|
3304
|
-
d[i] =
|
|
3305
|
-
d[i + 1] =
|
|
3306
|
-
d[i + 2] =
|
|
3304
|
+
d[i] = _chunk2VX55NFMcjs.srgbDecode.call(void 0, d[i]);
|
|
3305
|
+
d[i + 1] = _chunk2VX55NFMcjs.srgbDecode.call(void 0, d[i + 1]);
|
|
3306
|
+
d[i + 2] = _chunk2VX55NFMcjs.srgbDecode.call(void 0, d[i + 2]);
|
|
3307
3307
|
}
|
|
3308
3308
|
}
|
|
3309
3309
|
|
|
@@ -3582,11 +3582,11 @@ function store(out, o, acc, ch, def) {
|
|
|
3582
3582
|
}
|
|
3583
3583
|
function resampleDepth(src, step) {
|
|
3584
3584
|
if (src.channels !== 4 || src.defaultValue !== 0 || step !== 1) return null;
|
|
3585
|
-
const d =
|
|
3585
|
+
const d = _chunk2VX55NFMcjs.surfaceDepth.call(void 0, src);
|
|
3586
3586
|
return d === 8 ? null : d;
|
|
3587
3587
|
}
|
|
3588
3588
|
function readScaled(src, rect, depth) {
|
|
3589
|
-
const d =
|
|
3589
|
+
const d = _chunk2VX55NFMcjs.readDeepRegion.call(void 0, src, rect, depth);
|
|
3590
3590
|
const out = new Float32Array(d.length);
|
|
3591
3591
|
const k = depth === 16 ? 1 / 257 : 255;
|
|
3592
3592
|
for (let i = 0; i < d.length; i++) out[i] = d[i] * k;
|
|
@@ -3668,7 +3668,7 @@ function boxReduce(src, srcRect, kx, ky, depth = null) {
|
|
|
3668
3668
|
}
|
|
3669
3669
|
}
|
|
3670
3670
|
const region = { x: rx0, y: ry, width: rw, height: rows };
|
|
3671
|
-
out = depth ?
|
|
3671
|
+
out = depth ? _chunk2VX55NFMcjs.writeDeepRegion.call(void 0, out, region, fromScaled(red, depth)) : _chunk474IQG74cjs.writeRegion.call(void 0, out, region, red);
|
|
3672
3672
|
}
|
|
3673
3673
|
return { surface: out, rect };
|
|
3674
3674
|
}
|
|
@@ -3726,7 +3726,7 @@ function transformSurface(src, h, options = {}) {
|
|
|
3726
3726
|
const my = Math.round(dy);
|
|
3727
3727
|
const b = src.bounds;
|
|
3728
3728
|
if (depth && b && (mx % _chunk474IQG74cjs.TILE !== 0 || my % _chunk474IQG74cjs.TILE !== 0)) {
|
|
3729
|
-
return
|
|
3729
|
+
return _chunk2VX55NFMcjs.writeDeepRegion.call(void 0, _chunk474IQG74cjs.emptySurface.call(void 0, ch, def), { ...b, x: b.x + mx, y: b.y + my }, _chunk2VX55NFMcjs.readDeepRegion.call(void 0, src, b, depth));
|
|
3730
3730
|
}
|
|
3731
3731
|
return _chunk474IQG74cjs.translateSurface.call(void 0, src, mx, my);
|
|
3732
3732
|
}
|
|
@@ -3884,7 +3884,7 @@ function transformSurface(src, h, options = {}) {
|
|
|
3884
3884
|
}
|
|
3885
3885
|
}
|
|
3886
3886
|
if (!any) continue;
|
|
3887
|
-
const tile = deepOut ?
|
|
3887
|
+
const tile = deepOut ? _chunk2VX55NFMcjs.deepTile.call(void 0, fromScaled(deepOut, depth), 4, def) : _chunk474IQG74cjs.finishTile.call(void 0, out, ch, def);
|
|
3888
3888
|
if (tile) tiles.set(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty), tile);
|
|
3889
3889
|
}
|
|
3890
3890
|
return assemble(src, tiles);
|
|
@@ -4125,7 +4125,7 @@ function warpSurface(src, f, options = {}) {
|
|
|
4125
4125
|
}
|
|
4126
4126
|
}
|
|
4127
4127
|
if (!any) continue;
|
|
4128
|
-
const tile = deepOut ?
|
|
4128
|
+
const tile = deepOut ? _chunk2VX55NFMcjs.deepTile.call(void 0, fromScaled(deepOut, depth), 4, def) : _chunk474IQG74cjs.finishTile.call(void 0, out, ch, def);
|
|
4129
4129
|
if (tile) tiles.set(_chunk474IQG74cjs.tileKey.call(void 0, ttx, tty), tile);
|
|
4130
4130
|
}
|
|
4131
4131
|
}
|
|
@@ -4136,7 +4136,7 @@ function compositeSurfaceOver(base, top) {
|
|
|
4136
4136
|
if (!top.tiles.size) return base;
|
|
4137
4137
|
const ch = base.channels;
|
|
4138
4138
|
const tiles = new Map(base.tiles);
|
|
4139
|
-
const bd = ch === 4 && base.defaultValue === 0 ? Math.max(
|
|
4139
|
+
const bd = ch === 4 && base.defaultValue === 0 ? Math.max(_chunk2VX55NFMcjs.surfaceDepth.call(void 0, base), _chunk2VX55NFMcjs.surfaceDepth.call(void 0, top)) : 8;
|
|
4140
4140
|
const depth = bd === 8 ? null : bd;
|
|
4141
4141
|
for (const [key, t] of top.tiles) {
|
|
4142
4142
|
const under = base.tiles.get(key);
|
|
@@ -4146,8 +4146,8 @@ function compositeSurfaceOver(base, top) {
|
|
|
4146
4146
|
}
|
|
4147
4147
|
if (depth) {
|
|
4148
4148
|
const k = depth === 16 ? 65535 : 1;
|
|
4149
|
-
const d2 =
|
|
4150
|
-
const sd =
|
|
4149
|
+
const d2 = _chunk2VX55NFMcjs.tileSamples.call(void 0, under, 4, depth, 0).slice();
|
|
4150
|
+
const sd = _chunk2VX55NFMcjs.tileSamples.call(void 0, t, 4, depth, 0);
|
|
4151
4151
|
for (let i = 0; i < d2.length; i += 4) {
|
|
4152
4152
|
const ta = Math.min(1, sd[i + 3] / k);
|
|
4153
4153
|
if (ta <= 0) continue;
|
|
@@ -4159,7 +4159,7 @@ function compositeSurfaceOver(base, top) {
|
|
|
4159
4159
|
}
|
|
4160
4160
|
d2[i + 3] = depth === 16 ? Math.round(oa * k) : oa;
|
|
4161
4161
|
}
|
|
4162
|
-
const tile2 =
|
|
4162
|
+
const tile2 = _chunk2VX55NFMcjs.deepTile.call(void 0, d2, 4, 0);
|
|
4163
4163
|
if (tile2) tiles.set(key, tile2);
|
|
4164
4164
|
else tiles.delete(key);
|
|
4165
4165
|
continue;
|