@pixerate/editor 0.207.0 → 0.209.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animation-editor/index.cjs +60 -59
- package/dist/animation-editor/index.js +6 -5
- package/dist/{brushstrokeRender-7LXCU7PD.js → brushstrokeRender-C3UU6GVC.js} +5 -4
- package/dist/{brushstrokeRender-VO4ZTWVA.cjs → brushstrokeRender-EAJNE6WP.cjs} +12 -11
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-2N2QPO3H.js → chunk-2PBZBRP5.js} +9 -7
- package/dist/{chunk-7NW46N7I.cjs → chunk-3EHPLDFQ.cjs} +54 -52
- package/dist/{chunk-H367YTXI.js → chunk-42TWUPNJ.js} +13 -387
- package/dist/chunk-474IQG74.cjs +384 -0
- package/dist/{chunk-MLC7HUHO.js → chunk-BGOCAUXH.js} +1 -1
- package/dist/chunk-DWYQPL2A.js +2010 -0
- package/dist/{chunk-YXKLVD56.js → chunk-F7YA3MMC.js} +2 -2
- package/dist/{chunk-ZZGPYNS2.js → chunk-G4E6RUPC.js} +1 -1
- package/dist/chunk-HVVR5PZW.js +384 -0
- package/dist/{chunk-FR2Q2LVF.cjs → chunk-I7G3RSUJ.cjs} +35 -35
- package/dist/chunk-K6PXS6DO.cjs +102 -0
- package/dist/{chunk-ZIDUPSP4.js → chunk-KFIOEOCQ.js} +24 -761
- package/dist/{chunk-V7GWZIZK.cjs → chunk-KWNMBMKG.cjs} +23 -21
- package/dist/chunk-L3G23N5Y.js +763 -0
- package/dist/{chunk-GHCXLQ47.js → chunk-NDMXB4PR.js} +2 -2
- package/dist/{chunk-CWM3CUUX.cjs → chunk-OLNIPTB3.cjs} +39 -413
- package/dist/{chunk-EBDCRTZI.cjs → chunk-PQ3H2AAN.cjs} +92 -90
- package/dist/{chunk-BRKVNXDZ.cjs → chunk-QAUIZPYI.cjs} +7 -7
- package/dist/{chunk-UYXL6ZWQ.cjs → chunk-QE7D7TZR.cjs} +494 -1231
- package/dist/chunk-QYLWG22N.cjs +763 -0
- package/dist/{chunk-YQ5C5BVK.cjs → chunk-ROVK6AXX.cjs} +60 -60
- package/dist/{chunk-HGTDMKNE.cjs → chunk-UOGKSVRQ.cjs} +126 -221
- package/dist/{chunk-EL5PAHNP.js → chunk-USQCKRZG.js} +6 -4
- package/dist/{chunk-36OKQDCF.js → chunk-WJ2RBZMM.js} +5 -3
- package/dist/chunk-X4LUGTQX.cjs +2010 -0
- package/dist/{chunk-NQMP3CWF.js → chunk-YBJXCQTR.js} +15 -110
- package/dist/chunk-ZIF4UJJ6.js +102 -0
- package/dist/{chunk-WTW7QRTS.cjs → chunk-ZMHPQ6HP.cjs} +1 -1
- package/dist/image-editor/controller.d.cts +53 -5
- package/dist/image-editor/controller.d.ts +53 -5
- package/dist/image-editor/index.cjs +1806 -3356
- package/dist/image-editor/index.js +462 -2012
- package/dist/image-editor/selection/index.d.cts +1 -0
- package/dist/image-editor/selection/index.d.ts +1 -0
- package/dist/image-editor/selection/segment/focus.d.cts +2 -0
- package/dist/image-editor/selection/segment/focus.d.ts +2 -0
- package/dist/image-editor/selection/segment/grabcut.d.cts +4 -2
- package/dist/image-editor/selection/segment/grabcut.d.ts +4 -2
- package/dist/image-editor/selection/segment/sky.d.cts +2 -0
- package/dist/image-editor/selection/segment/sky.d.ts +2 -0
- package/dist/image-editor/selection/segment/subject.d.cts +2 -1
- package/dist/image-editor/selection/segment/subject.d.ts +2 -1
- package/dist/image-editor/selection/segment/work.d.cts +5 -0
- package/dist/image-editor/selection/segment/work.d.ts +5 -0
- package/dist/image-editor/selection/select-and-mask.d.cts +12 -2
- package/dist/image-editor/selection/select-and-mask.d.ts +12 -2
- package/dist/image-editor/selection/tool-options.d.cts +3 -1
- package/dist/image-editor/selection/tool-options.d.ts +3 -1
- package/dist/image-editor/selection/worker.d.cts +126 -0
- package/dist/image-editor/selection/worker.d.ts +126 -0
- package/dist/image-editor/selection-worker.cjs +14 -0
- package/dist/image-editor/selection-worker.d.cts +12 -0
- package/dist/image-editor/selection-worker.d.ts +12 -0
- package/dist/image-editor/selection-worker.js +14 -0
- package/dist/image-editor/types.d.cts +22 -0
- package/dist/image-editor/types.d.ts +22 -0
- package/dist/paint/index.cjs +6 -5
- package/dist/paint/index.js +5 -4
- package/dist/paint-editor/index.cjs +394 -390
- package/dist/paint-editor/index.js +18 -14
- package/dist/raster/index.cjs +22 -18
- package/dist/raster/index.js +29 -25
- package/dist/vector/index.cjs +986 -985
- package/dist/vector/index.js +6 -5
- package/package.json +11 -1
- package/skills/pixerate-image-editor/SKILL.md +1 -1
|
@@ -14,6 +14,7 @@ var _chunkYQGCPL5Xcjs = require('./chunk-YQGCPL5X.cjs');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
var _chunkOLNIPTB3cjs = require('./chunk-OLNIPTB3.cjs');
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
|
|
@@ -22,7 +23,8 @@ var _chunkYQGCPL5Xcjs = require('./chunk-YQGCPL5X.cjs');
|
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
|
|
27
|
+
var _chunk474IQG74cjs = require('./chunk-474IQG74.cjs');
|
|
26
28
|
|
|
27
29
|
// src/paint/rand.ts
|
|
28
30
|
function mix32(h) {
|
|
@@ -314,7 +316,7 @@ var PaintGradientSampler = class {
|
|
|
314
316
|
return out;
|
|
315
317
|
}
|
|
316
318
|
if (this.source.space === "pigment") {
|
|
317
|
-
|
|
319
|
+
_chunkOLNIPTB3cjs.mixPigment8.call(void 0, q8(ar[0]), q8(ar[1]), q8(ar[2]), q8(br[0]), q8(br[1]), q8(br[2]), v, mixScratch);
|
|
318
320
|
out.rgb = [mixScratch[0], mixScratch[1], mixScratch[2]];
|
|
319
321
|
} else if (this.source.space === "oklab") {
|
|
320
322
|
const la = a.lab;
|
|
@@ -798,7 +800,7 @@ function rasterizeDab(d, hardness, rect, out) {
|
|
|
798
800
|
}
|
|
799
801
|
}
|
|
800
802
|
}
|
|
801
|
-
var TILE_PIXELS =
|
|
803
|
+
var TILE_PIXELS = _chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE;
|
|
802
804
|
var CoverageMap = (_class3 = class {constructor() { _class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this); }
|
|
803
805
|
__init12() {this.tiles = /* @__PURE__ */ new Map()}
|
|
804
806
|
/**
|
|
@@ -811,21 +813,21 @@ var CoverageMap = (_class3 = class {constructor() { _class3.prototype.__init12.c
|
|
|
811
813
|
__init15() {this.dirty = /* @__PURE__ */ new Set()}
|
|
812
814
|
/** The colour at a pixel (gradient paint), or `null` when the stroke has one colour there. */
|
|
813
815
|
colorAt(x, y, out) {
|
|
814
|
-
const tx = Math.floor(x /
|
|
815
|
-
const ty = Math.floor(y /
|
|
816
|
-
const t = this.colors.get(
|
|
816
|
+
const tx = Math.floor(x / _chunk474IQG74cjs.TILE);
|
|
817
|
+
const ty = Math.floor(y / _chunk474IQG74cjs.TILE);
|
|
818
|
+
const t = this.colors.get(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty));
|
|
817
819
|
if (!t) return null;
|
|
818
|
-
const i = ((y - ty *
|
|
820
|
+
const i = ((y - ty * _chunk474IQG74cjs.TILE) * _chunk474IQG74cjs.TILE + (x - tx * _chunk474IQG74cjs.TILE)) * 3;
|
|
819
821
|
out[0] = t[i];
|
|
820
822
|
out[1] = t[i + 1];
|
|
821
823
|
out[2] = t[i + 2];
|
|
822
824
|
return out;
|
|
823
825
|
}
|
|
824
826
|
get(x, y) {
|
|
825
|
-
const tx = Math.floor(x /
|
|
826
|
-
const ty = Math.floor(y /
|
|
827
|
-
const t = this.tiles.get(
|
|
828
|
-
return t ? t[(y - ty *
|
|
827
|
+
const tx = Math.floor(x / _chunk474IQG74cjs.TILE);
|
|
828
|
+
const ty = Math.floor(y / _chunk474IQG74cjs.TILE);
|
|
829
|
+
const t = this.tiles.get(_chunk474IQG74cjs.tileKey.call(void 0, tx, ty));
|
|
830
|
+
return t ? t[(y - ty * _chunk474IQG74cjs.TILE) * _chunk474IQG74cjs.TILE + (x - tx * _chunk474IQG74cjs.TILE)] : 0;
|
|
829
831
|
}
|
|
830
832
|
/**
|
|
831
833
|
* Builds up `vals` (over `rect`) with flow towards `ceil`: `c ← c + v·(ceil − c)`. With `color`
|
|
@@ -835,26 +837,26 @@ var CoverageMap = (_class3 = class {constructor() { _class3.prototype.__init12.c
|
|
|
835
837
|
accumulate(rect, vals, ceil, color = null, field = null) {
|
|
836
838
|
if (rect.width <= 0 || rect.height <= 0) return;
|
|
837
839
|
const w = rect.width;
|
|
838
|
-
const tx0 = Math.floor(rect.x /
|
|
839
|
-
const ty0 = Math.floor(rect.y /
|
|
840
|
-
const tx1 = Math.floor((rect.x + rect.width - 1) /
|
|
841
|
-
const ty1 = Math.floor((rect.y + rect.height - 1) /
|
|
840
|
+
const tx0 = Math.floor(rect.x / _chunk474IQG74cjs.TILE);
|
|
841
|
+
const ty0 = Math.floor(rect.y / _chunk474IQG74cjs.TILE);
|
|
842
|
+
const tx1 = Math.floor((rect.x + rect.width - 1) / _chunk474IQG74cjs.TILE);
|
|
843
|
+
const ty1 = Math.floor((rect.y + rect.height - 1) / _chunk474IQG74cjs.TILE);
|
|
842
844
|
let touched = false;
|
|
843
845
|
for (let ty = ty0; ty <= ty1; ty++) {
|
|
844
846
|
for (let tx = tx0; tx <= tx1; tx++) {
|
|
845
|
-
const x0 = Math.max(rect.x, tx *
|
|
846
|
-
const y0 = Math.max(rect.y, ty *
|
|
847
|
-
const x1 = Math.min(rect.x + rect.width, tx *
|
|
848
|
-
const y1 = Math.min(rect.y + rect.height, ty *
|
|
847
|
+
const x0 = Math.max(rect.x, tx * _chunk474IQG74cjs.TILE);
|
|
848
|
+
const y0 = Math.max(rect.y, ty * _chunk474IQG74cjs.TILE);
|
|
849
|
+
const x1 = Math.min(rect.x + rect.width, tx * _chunk474IQG74cjs.TILE + _chunk474IQG74cjs.TILE);
|
|
850
|
+
const y1 = Math.min(rect.y + rect.height, ty * _chunk474IQG74cjs.TILE + _chunk474IQG74cjs.TILE);
|
|
849
851
|
let tile;
|
|
850
852
|
for (let y = y0; y < y1; y++) {
|
|
851
853
|
const row = (y - rect.y) * w;
|
|
852
|
-
const trow = (y - ty *
|
|
854
|
+
const trow = (y - ty * _chunk474IQG74cjs.TILE) * _chunk474IQG74cjs.TILE;
|
|
853
855
|
for (let x = x0; x < x1; x++) {
|
|
854
856
|
const v = vals[row + (x - rect.x)];
|
|
855
857
|
if (v <= 0) continue;
|
|
856
858
|
if (!tile) {
|
|
857
|
-
const key =
|
|
859
|
+
const key = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
|
|
858
860
|
tile = this.tiles.get(key);
|
|
859
861
|
if (!tile) {
|
|
860
862
|
tile = new Float32Array(TILE_PIXELS);
|
|
@@ -863,13 +865,13 @@ var CoverageMap = (_class3 = class {constructor() { _class3.prototype.__init12.c
|
|
|
863
865
|
this.dirty.add(key);
|
|
864
866
|
touched = true;
|
|
865
867
|
}
|
|
866
|
-
const ti = trow + (x - tx *
|
|
868
|
+
const ti = trow + (x - tx * _chunk474IQG74cjs.TILE);
|
|
867
869
|
const c = tile[ti];
|
|
868
870
|
if (ceil > c) {
|
|
869
871
|
const next = c + v * (ceil - c);
|
|
870
872
|
tile[ti] = next;
|
|
871
873
|
if (color || field) {
|
|
872
|
-
const key =
|
|
874
|
+
const key = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
|
|
873
875
|
let ct = this.colors.get(key);
|
|
874
876
|
if (!ct) {
|
|
875
877
|
ct = new Float32Array(TILE_PIXELS * 3);
|
|
@@ -994,29 +996,29 @@ function gradientDabColor(sampler, tipTable, d, params, rect, vals, scratch) {
|
|
|
994
996
|
}
|
|
995
997
|
function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}) {
|
|
996
998
|
const out = options.into ? new Uint8ClampedArray(options.into) : new Uint8ClampedArray(tileData);
|
|
997
|
-
const ox = tx *
|
|
998
|
-
const oy = ty *
|
|
999
|
+
const ox = tx * _chunk474IQG74cjs.TILE + s.offset.x;
|
|
1000
|
+
const oy = ty * _chunk474IQG74cjs.TILE + s.offset.y;
|
|
999
1001
|
let x0 = 0;
|
|
1000
1002
|
let y0 = 0;
|
|
1001
|
-
let x1 =
|
|
1002
|
-
let y1 =
|
|
1003
|
+
let x1 = _chunk474IQG74cjs.TILE;
|
|
1004
|
+
let y1 = _chunk474IQG74cjs.TILE;
|
|
1003
1005
|
if (options.region) {
|
|
1004
1006
|
const r = options.region;
|
|
1005
1007
|
x0 = Math.max(0, Math.floor(r.x) - ox);
|
|
1006
1008
|
y0 = Math.max(0, Math.floor(r.y) - oy);
|
|
1007
|
-
x1 = Math.min(
|
|
1008
|
-
y1 = Math.min(
|
|
1009
|
+
x1 = Math.min(_chunk474IQG74cjs.TILE, Math.ceil(r.x + r.width) - ox);
|
|
1010
|
+
y1 = Math.min(_chunk474IQG74cjs.TILE, Math.ceil(r.y + r.height) - oy);
|
|
1009
1011
|
if (x1 <= x0 || y1 <= y0) return out;
|
|
1010
1012
|
if (options.into) {
|
|
1011
|
-
for (let y = y0; y < y1; y++) out.set(tileData.subarray((y *
|
|
1013
|
+
for (let y = y0; y < y1; y++) out.set(tileData.subarray((y * _chunk474IQG74cjs.TILE + x0) * channels, (y * _chunk474IQG74cjs.TILE + x1) * channels), (y * _chunk474IQG74cjs.TILE + x0) * channels);
|
|
1012
1014
|
}
|
|
1013
1015
|
}
|
|
1014
1016
|
const sel = s.selection;
|
|
1015
1017
|
const cb = [0, 0, 0, 0];
|
|
1016
1018
|
const cs = [s.color[0] / 255, s.color[1] / 255, s.color[2] / 255, s.color[3] / 255];
|
|
1017
1019
|
const bg = [s.background[0] / 255, s.background[1] / 255, s.background[2] / 255, s.background[3] / 255];
|
|
1018
|
-
const aligned = s.offset.x %
|
|
1019
|
-
const covTile = aligned ? coverage.tiles.get(
|
|
1020
|
+
const aligned = s.offset.x % _chunk474IQG74cjs.TILE === 0 && s.offset.y % _chunk474IQG74cjs.TILE === 0;
|
|
1021
|
+
const covTile = aligned ? coverage.tiles.get(_chunk474IQG74cjs.tileKey.call(void 0, Math.floor(ox / _chunk474IQG74cjs.TILE), Math.floor(oy / _chunk474IQG74cjs.TILE))) : void 0;
|
|
1020
1022
|
if (aligned && !covTile) return out;
|
|
1021
1023
|
const colored = s.mode === "paint" && coverage.colors.size > 0;
|
|
1022
1024
|
const own = [0, 0, 0, cs[3]];
|
|
@@ -1025,7 +1027,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
1025
1027
|
const dy = oy + y;
|
|
1026
1028
|
for (let x = x0; x < x1; x++) {
|
|
1027
1029
|
const dx = ox + x;
|
|
1028
|
-
const c = covTile ? covTile[y *
|
|
1030
|
+
const c = covTile ? covTile[y * _chunk474IQG74cjs.TILE + x] : coverage.get(dx, dy);
|
|
1029
1031
|
if (c <= 0) continue;
|
|
1030
1032
|
const pixelColor = colored ? coverage.colorAt(dx, dy, own) : null;
|
|
1031
1033
|
if (pixelColor) for (let ch = 0; ch < 3; ch++) ownBytes[ch] = Math.round(Math.min(1, Math.max(0, own[ch])) * 255);
|
|
@@ -1036,7 +1038,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
1036
1038
|
}
|
|
1037
1039
|
if (k > 1) k = 1;
|
|
1038
1040
|
if (k <= 0) continue;
|
|
1039
|
-
const p = y *
|
|
1041
|
+
const p = y * _chunk474IQG74cjs.TILE + x;
|
|
1040
1042
|
if (channels === 1) {
|
|
1041
1043
|
const target = s.mode === "erase" ? s.background[0] : pixelColor ? Math.round(0.299 * ownBytes[0] + 0.587 * ownBytes[1] + 0.114 * ownBytes[2]) : s.color[0];
|
|
1042
1044
|
out[p] = Math.round(out[p] + (target - out[p]) * k);
|
|
@@ -1054,7 +1056,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
1054
1056
|
const as = src[3] * k;
|
|
1055
1057
|
if (!(as > 0)) continue;
|
|
1056
1058
|
const ao = as + out[i + 3] / 255 * (1 - as);
|
|
1057
|
-
|
|
1059
|
+
_chunkOLNIPTB3cjs.mixPigment8.call(void 0, out[i], out[i + 1], out[i + 2], bytes[0], bytes[1], bytes[2], as / ao, cb);
|
|
1058
1060
|
out[i] = Math.round(cb[0] * 255);
|
|
1059
1061
|
out[i + 1] = Math.round(cb[1] * 255);
|
|
1060
1062
|
out[i + 2] = Math.round(cb[2] * 255);
|
|
@@ -1062,7 +1064,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
1062
1064
|
continue;
|
|
1063
1065
|
}
|
|
1064
1066
|
for (let ch = 0; ch < 4; ch++) cb[ch] = out[i + ch] / 255;
|
|
1065
|
-
const o =
|
|
1067
|
+
const o = _chunkOLNIPTB3cjs.blendPixel.call(void 0, s.blend, cb, src, k);
|
|
1066
1068
|
out[i] = Math.round(o[0] * 255);
|
|
1067
1069
|
out[i + 1] = Math.round(o[1] * 255);
|
|
1068
1070
|
out[i + 2] = Math.round(o[2] * 255);
|
|
@@ -1076,25 +1078,25 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1076
1078
|
const scale = linear ? 1 : 65535;
|
|
1077
1079
|
const n = _nullishCoalesce(options.channels, () => ( 4));
|
|
1078
1080
|
const out = (_nullishCoalesce(options.into, () => ( samples))).slice();
|
|
1079
|
-
const ox = tx *
|
|
1080
|
-
const oy = ty *
|
|
1081
|
+
const ox = tx * _chunk474IQG74cjs.TILE + s.offset.x;
|
|
1082
|
+
const oy = ty * _chunk474IQG74cjs.TILE + s.offset.y;
|
|
1081
1083
|
let x0 = 0;
|
|
1082
1084
|
let y0 = 0;
|
|
1083
|
-
let x1 =
|
|
1084
|
-
let y1 =
|
|
1085
|
+
let x1 = _chunk474IQG74cjs.TILE;
|
|
1086
|
+
let y1 = _chunk474IQG74cjs.TILE;
|
|
1085
1087
|
if (options.region) {
|
|
1086
1088
|
const r = options.region;
|
|
1087
1089
|
x0 = Math.max(0, Math.floor(r.x) - ox);
|
|
1088
1090
|
y0 = Math.max(0, Math.floor(r.y) - oy);
|
|
1089
|
-
x1 = Math.min(
|
|
1090
|
-
y1 = Math.min(
|
|
1091
|
+
x1 = Math.min(_chunk474IQG74cjs.TILE, Math.ceil(r.x + r.width) - ox);
|
|
1092
|
+
y1 = Math.min(_chunk474IQG74cjs.TILE, Math.ceil(r.y + r.height) - oy);
|
|
1091
1093
|
if (x1 <= x0 || y1 <= y0) return out;
|
|
1092
|
-
if (options.into) for (let y = y0; y < y1; y++) out.set(samples.subarray((y *
|
|
1094
|
+
if (options.into) for (let y = y0; y < y1; y++) out.set(samples.subarray((y * _chunk474IQG74cjs.TILE + x0) * n, (y * _chunk474IQG74cjs.TILE + x1) * n), (y * _chunk474IQG74cjs.TILE + x0) * n);
|
|
1093
1095
|
}
|
|
1094
1096
|
const grey = (s.mode === "erase" ? s.background[0] : s.color[0]) / 255 * scale;
|
|
1095
1097
|
const colour = (c) => {
|
|
1096
1098
|
const v = [c[0] / 255, c[1] / 255, c[2] / 255, c[3] / 255];
|
|
1097
|
-
if (linear) for (let k = 0; k < 3; k++) v[k] =
|
|
1099
|
+
if (linear) for (let k = 0; k < 3; k++) v[k] = _chunkOLNIPTB3cjs.srgbDecode.call(void 0, v[k]);
|
|
1098
1100
|
return v;
|
|
1099
1101
|
};
|
|
1100
1102
|
const src0 = colour(s.mode === "erase" ? s.background : s.color);
|
|
@@ -1106,7 +1108,7 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1106
1108
|
const cb = [0, 0, 0, 0];
|
|
1107
1109
|
const mix = [0, 0, 0];
|
|
1108
1110
|
const encCb = [0, 0, 0];
|
|
1109
|
-
const encSrc0 = linear ? [
|
|
1111
|
+
const encSrc0 = linear ? [_chunkOLNIPTB3cjs.srgbEncode.call(void 0, src0[0]), _chunkOLNIPTB3cjs.srgbEncode.call(void 0, src0[1]), _chunkOLNIPTB3cjs.srgbEncode.call(void 0, src0[2])] : src0;
|
|
1110
1112
|
const put = (i, v) => {
|
|
1111
1113
|
out[i] = linear ? v : v <= 0 ? 0 : v >= 1 ? 65535 : Math.round(v * 65535);
|
|
1112
1114
|
};
|
|
@@ -1126,17 +1128,17 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1126
1128
|
if (k <= 0) continue;
|
|
1127
1129
|
src = src0;
|
|
1128
1130
|
if (pixelColor) {
|
|
1129
|
-
for (let ch = 0; ch < 3; ch++) ownSrc[ch] = linear ?
|
|
1131
|
+
for (let ch = 0; ch < 3; ch++) ownSrc[ch] = linear ? _chunkOLNIPTB3cjs.srgbDecode.call(void 0, own[ch]) : own[ch];
|
|
1130
1132
|
src = ownSrc;
|
|
1131
1133
|
}
|
|
1132
1134
|
if (n === 1) {
|
|
1133
|
-
const p = y *
|
|
1135
|
+
const p = y * _chunk474IQG74cjs.TILE + x;
|
|
1134
1136
|
const g = pixelColor ? (0.299 * own[0] + 0.587 * own[1] + 0.114 * own[2]) * scale : grey;
|
|
1135
1137
|
const v = out[p] + (g - out[p]) * k;
|
|
1136
1138
|
out[p] = linear ? v : Math.round(v);
|
|
1137
1139
|
continue;
|
|
1138
1140
|
}
|
|
1139
|
-
const i = (y *
|
|
1141
|
+
const i = (y * _chunk474IQG74cjs.TILE + x) * 4;
|
|
1140
1142
|
if (s.mode === "erase" && !s.lockTransparency) {
|
|
1141
1143
|
put(i + 3, out[i + 3] / scale * (1 - k));
|
|
1142
1144
|
if (out[i + 3] === 0) out[i] = out[i + 1] = out[i + 2] = 0;
|
|
@@ -1148,13 +1150,13 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1148
1150
|
const as = src[3] * k;
|
|
1149
1151
|
if (!(as > 0)) continue;
|
|
1150
1152
|
const ao = as + cb[3] * (1 - as);
|
|
1151
|
-
for (let ch = 0; ch < 3; ch++) encCb[ch] = linear ?
|
|
1152
|
-
|
|
1153
|
-
for (let ch = 0; ch < 3; ch++) put(i + ch, linear ?
|
|
1153
|
+
for (let ch = 0; ch < 3; ch++) encCb[ch] = linear ? _chunkOLNIPTB3cjs.srgbEncode.call(void 0, cb[ch]) : cb[ch];
|
|
1154
|
+
_chunkOLNIPTB3cjs.mixPigmentRgb.call(void 0, encCb, pixelColor ? own : encSrc0, as / ao, mix);
|
|
1155
|
+
for (let ch = 0; ch < 3; ch++) put(i + ch, linear ? _chunkOLNIPTB3cjs.srgbDecode.call(void 0, mix[ch]) : mix[ch]);
|
|
1154
1156
|
if (!s.lockTransparency) put(i + 3, ao);
|
|
1155
1157
|
continue;
|
|
1156
1158
|
}
|
|
1157
|
-
const o =
|
|
1159
|
+
const o = _chunkOLNIPTB3cjs.blendPixel.call(void 0, s.blend, cb, src, k);
|
|
1158
1160
|
put(i, o[0]);
|
|
1159
1161
|
put(i + 1, o[1]);
|
|
1160
1162
|
put(i + 2, o[2]);
|
|
@@ -1164,7 +1166,7 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1164
1166
|
return out;
|
|
1165
1167
|
}
|
|
1166
1168
|
function coverageTileCoord(key) {
|
|
1167
|
-
return
|
|
1169
|
+
return _chunk474IQG74cjs.tileCoord.call(void 0, key);
|
|
1168
1170
|
}
|
|
1169
1171
|
|
|
1170
1172
|
// src/paint/grain.ts
|
|
@@ -1465,10 +1467,10 @@ function pathStrokeCoverage(samples, options) {
|
|
|
1465
1467
|
if (grain && grain.depth > 0 && dabs.length) {
|
|
1466
1468
|
const pressure = dabs.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'access', _17 => _17.params, 'optionalAccess', _18 => _18.pressure]), () => ( 1))), 0) / dabs.length;
|
|
1467
1469
|
for (const [key, t] of coverage.tiles) {
|
|
1468
|
-
const { tx, ty } =
|
|
1469
|
-
for (let y = 0, k = 0; y <
|
|
1470
|
-
const gy = ty *
|
|
1471
|
-
for (let x = 0; x <
|
|
1470
|
+
const { tx, ty } = _chunk474IQG74cjs.tileCoord.call(void 0, key);
|
|
1471
|
+
for (let y = 0, k = 0; y < _chunk474IQG74cjs.TILE; y++) {
|
|
1472
|
+
const gy = ty * _chunk474IQG74cjs.TILE + y + 0.5;
|
|
1473
|
+
for (let x = 0; x < _chunk474IQG74cjs.TILE; x++, k++) if (t[k] > 0) t[k] *= strokeGrainCatch(grain.at(tx * _chunk474IQG74cjs.TILE + x + 0.5, gy), grain.depth, pressure);
|
|
1472
1474
|
}
|
|
1473
1475
|
}
|
|
1474
1476
|
}
|
|
@@ -1498,15 +1500,15 @@ function paintPathStroke(surface, samples, options) {
|
|
|
1498
1500
|
offset
|
|
1499
1501
|
};
|
|
1500
1502
|
const tiles = new Map(surface.tiles);
|
|
1501
|
-
for (const { tx, ty } of
|
|
1502
|
-
const key =
|
|
1503
|
+
for (const { tx, ty } of _chunk474IQG74cjs.tilesInRect.call(void 0, { x: bounds.x - offset.x, y: bounds.y - offset.y, width: bounds.width, height: bounds.height })) {
|
|
1504
|
+
const key = _chunk474IQG74cjs.tileKey.call(void 0, tx, ty);
|
|
1503
1505
|
const src = _optionalChain([surface, 'access', _25 => _25.tiles, 'access', _26 => _26.get, 'call', _27 => _27(key), 'optionalAccess', _28 => _28.data]);
|
|
1504
|
-
const base = src && src.length ===
|
|
1505
|
-
const t =
|
|
1506
|
+
const base = src && src.length === _chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4 ? src : new Uint8ClampedArray(_chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE * 4);
|
|
1507
|
+
const t = _chunk474IQG74cjs.finishTile.call(void 0, applyStrokeToTile(coverage, base, 4, tx, ty, apply), 4, surface.defaultValue);
|
|
1506
1508
|
if (t) tiles.set(key, t);
|
|
1507
1509
|
else tiles.delete(key);
|
|
1508
1510
|
}
|
|
1509
|
-
return { surface: new (0,
|
|
1511
|
+
return { surface: new (0, _chunk474IQG74cjs.TiledSurface)(4, tiles, surface.defaultValue), bounds, dabs };
|
|
1510
1512
|
}
|
|
1511
1513
|
|
|
1512
1514
|
// src/paint/brushstroke.ts
|
|
@@ -1626,7 +1628,7 @@ function renderBrushstroke(input, brush, options = {}) {
|
|
|
1626
1628
|
}
|
|
1627
1629
|
character = { ...jitter ? { jitter } : {}, ...grain ? { grain } : {} };
|
|
1628
1630
|
}
|
|
1629
|
-
const { surface, bounds, dabs } = paintPathStroke(
|
|
1631
|
+
const { surface, bounds, dabs } = paintPathStroke(_chunk474IQG74cjs.emptySurface.call(void 0, 4), scaled, {
|
|
1630
1632
|
...strokeOptions,
|
|
1631
1633
|
...character,
|
|
1632
1634
|
brush: { ...tip, size: tip.size * scale },
|
|
@@ -1637,7 +1639,7 @@ function renderBrushstroke(input, brush, options = {}) {
|
|
|
1637
1639
|
});
|
|
1638
1640
|
if (!bounds) return { image: { width: 0, height: 0, data: new Uint8ClampedArray(0) }, bounds: null, scale, dabs };
|
|
1639
1641
|
const rect = bounds;
|
|
1640
|
-
const data =
|
|
1642
|
+
const data = _chunk474IQG74cjs.readRegion.call(void 0, surface, rect);
|
|
1641
1643
|
return {
|
|
1642
1644
|
image: { width: rect.width, height: rect.height, data },
|
|
1643
1645
|
bounds: { x: rect.x / scale, y: rect.y / scale, width: rect.width / scale, height: rect.height / scale },
|
|
@@ -1647,7 +1649,7 @@ function renderBrushstroke(input, brush, options = {}) {
|
|
|
1647
1649
|
}
|
|
1648
1650
|
function brushstrokeDataUrl(stroke) {
|
|
1649
1651
|
const { width, height, data } = stroke.image;
|
|
1650
|
-
return width && height ?
|
|
1652
|
+
return width && height ? _chunkOLNIPTB3cjs.pngDataUrl.call(void 0, width, height, data) : "";
|
|
1651
1653
|
}
|
|
1652
1654
|
function brushstrokeToCanvas(stroke, createCanvas) {
|
|
1653
1655
|
const { width, height, data } = stroke.image;
|
|
@@ -1720,7 +1722,7 @@ var PaintExchange = (_class7 = class {
|
|
|
1720
1722
|
this.reservoir = load.reservoir ? [load.reservoir[0], load.reservoir[1], load.reservoir[2]] : null;
|
|
1721
1723
|
this.amount = this.reservoir ? Math.min(1, Math.max(0, load.amount)) : 0;
|
|
1722
1724
|
this.well = load.pickup ? [load.pickup[0], load.pickup[1], load.pickup[2]] : null;
|
|
1723
|
-
this.pig = rates.mixing === "pigment" ? { res:
|
|
1725
|
+
this.pig = rates.mixing === "pigment" ? { res: _chunkOLNIPTB3cjs.createPigment.call(void 0, _nullishCoalesce(this.reservoir, () => ( [0, 0, 0]))), well: _chunkOLNIPTB3cjs.createPigment.call(void 0, _nullishCoalesce(this.well, () => ( [0, 0, 0]))), paint: _chunkOLNIPTB3cjs.createPigment.call(void 0, [0, 0, 0]), canvas: _chunkOLNIPTB3cjs.createPigment.call(void 0, [0, 0, 0]) } : null;
|
|
1724
1726
|
}
|
|
1725
1727
|
|
|
1726
1728
|
|
|
@@ -1750,21 +1752,21 @@ var PaintExchange = (_class7 = class {
|
|
|
1750
1752
|
this.reservoir[1] = g;
|
|
1751
1753
|
this.reservoir[2] = b;
|
|
1752
1754
|
}
|
|
1753
|
-
if (this.pig)
|
|
1755
|
+
if (this.pig) _chunkOLNIPTB3cjs.setPigmentColor.call(void 0, this.pig.res, r, g, b);
|
|
1754
1756
|
}
|
|
1755
1757
|
/** `a` mixed `t` of the way to `b` into `this.out`, by the mixing model. */
|
|
1756
1758
|
mix(a, pa, b, pb, t) {
|
|
1757
1759
|
const o = this.out;
|
|
1758
|
-
if (pa && pb)
|
|
1760
|
+
if (pa && pb) _chunkOLNIPTB3cjs.lerpPigmentInto.call(void 0, pa, pb, t, o, 0);
|
|
1759
1761
|
else for (let c = 0; c < 3; c++) o[c] = a[c] + (b[c] - a[c]) * t;
|
|
1760
1762
|
return o;
|
|
1761
1763
|
}
|
|
1762
1764
|
/** `a` mixed `t` of the way to `b` (sRGB 0..1) by the mixing model, into `out`. */
|
|
1763
1765
|
mixColors(a, b, t, out) {
|
|
1764
1766
|
if (this.pig) {
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1767
|
+
_chunkOLNIPTB3cjs.setPigmentColor.call(void 0, this.pig.canvas, a[0], a[1], a[2]);
|
|
1768
|
+
_chunkOLNIPTB3cjs.setPigmentColor.call(void 0, this.pig.paint, b[0], b[1], b[2]);
|
|
1769
|
+
_chunkOLNIPTB3cjs.lerpPigmentInto.call(void 0, this.pig.canvas, this.pig.paint, t, out, 0);
|
|
1768
1770
|
} else for (let c = 0; c < 3; c++) out[c] = a[c] + (b[c] - a[c]) * t;
|
|
1769
1771
|
return out;
|
|
1770
1772
|
}
|
|
@@ -1774,11 +1776,11 @@ var PaintExchange = (_class7 = class {
|
|
|
1774
1776
|
const pig = this.pig;
|
|
1775
1777
|
if (!this.well) this.well = [sample.rgb[0], sample.rgb[1], sample.rgb[2]];
|
|
1776
1778
|
else {
|
|
1777
|
-
if (pig)
|
|
1779
|
+
if (pig) _chunkOLNIPTB3cjs.setPigmentColor.call(void 0, pig.canvas, sample.rgb[0], sample.rgb[1], sample.rgb[2]);
|
|
1778
1780
|
const o = this.mix(this.well, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _37 => _37.well]), () => ( null)), sample.rgb, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _38 => _38.canvas]), () => ( null)), this.rates.pickup * sample.contact);
|
|
1779
1781
|
this.well = [o[0], o[1], o[2]];
|
|
1780
1782
|
}
|
|
1781
|
-
if (pig)
|
|
1783
|
+
if (pig) _chunkOLNIPTB3cjs.setPigmentColor.call(void 0, pig.well, this.well[0], this.well[1], this.well[2]);
|
|
1782
1784
|
}
|
|
1783
1785
|
/**
|
|
1784
1786
|
* 2. The dab's paint: the reservoir mixed with the well, written to `out`. Returns the total
|
|
@@ -1803,7 +1805,7 @@ var PaintExchange = (_class7 = class {
|
|
|
1803
1805
|
out[1] = c[1];
|
|
1804
1806
|
out[2] = c[2];
|
|
1805
1807
|
}
|
|
1806
|
-
if (pig)
|
|
1808
|
+
if (pig) _chunkOLNIPTB3cjs.setPigmentColor.call(void 0, pig.paint, out[0], out[1], out[2]);
|
|
1807
1809
|
return total;
|
|
1808
1810
|
}
|
|
1809
1811
|
/** 3. The reservoir drains. */
|
|
@@ -1827,8 +1829,8 @@ var TileMedium = (_class8 = class {
|
|
|
1827
1829
|
__init27() {this.ty = NaN}
|
|
1828
1830
|
__init28() {this.tile = null}
|
|
1829
1831
|
__init29() {this.writable = false}
|
|
1830
|
-
__init30() {this.canvasPig =
|
|
1831
|
-
__init31() {this.paintPig =
|
|
1832
|
+
__init30() {this.canvasPig = _chunkOLNIPTB3cjs.createPigment.call(void 0, [0, 0, 0])}
|
|
1833
|
+
__init31() {this.paintPig = _chunkOLNIPTB3cjs.createPigment.call(void 0, [0, 0, 0])}
|
|
1832
1834
|
__init32() {this.paintKey = -1}
|
|
1833
1835
|
__init33() {this.cb = [0, 0, 0, 0]}
|
|
1834
1836
|
__init34() {this.src = [0, 0, 0, 1]}
|
|
@@ -1845,15 +1847,15 @@ var TileMedium = (_class8 = class {
|
|
|
1845
1847
|
const t = this.target;
|
|
1846
1848
|
const lx = dx - t.offset.x;
|
|
1847
1849
|
const ly = dy - t.offset.y;
|
|
1848
|
-
const tx = Math.floor(lx /
|
|
1849
|
-
const ty = Math.floor(ly /
|
|
1850
|
+
const tx = Math.floor(lx / _chunk474IQG74cjs.TILE);
|
|
1851
|
+
const ty = Math.floor(ly / _chunk474IQG74cjs.TILE);
|
|
1850
1852
|
if (tx !== this.tx || ty !== this.ty || write && !this.writable) {
|
|
1851
1853
|
this.tx = tx;
|
|
1852
1854
|
this.ty = ty;
|
|
1853
1855
|
this.tile = write ? t.writeTile(tx, ty) : t.readTile(tx, ty);
|
|
1854
1856
|
this.writable = write;
|
|
1855
1857
|
}
|
|
1856
|
-
return this.tile ? ((ly - ty *
|
|
1858
|
+
return this.tile ? ((ly - ty * _chunk474IQG74cjs.TILE) * _chunk474IQG74cjs.TILE + (lx - tx * _chunk474IQG74cjs.TILE)) * 4 : -1;
|
|
1857
1859
|
}
|
|
1858
1860
|
/** The tile `locate` last found. */
|
|
1859
1861
|
get pixels() {
|
|
@@ -1933,7 +1935,7 @@ var TileMedium = (_class8 = class {
|
|
|
1933
1935
|
src[0] = pr;
|
|
1934
1936
|
src[1] = pg;
|
|
1935
1937
|
src[2] = pb;
|
|
1936
|
-
const r =
|
|
1938
|
+
const r = _chunkOLNIPTB3cjs.blendPixel.call(void 0, blend, cb, src, k);
|
|
1937
1939
|
put255(px, i, r[0]);
|
|
1938
1940
|
put255(px, i + 1, r[1]);
|
|
1939
1941
|
put255(px, i + 2, r[2]);
|
|
@@ -1948,23 +1950,23 @@ var TileMedium = (_class8 = class {
|
|
|
1948
1950
|
o[1] = pg;
|
|
1949
1951
|
o[2] = pb;
|
|
1950
1952
|
} else if (pigment && field) {
|
|
1951
|
-
|
|
1953
|
+
_chunkOLNIPTB3cjs.mixPigment8.call(void 0, Math.round(px[i]), Math.round(px[i + 1]), Math.round(px[i + 2]), Math.round(pr * 255), Math.round(pg * 255), Math.round(pb * 255), share, o);
|
|
1952
1954
|
} else if (pigment) {
|
|
1953
1955
|
const key = px instanceof Float32Array ? -2 : px[i] << 16 | px[i + 1] << 8 | px[i + 2];
|
|
1954
1956
|
if (key !== lastKey || key === -2) {
|
|
1955
|
-
|
|
1957
|
+
_chunkOLNIPTB3cjs.setPigmentColor.call(void 0, this.canvasPig, px[i] / 255, px[i + 1] / 255, px[i + 2] / 255);
|
|
1956
1958
|
lastKey = key;
|
|
1957
1959
|
}
|
|
1958
1960
|
let pp = paintPigment;
|
|
1959
1961
|
if (!pp) {
|
|
1960
1962
|
const pkey = Math.round(pr * 255) << 16 | Math.round(pg * 255) << 8 | Math.round(pb * 255);
|
|
1961
1963
|
if (pkey !== this.paintKey) {
|
|
1962
|
-
|
|
1964
|
+
_chunkOLNIPTB3cjs.setPigmentColor.call(void 0, this.paintPig, pr, pg, pb);
|
|
1963
1965
|
this.paintKey = pkey;
|
|
1964
1966
|
}
|
|
1965
1967
|
pp = this.paintPig;
|
|
1966
1968
|
}
|
|
1967
|
-
|
|
1969
|
+
_chunkOLNIPTB3cjs.lerpPigmentInto.call(void 0, this.canvasPig, pp, share, o, 0);
|
|
1968
1970
|
} else {
|
|
1969
1971
|
o[0] = px[i] / 255 + (pr - px[i] / 255) * share;
|
|
1970
1972
|
o[1] = px[i + 1] / 255 + (pg - px[i + 1] / 255) * share;
|
|
@@ -1993,9 +1995,9 @@ function blendRadius(settings, radius) {
|
|
|
1993
1995
|
return Math.max(1, Math.round(settings.distance * 2 * radius));
|
|
1994
1996
|
}
|
|
1995
1997
|
function createBlenderScratch() {
|
|
1996
|
-
return { sums: new Float64Array(0), mix: { rgb: [0, 0, 0], strength: 1, ks: new Float32Array(
|
|
1998
|
+
return { sums: new Float64Array(0), mix: { rgb: [0, 0, 0], strength: 1, ks: new Float32Array(_chunkOLNIPTB3cjs.PIGMENT_BANDS), scatter: 1 }, out: [0, 0, 0] };
|
|
1997
1999
|
}
|
|
1998
|
-
var N =
|
|
2000
|
+
var N = _chunkOLNIPTB3cjs.PIGMENT_BANDS;
|
|
1999
2001
|
function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
2000
2002
|
const R = blendRadius(settings, radius);
|
|
2001
2003
|
const W = rect.width + 2 * R;
|
|
@@ -2020,7 +2022,7 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
|
2020
2022
|
const a = px[i + 3] / 255;
|
|
2021
2023
|
if (a > 0) {
|
|
2022
2024
|
if (pigment) {
|
|
2023
|
-
const p =
|
|
2025
|
+
const p = _chunkOLNIPTB3cjs.pigment8.call(void 0, Math.round(px[i]), Math.round(px[i + 1]), Math.round(px[i + 2]));
|
|
2024
2026
|
const sa = p.scatter * p.strength * a;
|
|
2025
2027
|
for (let k = 0; k < N; k++) row[k] += sa * p.ks[k];
|
|
2026
2028
|
row[N] += sa;
|
|
@@ -2078,8 +2080,8 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
|
2078
2080
|
const sa = sum(N, x1, y1, x2, y2);
|
|
2079
2081
|
for (let c = 0; c < N; c++) mixPig.ks[c] = sum(c, x1, y1, x2, y2) / sa;
|
|
2080
2082
|
mixPig.scatter = sa / asum;
|
|
2081
|
-
if (a <= 0 || share >= 1)
|
|
2082
|
-
else
|
|
2083
|
+
if (a <= 0 || share >= 1) _chunkOLNIPTB3cjs.lerpPigmentInto.call(void 0, mixPig, mixPig, 0, out, 0);
|
|
2084
|
+
else _chunkOLNIPTB3cjs.lerpPigmentInto.call(void 0, _chunkOLNIPTB3cjs.pigment8.call(void 0, Math.round(px[i]), Math.round(px[i + 1]), Math.round(px[i + 2])), mixPig, share, out, 0);
|
|
2083
2085
|
} else {
|
|
2084
2086
|
for (let c = 0; c < 3; c++) {
|
|
2085
2087
|
const m = sum(c, x1, y1, x2, y2) / asum;
|
|
@@ -2139,7 +2141,7 @@ var SmudgeTip = (_class9 = class {
|
|
|
2139
2141
|
mix(a0, a1, a2, b0, b1, b2, t) {
|
|
2140
2142
|
const o = this.out;
|
|
2141
2143
|
if (this.settings.mixing === "pigment") {
|
|
2142
|
-
|
|
2144
|
+
_chunkOLNIPTB3cjs.mixPigment8.call(void 0, Math.round(a0 * 255), Math.round(a1 * 255), Math.round(a2 * 255), Math.round(b0 * 255), Math.round(b1 * 255), Math.round(b2 * 255), t, o);
|
|
2143
2145
|
} else {
|
|
2144
2146
|
o[0] = a0 + (b0 - a0) * t;
|
|
2145
2147
|
o[1] = a1 + (b1 - a1) * t;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkROVK6AXXcjs = require('./chunk-ROVK6AXX.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkCVFAAZXEcjs = require('./chunk-CVFAAZXE.cjs');
|
|
@@ -47,7 +47,7 @@ var _chunkNM3G4VQTcjs = require('./chunk-NM3G4VQT.cjs');
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkPQ3H2AANcjs = require('./chunk-PQ3H2AAN.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
@@ -2527,7 +2527,7 @@ function vectorExtrudeFaces(path, params) {
|
|
|
2527
2527
|
// src/vector/brushstroke.ts
|
|
2528
2528
|
var VECTOR_BRUSHSTROKE_SCALE = 2;
|
|
2529
2529
|
function vectorBrushstrokeBrushes() {
|
|
2530
|
-
return
|
|
2530
|
+
return _chunkROVK6AXXcjs.BUILTIN_BRUSHES.filter((b) => _chunkPQ3H2AANcjs.isBrushstrokeBrush.call(void 0, b));
|
|
2531
2531
|
}
|
|
2532
2532
|
function vectorBrushstrokeBrush(id) {
|
|
2533
2533
|
return _nullishCoalesce(vectorBrushstrokeBrushes().find((b) => b.id === id), () => ( null));
|
|
@@ -2558,7 +2558,7 @@ function sanitizeVectorBrushstrokePaper(value) {
|
|
|
2558
2558
|
if (!value || typeof value !== "object") return null;
|
|
2559
2559
|
const r = value;
|
|
2560
2560
|
const out = {};
|
|
2561
|
-
if (typeof r.pattern === "string" &&
|
|
2561
|
+
if (typeof r.pattern === "string" && _chunkPQ3H2AANcjs.GRAIN_PATTERNS.includes(r.pattern)) out.pattern = r.pattern;
|
|
2562
2562
|
const seed = sanitizeSeed(r.seed);
|
|
2563
2563
|
if (seed !== void 0) out.seed = seed;
|
|
2564
2564
|
if (finite2(r.scale) && r.scale > 0) out.scale = Math.min(8, Math.max(0.25, r.scale));
|
|
@@ -2573,7 +2573,7 @@ function vectorBrushstrokeCharacterError(brush) {
|
|
|
2573
2573
|
const r = paper;
|
|
2574
2574
|
const extra = Object.keys(r).filter((k) => !["pattern", "seed", "scale", "depth"].includes(k));
|
|
2575
2575
|
if (extra.length) return `paper has unknown field ${extra.map((k) => `"${k}"`).join(", ")}: use pattern, seed, scale, depth.`;
|
|
2576
|
-
if (r.pattern !== void 0 && !
|
|
2576
|
+
if (r.pattern !== void 0 && !_chunkPQ3H2AANcjs.GRAIN_PATTERNS.includes(r.pattern)) return `Unknown paper pattern "${String(r.pattern)}": use one of ${_chunkPQ3H2AANcjs.GRAIN_PATTERNS.join(", ")}.`;
|
|
2577
2577
|
if (r.seed !== void 0 && !(Number.isInteger(r.seed) && r.seed >= 0 && r.seed <= VECTOR_BRUSHSTROKE_MAX_SEED)) return `paper.seed must be an integer from 0 to ${VECTOR_BRUSHSTROKE_MAX_SEED}.`;
|
|
2578
2578
|
if (r.scale !== void 0 && !(finite2(r.scale) && r.scale >= 0.25 && r.scale <= 8)) return "paper.scale must be from 0.25 to 8 (1 is the pattern's natural size).";
|
|
2579
2579
|
if (r.depth !== void 0 && !(finite2(r.depth) && r.depth >= 0 && r.depth <= 1)) return "paper.depth must be from 0 to 1.";
|
|
@@ -2589,7 +2589,7 @@ function vectorBrushstrokeReach(layer) {
|
|
|
2589
2589
|
if (!isVectorBrushstrokeLayer(layer)) return 0;
|
|
2590
2590
|
return (_nullishCoalesce(layer.brush.size, () => ( vectorBrushstrokeBrush(layer.brush.brushId).tip.size))) / 2;
|
|
2591
2591
|
}
|
|
2592
|
-
var cache = new (0,
|
|
2592
|
+
var cache = new (0, _chunkPQ3H2AANcjs.BrushstrokeCache)(256);
|
|
2593
2593
|
var urls = /* @__PURE__ */ new WeakMap();
|
|
2594
2594
|
var layerCache = /* @__PURE__ */ new WeakMap();
|
|
2595
2595
|
function vectorBrushstrokeImages(node, layer) {
|
|
@@ -2614,7 +2614,7 @@ function vectorBrushstrokeImages(node, layer) {
|
|
|
2614
2614
|
const stroke = cache.render({ points: ring.map(([x, y]) => ({ x, y })), ...layer.brush.pressure ? { pressure: layer.brush.pressure } : {} }, brush, { scale: VECTOR_BRUSHSTROKE_SCALE, color: color2, maxPixels: 2048 * 2048, ...character });
|
|
2615
2615
|
if (!stroke.bounds) continue;
|
|
2616
2616
|
let href = urls.get(stroke);
|
|
2617
|
-
if (!href) urls.set(stroke, href =
|
|
2617
|
+
if (!href) urls.set(stroke, href = _chunkPQ3H2AANcjs.brushstrokeDataUrl.call(void 0, stroke));
|
|
2618
2618
|
out.push({ href, ...stroke.bounds });
|
|
2619
2619
|
}
|
|
2620
2620
|
}
|