@pixerate/editor 0.113.0 → 0.114.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 +5 -0
- package/dist/animation-editor/index.cjs +60 -54
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +3 -3
- package/dist/animation-editor/index.d.ts +3 -3
- package/dist/animation-editor/index.js +14 -8
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/builtin-CY97ppKM.d.cts +354 -0
- package/dist/builtin-CY97ppKM.d.ts +354 -0
- package/dist/canvas/index.cjs +3 -3
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.js +9 -9
- package/dist/chunk-26PGXHY7.cjs +753 -0
- package/dist/chunk-26PGXHY7.cjs.map +1 -0
- package/dist/chunk-2OJACTPR.cjs +929 -0
- package/dist/chunk-2OJACTPR.cjs.map +1 -0
- package/dist/chunk-3UFGNHSP.js +929 -0
- package/dist/chunk-3UFGNHSP.js.map +1 -0
- package/dist/{chunk-YGIMK4NX.cjs → chunk-5OVJHMZQ.cjs} +757 -825
- package/dist/chunk-5OVJHMZQ.cjs.map +1 -0
- package/dist/chunk-643B2HKC.cjs +534 -0
- package/dist/chunk-643B2HKC.cjs.map +1 -0
- package/dist/chunk-6FCKOS2B.js +534 -0
- package/dist/chunk-6FCKOS2B.js.map +1 -0
- package/dist/chunk-BRLYOPLT.js +2574 -0
- package/dist/chunk-BRLYOPLT.js.map +1 -0
- package/dist/{chunk-LQEEDHOP.js → chunk-C6C5PDKU.js} +759 -761
- package/dist/chunk-C6C5PDKU.js.map +1 -0
- package/dist/{chunk-4KLT7ZYS.cjs → chunk-DFQEX3AM.cjs} +29 -29
- package/dist/{chunk-4KLT7ZYS.cjs.map → chunk-DFQEX3AM.cjs.map} +1 -1
- package/dist/{chunk-CZOXTEMN.js → chunk-EUVSQ25B.js} +336 -404
- package/dist/chunk-EUVSQ25B.js.map +1 -0
- package/dist/chunk-G5NMLUVF.cjs +2574 -0
- package/dist/chunk-G5NMLUVF.cjs.map +1 -0
- package/dist/{chunk-LPYOIVLA.js → chunk-LKCYANMW.js} +3 -3
- package/dist/{chunk-W3GXSUSQ.cjs → chunk-LPLCWZTM.cjs} +5087 -1283
- package/dist/chunk-LPLCWZTM.cjs.map +1 -0
- package/dist/chunk-MMVHBKMM.js +753 -0
- package/dist/chunk-MMVHBKMM.js.map +1 -0
- package/dist/{chunk-POGBUYWE.cjs → chunk-ST7E3NEE.cjs} +857 -859
- package/dist/chunk-ST7E3NEE.cjs.map +1 -0
- package/dist/{chunk-7VOHOPLW.cjs → chunk-TCKIXI46.cjs} +59 -59
- package/dist/{chunk-7VOHOPLW.cjs.map → chunk-TCKIXI46.cjs.map} +1 -1
- package/dist/{chunk-XIOMMGPD.cjs → chunk-TFOPHZ3U.cjs} +1 -1
- package/dist/chunk-TFOPHZ3U.cjs.map +1 -0
- package/dist/{chunk-Z4BC6M74.js → chunk-UBIXVXPR.js} +2 -2
- package/dist/{chunk-BLWCAQCW.js → chunk-VXR7XWMF.js} +4574 -770
- package/dist/chunk-VXR7XWMF.js.map +1 -0
- package/dist/{chunk-HNS7UHCM.js → chunk-XK5LZKBD.js} +1 -1
- package/dist/chunk-XK5LZKBD.js.map +1 -0
- package/dist/cms/index.cjs +146 -0
- package/dist/cms/index.cjs.map +1 -0
- package/dist/cms/index.d.cts +51 -0
- package/dist/cms/index.d.ts +51 -0
- package/dist/cms/index.js +146 -0
- package/dist/cms/index.js.map +1 -0
- package/dist/{export-DIkoK8-r.d.ts → export-_1dUKwpF.d.ts} +217 -191
- package/dist/{export-CEXEzqBf.d.cts → export-b6NjCZ5-.d.cts} +217 -191
- package/dist/image-editor/index.cjs +1779 -1280
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +77 -93
- package/dist/image-editor/index.d.ts +77 -93
- package/dist/image-editor/index.js +740 -241
- package/dist/image-editor/index.js.map +1 -1
- package/dist/opentype-BZEOSOX3.d.ts +188 -0
- package/dist/opentype-Dpe75vL5.d.cts +188 -0
- package/dist/paint/index.cjs +4 -4
- package/dist/paint/index.d.cts +2 -2
- package/dist/paint/index.d.ts +2 -2
- package/dist/paint/index.js +3 -3
- package/dist/paint-editor/index.cjs +146 -145
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +9 -8
- package/dist/paint-editor/index.d.ts +9 -8
- package/dist/paint-editor/index.js +6 -5
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +53 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +62 -91
- package/dist/raster/index.d.ts +62 -91
- package/dist/raster/index.js +59 -9
- package/dist/{render-BEriFuqK.d.cts → render-B1K_OoLy.d.cts} +87 -2
- package/dist/{render-tjzKaik-.d.ts → render-CrmHOgpo.d.ts} +87 -2
- package/dist/{retouch-CEIKR22W.d.cts → retouch-Bxkuc0KH.d.cts} +1 -1
- package/dist/{retouch-BXmeSCaB.d.ts → retouch-Do6tBs2H.d.ts} +1 -1
- package/dist/{surface-C8RRg_Bh.d.cts → surface-Cn30xIV6.d.cts} +6 -1
- package/dist/{surface-C8RRg_Bh.d.ts → surface-Cn30xIV6.d.ts} +6 -1
- package/dist/{svg-D_cfkhlB.d.cts → svg-BnRj0q8i.d.cts} +16 -4
- package/dist/{svg-wIaKLrU0.d.ts → svg-CmmBFfGT.d.ts} +16 -4
- package/dist/{types-DtL_qLFz.d.ts → types-1SUQKDAw.d.ts} +273 -4
- package/dist/{types-DyQq-WPY.d.cts → types-yINF17Ta.d.cts} +273 -4
- package/dist/vector/index.cjs +12170 -7343
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +1579 -16
- package/dist/vector/index.d.ts +1579 -16
- package/dist/vector/index.js +6303 -1476
- package/dist/vector/index.js.map +1 -1
- package/dist/warp-B39VsOtd.d.cts +348 -0
- package/dist/warp-DMN30aY6.d.ts +348 -0
- package/dist/zlib-dxQdgHyN.d.cts +95 -0
- package/dist/zlib-dxQdgHyN.d.ts +95 -0
- package/package.json +6 -1
- package/skills/pixerate-image-editor/SKILL.md +12 -36
- package/skills/pixerate-image-editor/references/color-management.md +37 -0
- package/skills/pixerate-image-editor/references/photoshop-files.md +39 -0
- package/skills/pixerate-vector/SKILL.md +54 -2
- package/dist/chunk-BLWCAQCW.js.map +0 -1
- package/dist/chunk-CZOXTEMN.js.map +0 -1
- package/dist/chunk-HNS7UHCM.js.map +0 -1
- package/dist/chunk-JLYX4V57.cjs +0 -2001
- package/dist/chunk-JLYX4V57.cjs.map +0 -1
- package/dist/chunk-KB2YBCVS.js +0 -2001
- package/dist/chunk-KB2YBCVS.js.map +0 -1
- package/dist/chunk-LQEEDHOP.js.map +0 -1
- package/dist/chunk-POGBUYWE.cjs.map +0 -1
- package/dist/chunk-W3GXSUSQ.cjs.map +0 -1
- package/dist/chunk-XIOMMGPD.cjs.map +0 -1
- package/dist/chunk-YGIMK4NX.cjs.map +0 -1
- package/dist/homography-CZ-tFjay.d.cts +0 -50
- package/dist/homography-Ctfjoc1b.d.ts +0 -50
- package/dist/warp-CWHZzE3x.d.ts +0 -118
- package/dist/warp-D5jz_tN7.d.cts +0 -118
- /package/dist/{chunk-LPYOIVLA.js.map → chunk-LKCYANMW.js.map} +0 -0
- /package/dist/{chunk-Z4BC6M74.js.map → chunk-UBIXVXPR.js.map} +0 -0
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkTFOPHZ3Ucjs = require('./chunk-TFOPHZ3U.cjs');
|
|
14
14
|
|
|
15
15
|
// src/paint/brush.ts
|
|
16
16
|
var DEFAULT_BRUSH = {
|
|
@@ -223,41 +223,41 @@ function rasterizeDab(d, hardness, rect, out) {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
var TILE_PIXELS =
|
|
226
|
+
var TILE_PIXELS = _chunkTFOPHZ3Ucjs.TILE * _chunkTFOPHZ3Ucjs.TILE;
|
|
227
227
|
var CoverageMap = (_class2 = class {constructor() { _class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this); }
|
|
228
228
|
__init4() {this.tiles = /* @__PURE__ */ new Map()}
|
|
229
229
|
__init5() {this.bounds = null}
|
|
230
230
|
__init6() {this.dirty = /* @__PURE__ */ new Set()}
|
|
231
231
|
get(x, y) {
|
|
232
|
-
const tx = Math.floor(x /
|
|
233
|
-
const ty = Math.floor(y /
|
|
234
|
-
const t = this.tiles.get(
|
|
235
|
-
return t ? t[(y - ty *
|
|
232
|
+
const tx = Math.floor(x / _chunkTFOPHZ3Ucjs.TILE);
|
|
233
|
+
const ty = Math.floor(y / _chunkTFOPHZ3Ucjs.TILE);
|
|
234
|
+
const t = this.tiles.get(_chunkTFOPHZ3Ucjs.tileKey.call(void 0, tx, ty));
|
|
235
|
+
return t ? t[(y - ty * _chunkTFOPHZ3Ucjs.TILE) * _chunkTFOPHZ3Ucjs.TILE + (x - tx * _chunkTFOPHZ3Ucjs.TILE)] : 0;
|
|
236
236
|
}
|
|
237
237
|
/** Builds up `vals` (over `rect`) with flow towards `ceil`: `c ← c + v·(ceil − c)`. */
|
|
238
238
|
accumulate(rect, vals, ceil) {
|
|
239
239
|
if (rect.width <= 0 || rect.height <= 0) return;
|
|
240
240
|
const w = rect.width;
|
|
241
|
-
const tx0 = Math.floor(rect.x /
|
|
242
|
-
const ty0 = Math.floor(rect.y /
|
|
243
|
-
const tx1 = Math.floor((rect.x + rect.width - 1) /
|
|
244
|
-
const ty1 = Math.floor((rect.y + rect.height - 1) /
|
|
241
|
+
const tx0 = Math.floor(rect.x / _chunkTFOPHZ3Ucjs.TILE);
|
|
242
|
+
const ty0 = Math.floor(rect.y / _chunkTFOPHZ3Ucjs.TILE);
|
|
243
|
+
const tx1 = Math.floor((rect.x + rect.width - 1) / _chunkTFOPHZ3Ucjs.TILE);
|
|
244
|
+
const ty1 = Math.floor((rect.y + rect.height - 1) / _chunkTFOPHZ3Ucjs.TILE);
|
|
245
245
|
let touched = false;
|
|
246
246
|
for (let ty = ty0; ty <= ty1; ty++) {
|
|
247
247
|
for (let tx = tx0; tx <= tx1; tx++) {
|
|
248
|
-
const x0 = Math.max(rect.x, tx *
|
|
249
|
-
const y0 = Math.max(rect.y, ty *
|
|
250
|
-
const x1 = Math.min(rect.x + rect.width, tx *
|
|
251
|
-
const y1 = Math.min(rect.y + rect.height, ty *
|
|
248
|
+
const x0 = Math.max(rect.x, tx * _chunkTFOPHZ3Ucjs.TILE);
|
|
249
|
+
const y0 = Math.max(rect.y, ty * _chunkTFOPHZ3Ucjs.TILE);
|
|
250
|
+
const x1 = Math.min(rect.x + rect.width, tx * _chunkTFOPHZ3Ucjs.TILE + _chunkTFOPHZ3Ucjs.TILE);
|
|
251
|
+
const y1 = Math.min(rect.y + rect.height, ty * _chunkTFOPHZ3Ucjs.TILE + _chunkTFOPHZ3Ucjs.TILE);
|
|
252
252
|
let tile;
|
|
253
253
|
for (let y = y0; y < y1; y++) {
|
|
254
254
|
const row = (y - rect.y) * w;
|
|
255
|
-
const trow = (y - ty *
|
|
255
|
+
const trow = (y - ty * _chunkTFOPHZ3Ucjs.TILE) * _chunkTFOPHZ3Ucjs.TILE;
|
|
256
256
|
for (let x = x0; x < x1; x++) {
|
|
257
257
|
const v = vals[row + (x - rect.x)];
|
|
258
258
|
if (v <= 0) continue;
|
|
259
259
|
if (!tile) {
|
|
260
|
-
const key =
|
|
260
|
+
const key = _chunkTFOPHZ3Ucjs.tileKey.call(void 0, tx, ty);
|
|
261
261
|
tile = this.tiles.get(key);
|
|
262
262
|
if (!tile) {
|
|
263
263
|
tile = new Float32Array(TILE_PIXELS);
|
|
@@ -266,7 +266,7 @@ var CoverageMap = (_class2 = class {constructor() { _class2.prototype.__init4.ca
|
|
|
266
266
|
this.dirty.add(key);
|
|
267
267
|
touched = true;
|
|
268
268
|
}
|
|
269
|
-
const ti = trow + (x - tx *
|
|
269
|
+
const ti = trow + (x - tx * _chunkTFOPHZ3Ucjs.TILE);
|
|
270
270
|
const c = tile[ti];
|
|
271
271
|
if (ceil > c) tile[ti] = c + v * (ceil - c);
|
|
272
272
|
}
|
|
@@ -338,35 +338,35 @@ var StrokeCoverage = (_class3 = class {
|
|
|
338
338
|
}, _class3);
|
|
339
339
|
function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}) {
|
|
340
340
|
const out = options.into ? new Uint8ClampedArray(options.into) : new Uint8ClampedArray(tileData);
|
|
341
|
-
const ox = tx *
|
|
342
|
-
const oy = ty *
|
|
341
|
+
const ox = tx * _chunkTFOPHZ3Ucjs.TILE + s.offset.x;
|
|
342
|
+
const oy = ty * _chunkTFOPHZ3Ucjs.TILE + s.offset.y;
|
|
343
343
|
let x0 = 0;
|
|
344
344
|
let y0 = 0;
|
|
345
|
-
let x1 =
|
|
346
|
-
let y1 =
|
|
345
|
+
let x1 = _chunkTFOPHZ3Ucjs.TILE;
|
|
346
|
+
let y1 = _chunkTFOPHZ3Ucjs.TILE;
|
|
347
347
|
if (options.region) {
|
|
348
348
|
const r = options.region;
|
|
349
349
|
x0 = Math.max(0, Math.floor(r.x) - ox);
|
|
350
350
|
y0 = Math.max(0, Math.floor(r.y) - oy);
|
|
351
|
-
x1 = Math.min(
|
|
352
|
-
y1 = Math.min(
|
|
351
|
+
x1 = Math.min(_chunkTFOPHZ3Ucjs.TILE, Math.ceil(r.x + r.width) - ox);
|
|
352
|
+
y1 = Math.min(_chunkTFOPHZ3Ucjs.TILE, Math.ceil(r.y + r.height) - oy);
|
|
353
353
|
if (x1 <= x0 || y1 <= y0) return out;
|
|
354
354
|
if (options.into) {
|
|
355
|
-
for (let y = y0; y < y1; y++) out.set(tileData.subarray((y *
|
|
355
|
+
for (let y = y0; y < y1; y++) out.set(tileData.subarray((y * _chunkTFOPHZ3Ucjs.TILE + x0) * channels, (y * _chunkTFOPHZ3Ucjs.TILE + x1) * channels), (y * _chunkTFOPHZ3Ucjs.TILE + x0) * channels);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
const sel = s.selection;
|
|
359
359
|
const cb = [0, 0, 0, 0];
|
|
360
360
|
const cs = [s.color[0] / 255, s.color[1] / 255, s.color[2] / 255, s.color[3] / 255];
|
|
361
361
|
const bg = [s.background[0] / 255, s.background[1] / 255, s.background[2] / 255, s.background[3] / 255];
|
|
362
|
-
const aligned = s.offset.x %
|
|
363
|
-
const covTile = aligned ? coverage.tiles.get(
|
|
362
|
+
const aligned = s.offset.x % _chunkTFOPHZ3Ucjs.TILE === 0 && s.offset.y % _chunkTFOPHZ3Ucjs.TILE === 0;
|
|
363
|
+
const covTile = aligned ? coverage.tiles.get(_chunkTFOPHZ3Ucjs.tileKey.call(void 0, Math.floor(ox / _chunkTFOPHZ3Ucjs.TILE), Math.floor(oy / _chunkTFOPHZ3Ucjs.TILE))) : void 0;
|
|
364
364
|
if (aligned && !covTile) return out;
|
|
365
365
|
for (let y = y0; y < y1; y++) {
|
|
366
366
|
const dy = oy + y;
|
|
367
367
|
for (let x = x0; x < x1; x++) {
|
|
368
368
|
const dx = ox + x;
|
|
369
|
-
const c = covTile ? covTile[y *
|
|
369
|
+
const c = covTile ? covTile[y * _chunkTFOPHZ3Ucjs.TILE + x] : coverage.get(dx, dy);
|
|
370
370
|
if (c <= 0) continue;
|
|
371
371
|
let k = c * s.opacity;
|
|
372
372
|
if (sel) {
|
|
@@ -375,7 +375,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
375
375
|
}
|
|
376
376
|
if (k > 1) k = 1;
|
|
377
377
|
if (k <= 0) continue;
|
|
378
|
-
const p = y *
|
|
378
|
+
const p = y * _chunkTFOPHZ3Ucjs.TILE + x;
|
|
379
379
|
if (channels === 1) {
|
|
380
380
|
const target = s.mode === "erase" ? s.background[0] : s.color[0];
|
|
381
381
|
out[p] = Math.round(out[p] + (target - out[p]) * k);
|
|
@@ -393,7 +393,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
393
393
|
const as = src[3] * k;
|
|
394
394
|
if (!(as > 0)) continue;
|
|
395
395
|
const ao = as + out[i + 3] / 255 * (1 - as);
|
|
396
|
-
|
|
396
|
+
_chunkTFOPHZ3Ucjs.mixPigment8.call(void 0, out[i], out[i + 1], out[i + 2], bytes[0], bytes[1], bytes[2], as / ao, cb);
|
|
397
397
|
out[i] = Math.round(cb[0] * 255);
|
|
398
398
|
out[i + 1] = Math.round(cb[1] * 255);
|
|
399
399
|
out[i + 2] = Math.round(cb[2] * 255);
|
|
@@ -401,7 +401,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
401
401
|
continue;
|
|
402
402
|
}
|
|
403
403
|
for (let ch = 0; ch < 4; ch++) cb[ch] = out[i + ch] / 255;
|
|
404
|
-
const o =
|
|
404
|
+
const o = _chunkTFOPHZ3Ucjs.blendPixel.call(void 0, s.blend, cb, src, k);
|
|
405
405
|
out[i] = Math.round(o[0] * 255);
|
|
406
406
|
out[i + 1] = Math.round(o[1] * 255);
|
|
407
407
|
out[i + 2] = Math.round(o[2] * 255);
|
|
@@ -411,7 +411,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
411
411
|
return out;
|
|
412
412
|
}
|
|
413
413
|
function coverageTileCoord(key) {
|
|
414
|
-
return
|
|
414
|
+
return _chunkTFOPHZ3Ucjs.tileCoord.call(void 0, key);
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
// src/paint/exchange.ts
|
|
@@ -428,7 +428,7 @@ var PaintExchange = (_class4 = class {
|
|
|
428
428
|
this.reservoir = load.reservoir ? [load.reservoir[0], load.reservoir[1], load.reservoir[2]] : null;
|
|
429
429
|
this.amount = this.reservoir ? Math.min(1, Math.max(0, load.amount)) : 0;
|
|
430
430
|
this.well = load.pickup ? [load.pickup[0], load.pickup[1], load.pickup[2]] : null;
|
|
431
|
-
this.pig = rates.mixing === "pigment" ? { res:
|
|
431
|
+
this.pig = rates.mixing === "pigment" ? { res: _chunkTFOPHZ3Ucjs.createPigment.call(void 0, _nullishCoalesce(this.reservoir, () => ( [0, 0, 0]))), well: _chunkTFOPHZ3Ucjs.createPigment.call(void 0, _nullishCoalesce(this.well, () => ( [0, 0, 0]))), paint: _chunkTFOPHZ3Ucjs.createPigment.call(void 0, [0, 0, 0]), canvas: _chunkTFOPHZ3Ucjs.createPigment.call(void 0, [0, 0, 0]) } : null;
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
|
|
@@ -458,21 +458,21 @@ var PaintExchange = (_class4 = class {
|
|
|
458
458
|
this.reservoir[1] = g;
|
|
459
459
|
this.reservoir[2] = b;
|
|
460
460
|
}
|
|
461
|
-
if (this.pig)
|
|
461
|
+
if (this.pig) _chunkTFOPHZ3Ucjs.setPigmentColor.call(void 0, this.pig.res, r, g, b);
|
|
462
462
|
}
|
|
463
463
|
/** `a` mixed `t` of the way to `b` into `this.out`, by the mixing model. */
|
|
464
464
|
mix(a, pa, b, pb, t) {
|
|
465
465
|
const o = this.out;
|
|
466
|
-
if (pa && pb)
|
|
466
|
+
if (pa && pb) _chunkTFOPHZ3Ucjs.lerpPigmentInto.call(void 0, pa, pb, t, o, 0);
|
|
467
467
|
else for (let c = 0; c < 3; c++) o[c] = a[c] + (b[c] - a[c]) * t;
|
|
468
468
|
return o;
|
|
469
469
|
}
|
|
470
470
|
/** `a` mixed `t` of the way to `b` (sRGB 0..1) by the mixing model, into `out`. */
|
|
471
471
|
mixColors(a, b, t, out) {
|
|
472
472
|
if (this.pig) {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
_chunkTFOPHZ3Ucjs.setPigmentColor.call(void 0, this.pig.canvas, a[0], a[1], a[2]);
|
|
474
|
+
_chunkTFOPHZ3Ucjs.setPigmentColor.call(void 0, this.pig.paint, b[0], b[1], b[2]);
|
|
475
|
+
_chunkTFOPHZ3Ucjs.lerpPigmentInto.call(void 0, this.pig.canvas, this.pig.paint, t, out, 0);
|
|
476
476
|
} else for (let c = 0; c < 3; c++) out[c] = a[c] + (b[c] - a[c]) * t;
|
|
477
477
|
return out;
|
|
478
478
|
}
|
|
@@ -482,11 +482,11 @@ var PaintExchange = (_class4 = class {
|
|
|
482
482
|
const pig = this.pig;
|
|
483
483
|
if (!this.well) this.well = [sample.rgb[0], sample.rgb[1], sample.rgb[2]];
|
|
484
484
|
else {
|
|
485
|
-
if (pig)
|
|
485
|
+
if (pig) _chunkTFOPHZ3Ucjs.setPigmentColor.call(void 0, pig.canvas, sample.rgb[0], sample.rgb[1], sample.rgb[2]);
|
|
486
486
|
const o = this.mix(this.well, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _3 => _3.well]), () => ( null)), sample.rgb, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _4 => _4.canvas]), () => ( null)), this.rates.pickup * sample.contact);
|
|
487
487
|
this.well = [o[0], o[1], o[2]];
|
|
488
488
|
}
|
|
489
|
-
if (pig)
|
|
489
|
+
if (pig) _chunkTFOPHZ3Ucjs.setPigmentColor.call(void 0, pig.well, this.well[0], this.well[1], this.well[2]);
|
|
490
490
|
}
|
|
491
491
|
/**
|
|
492
492
|
* 2. The dab's paint: the reservoir mixed with the well, written to `out`. Returns the total
|
|
@@ -511,7 +511,7 @@ var PaintExchange = (_class4 = class {
|
|
|
511
511
|
out[1] = c[1];
|
|
512
512
|
out[2] = c[2];
|
|
513
513
|
}
|
|
514
|
-
if (pig)
|
|
514
|
+
if (pig) _chunkTFOPHZ3Ucjs.setPigmentColor.call(void 0, pig.paint, out[0], out[1], out[2]);
|
|
515
515
|
return total;
|
|
516
516
|
}
|
|
517
517
|
/** 3. The reservoir drains. */
|
|
@@ -531,8 +531,8 @@ var TileMedium = (_class5 = class {
|
|
|
531
531
|
__init13() {this.ty = NaN}
|
|
532
532
|
__init14() {this.tile = null}
|
|
533
533
|
__init15() {this.writable = false}
|
|
534
|
-
__init16() {this.canvasPig =
|
|
535
|
-
__init17() {this.paintPig =
|
|
534
|
+
__init16() {this.canvasPig = _chunkTFOPHZ3Ucjs.createPigment.call(void 0, [0, 0, 0])}
|
|
535
|
+
__init17() {this.paintPig = _chunkTFOPHZ3Ucjs.createPigment.call(void 0, [0, 0, 0])}
|
|
536
536
|
__init18() {this.paintKey = -1}
|
|
537
537
|
__init19() {this.cb = [0, 0, 0, 0]}
|
|
538
538
|
__init20() {this.src = [0, 0, 0, 1]}
|
|
@@ -549,15 +549,15 @@ var TileMedium = (_class5 = class {
|
|
|
549
549
|
const t = this.target;
|
|
550
550
|
const lx = dx - t.offset.x;
|
|
551
551
|
const ly = dy - t.offset.y;
|
|
552
|
-
const tx = Math.floor(lx /
|
|
553
|
-
const ty = Math.floor(ly /
|
|
552
|
+
const tx = Math.floor(lx / _chunkTFOPHZ3Ucjs.TILE);
|
|
553
|
+
const ty = Math.floor(ly / _chunkTFOPHZ3Ucjs.TILE);
|
|
554
554
|
if (tx !== this.tx || ty !== this.ty || write && !this.writable) {
|
|
555
555
|
this.tx = tx;
|
|
556
556
|
this.ty = ty;
|
|
557
557
|
this.tile = write ? t.writeTile(tx, ty) : t.readTile(tx, ty);
|
|
558
558
|
this.writable = write;
|
|
559
559
|
}
|
|
560
|
-
return this.tile ? ((ly - ty *
|
|
560
|
+
return this.tile ? ((ly - ty * _chunkTFOPHZ3Ucjs.TILE) * _chunkTFOPHZ3Ucjs.TILE + (lx - tx * _chunkTFOPHZ3Ucjs.TILE)) * 4 : -1;
|
|
561
561
|
}
|
|
562
562
|
/** The tile `locate` last found. */
|
|
563
563
|
get pixels() {
|
|
@@ -637,7 +637,7 @@ var TileMedium = (_class5 = class {
|
|
|
637
637
|
src[0] = pr;
|
|
638
638
|
src[1] = pg;
|
|
639
639
|
src[2] = pb;
|
|
640
|
-
const r =
|
|
640
|
+
const r = _chunkTFOPHZ3Ucjs.blendPixel.call(void 0, blend, cb, src, k);
|
|
641
641
|
px[i] = Math.round(r[0] * 255);
|
|
642
642
|
px[i + 1] = Math.round(r[1] * 255);
|
|
643
643
|
px[i + 2] = Math.round(r[2] * 255);
|
|
@@ -652,23 +652,23 @@ var TileMedium = (_class5 = class {
|
|
|
652
652
|
o[1] = pg;
|
|
653
653
|
o[2] = pb;
|
|
654
654
|
} else if (pigment && field) {
|
|
655
|
-
|
|
655
|
+
_chunkTFOPHZ3Ucjs.mixPigment8.call(void 0, px[i], px[i + 1], px[i + 2], Math.round(pr * 255), Math.round(pg * 255), Math.round(pb * 255), share, o);
|
|
656
656
|
} else if (pigment) {
|
|
657
657
|
const key = px[i] << 16 | px[i + 1] << 8 | px[i + 2];
|
|
658
658
|
if (key !== lastKey) {
|
|
659
|
-
|
|
659
|
+
_chunkTFOPHZ3Ucjs.setPigmentColor.call(void 0, this.canvasPig, px[i] / 255, px[i + 1] / 255, px[i + 2] / 255);
|
|
660
660
|
lastKey = key;
|
|
661
661
|
}
|
|
662
662
|
let pp = paintPigment;
|
|
663
663
|
if (!pp) {
|
|
664
664
|
const pkey = Math.round(pr * 255) << 16 | Math.round(pg * 255) << 8 | Math.round(pb * 255);
|
|
665
665
|
if (pkey !== this.paintKey) {
|
|
666
|
-
|
|
666
|
+
_chunkTFOPHZ3Ucjs.setPigmentColor.call(void 0, this.paintPig, pr, pg, pb);
|
|
667
667
|
this.paintKey = pkey;
|
|
668
668
|
}
|
|
669
669
|
pp = this.paintPig;
|
|
670
670
|
}
|
|
671
|
-
|
|
671
|
+
_chunkTFOPHZ3Ucjs.lerpPigmentInto.call(void 0, this.canvasPig, pp, share, o, 0);
|
|
672
672
|
} else {
|
|
673
673
|
o[0] = px[i] / 255 + (pr - px[i] / 255) * share;
|
|
674
674
|
o[1] = px[i + 1] / 255 + (pg - px[i + 1] / 255) * share;
|
|
@@ -799,9 +799,9 @@ function blendRadius(settings, radius) {
|
|
|
799
799
|
return Math.max(1, Math.round(settings.distance * 2 * radius));
|
|
800
800
|
}
|
|
801
801
|
function createBlenderScratch() {
|
|
802
|
-
return { sums: new Float64Array(0), mix: { rgb: [0, 0, 0], strength: 1, ks: new Float32Array(
|
|
802
|
+
return { sums: new Float64Array(0), mix: { rgb: [0, 0, 0], strength: 1, ks: new Float32Array(_chunkTFOPHZ3Ucjs.PIGMENT_BANDS), scatter: 1 }, out: [0, 0, 0] };
|
|
803
803
|
}
|
|
804
|
-
var N =
|
|
804
|
+
var N = _chunkTFOPHZ3Ucjs.PIGMENT_BANDS;
|
|
805
805
|
function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
806
806
|
const R = blendRadius(settings, radius);
|
|
807
807
|
const W = rect.width + 2 * R;
|
|
@@ -826,7 +826,7 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
|
826
826
|
const a = px[i + 3] / 255;
|
|
827
827
|
if (a > 0) {
|
|
828
828
|
if (pigment) {
|
|
829
|
-
const p =
|
|
829
|
+
const p = _chunkTFOPHZ3Ucjs.pigment8.call(void 0, px[i], px[i + 1], px[i + 2]);
|
|
830
830
|
const sa = p.scatter * p.strength * a;
|
|
831
831
|
for (let k = 0; k < N; k++) row[k] += sa * p.ks[k];
|
|
832
832
|
row[N] += sa;
|
|
@@ -884,8 +884,8 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
|
884
884
|
const sa = sum(N, x1, y1, x2, y2);
|
|
885
885
|
for (let c = 0; c < N; c++) mixPig.ks[c] = sum(c, x1, y1, x2, y2) / sa;
|
|
886
886
|
mixPig.scatter = sa / asum;
|
|
887
|
-
if (a <= 0 || share >= 1)
|
|
888
|
-
else
|
|
887
|
+
if (a <= 0 || share >= 1) _chunkTFOPHZ3Ucjs.lerpPigmentInto.call(void 0, mixPig, mixPig, 0, out, 0);
|
|
888
|
+
else _chunkTFOPHZ3Ucjs.lerpPigmentInto.call(void 0, _chunkTFOPHZ3Ucjs.pigment8.call(void 0, px[i], px[i + 1], px[i + 2]), mixPig, share, out, 0);
|
|
889
889
|
} else {
|
|
890
890
|
for (let c = 0; c < 3; c++) {
|
|
891
891
|
const m = sum(c, x1, y1, x2, y2) / asum;
|
|
@@ -945,7 +945,7 @@ var SmudgeTip = (_class7 = class {
|
|
|
945
945
|
mix(a0, a1, a2, b0, b1, b2, t) {
|
|
946
946
|
const o = this.out;
|
|
947
947
|
if (this.settings.mixing === "pigment") {
|
|
948
|
-
|
|
948
|
+
_chunkTFOPHZ3Ucjs.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);
|
|
949
949
|
} else {
|
|
950
950
|
o[0] = a0 + (b0 - a0) * t;
|
|
951
951
|
o[1] = a1 + (b1 - a1) * t;
|
|
@@ -1077,8 +1077,8 @@ function createPigmentTools() {
|
|
|
1077
1077
|
const rgbs = items.map((item, i) => parseHex(item.color, i));
|
|
1078
1078
|
const total = items.reduce((sum, item) => sum + item.weight, 0);
|
|
1079
1079
|
if (!(total > 0)) throw new Error("Every weight is 0; give at least one colour a weight above 0.");
|
|
1080
|
-
const pigments = rgbs.map((rgb2, i) =>
|
|
1081
|
-
const mixed =
|
|
1080
|
+
const pigments = rgbs.map((rgb2, i) => _chunkTFOPHZ3Ucjs.createPigment.call(void 0, rgb2, { strength: items[i].strength }));
|
|
1081
|
+
const mixed = _chunkTFOPHZ3Ucjs.mixPigments.call(void 0, pigments, items.map((item) => item.weight));
|
|
1082
1082
|
const lerp = [0, 1, 2].map((c) => rgbs.reduce((sum, rgb2, i) => sum + rgb2[c] * items[i].weight, 0) / total);
|
|
1083
1083
|
const rgb = args.model === "rgb";
|
|
1084
1084
|
return {
|
|
@@ -1133,4 +1133,4 @@ function createPigmentTools() {
|
|
|
1133
1133
|
|
|
1134
1134
|
|
|
1135
1135
|
exports.DEFAULT_BRUSH = DEFAULT_BRUSH; exports.MAX_BRUSH_SIZE = MAX_BRUSH_SIZE; exports.normalizeBrush = normalizeBrush; exports.tipShape = tipShape; exports.tipFalloff = tipFalloff; exports.tipReach = tipReach; exports.dabCoverage = dabCoverage; exports.smoothPoints = smoothPoints; exports.DabWalker = DabWalker; exports.walkDabs = walkDabs; exports.dabRect = dabRect; exports.rasterizeDab = rasterizeDab; exports.CoverageMap = CoverageMap; exports.StrokeCoverage = StrokeCoverage; exports.applyStrokeToTile = applyStrokeToTile; exports.coverageTileCoord = coverageTileCoord; exports.MIXING_MODELS = MIXING_MODELS; exports.EMPTY_MIXER_LOAD = EMPTY_MIXER_LOAD; exports.MIXER_PICKUP_RATE = MIXER_PICKUP_RATE; exports.MIXER_DRAIN = MIXER_DRAIN; exports.exchangeRates = exchangeRates; exports.PaintExchange = PaintExchange; exports.TileMedium = TileMedium; exports.DEFAULT_MIXER = DEFAULT_MIXER; exports.normalizeMixer = normalizeMixer; exports.mixerRates = mixerRates; exports.loadMixer = loadMixer; exports.cleanMixer = cleanMixer; exports.MixerStroke = MixerStroke; exports.DEFAULT_BLENDER = DEFAULT_BLENDER; exports.DEFAULT_SMUDGE = DEFAULT_SMUDGE; exports.normalizeBlender = normalizeBlender; exports.normalizeSmudge = normalizeSmudge; exports.blendRadius = blendRadius; exports.createBlenderScratch = createBlenderScratch; exports.blenderDab = blenderDab; exports.SmudgeTip = SmudgeTip; exports.createPigmentTools = createPigmentTools;
|
|
1136
|
-
//# sourceMappingURL=chunk-
|
|
1136
|
+
//# sourceMappingURL=chunk-TCKIXI46.cjs.map
|