@pixerate/editor 0.106.0 → 0.107.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/{chunk-DS7KDKPX.js → chunk-3PHA3UKI.js} +2 -2
- package/dist/{chunk-ZID226ZG.cjs → chunk-FRD3FUXI.cjs} +172 -172
- package/dist/{chunk-ZID226ZG.cjs.map → chunk-FRD3FUXI.cjs.map} +1 -1
- package/dist/{chunk-67FRIOPZ.js → chunk-G4BIYE6R.js} +2 -2
- package/dist/{chunk-PV42JITT.cjs → chunk-HUFQD4CB.cjs} +44 -44
- package/dist/{chunk-PV42JITT.cjs.map → chunk-HUFQD4CB.cjs.map} +1 -1
- package/dist/{chunk-4X5MIVCE.js → chunk-SOROZ2BF.js} +3 -3
- package/dist/{chunk-CRMAXIUV.cjs → chunk-SZ6KMZNM.cjs} +157 -8
- package/dist/chunk-SZ6KMZNM.cjs.map +1 -0
- package/dist/{chunk-WSTEXEKD.cjs → chunk-T3QZ6S47.cjs} +92 -92
- package/dist/{chunk-WSTEXEKD.cjs.map → chunk-T3QZ6S47.cjs.map} +1 -1
- package/dist/{chunk-HEW6KDNI.js → chunk-WMBIJCHA.js} +155 -6
- package/dist/chunk-WMBIJCHA.js.map +1 -0
- package/dist/{compositor-Bc3PNP3C.d.cts → compositor-D92URMlm.d.cts} +1 -1
- package/dist/{compositor-BsYYllvR.d.ts → compositor-Kt_M4ruo.d.ts} +1 -1
- package/dist/{export-_m3Es4ru.d.cts → export-JGWQEPJn.d.cts} +3 -3
- package/dist/{export-iMrop3Jm.d.ts → export-a9bnF7Cl.d.ts} +3 -3
- package/dist/image-editor/index.cjs +627 -619
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +8 -8
- package/dist/image-editor/index.d.ts +8 -8
- package/dist/image-editor/index.js +12 -4
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{mixer-C1M1Nua_.d.cts → mixer-5ziHU8OS.d.cts} +1 -1
- package/dist/{mixer-Cu5a9Bzd.d.ts → mixer-DNqiYXYQ.d.ts} +1 -1
- package/dist/paint/index.cjs +3 -3
- package/dist/paint/index.d.cts +2 -2
- package/dist/paint/index.d.ts +2 -2
- package/dist/paint/index.js +2 -2
- package/dist/paint-editor/index.cjs +175 -127
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +18 -7
- package/dist/paint-editor/index.d.ts +18 -7
- package/dist/paint-editor/index.js +59 -11
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/raster/index.cjs +11 -3
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +4 -4
- package/dist/raster/index.d.ts +4 -4
- package/dist/raster/index.js +10 -2
- package/dist/{surface-BBJN9wxg.d.ts → surface-CkKOHGPm.d.cts} +20 -2
- package/dist/{surface-BBJN9wxg.d.cts → surface-CkKOHGPm.d.ts} +20 -2
- package/package.json +1 -1
- package/skills/pixerate-paint-editor/SKILL.md +21 -1
- package/dist/chunk-CRMAXIUV.cjs.map +0 -1
- package/dist/chunk-HEW6KDNI.js.map +0 -1
- /package/dist/{chunk-DS7KDKPX.js.map → chunk-3PHA3UKI.js.map} +0 -0
- /package/dist/{chunk-67FRIOPZ.js.map → chunk-G4BIYE6R.js.map} +0 -0
- /package/dist/{chunk-4X5MIVCE.js.map → chunk-SOROZ2BF.js.map} +0 -0
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
tilesInRect,
|
|
27
27
|
translateSurface,
|
|
28
28
|
writeRegion
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-WMBIJCHA.js";
|
|
30
30
|
|
|
31
31
|
// src/raster/blur.ts
|
|
32
32
|
function gaussianKernel(sigma) {
|
|
@@ -4652,4 +4652,4 @@ export {
|
|
|
4652
4652
|
parseDataUrl,
|
|
4653
4653
|
pngDataUrl
|
|
4654
4654
|
};
|
|
4655
|
-
//# sourceMappingURL=chunk-
|
|
4655
|
+
//# sourceMappingURL=chunk-G4BIYE6R.js.map
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkSZ6KMZNMcjs = require('./chunk-SZ6KMZNM.cjs');
|
|
12
12
|
|
|
13
13
|
// src/paint/brush.ts
|
|
14
14
|
var DEFAULT_BRUSH = {
|
|
@@ -221,41 +221,41 @@ function rasterizeDab(d, hardness, rect, out) {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
var TILE_PIXELS =
|
|
224
|
+
var TILE_PIXELS = _chunkSZ6KMZNMcjs.TILE * _chunkSZ6KMZNMcjs.TILE;
|
|
225
225
|
var CoverageMap = (_class2 = class {constructor() { _class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this); }
|
|
226
226
|
__init4() {this.tiles = /* @__PURE__ */ new Map()}
|
|
227
227
|
__init5() {this.bounds = null}
|
|
228
228
|
__init6() {this.dirty = /* @__PURE__ */ new Set()}
|
|
229
229
|
get(x, y) {
|
|
230
|
-
const tx = Math.floor(x /
|
|
231
|
-
const ty = Math.floor(y /
|
|
232
|
-
const t = this.tiles.get(
|
|
233
|
-
return t ? t[(y - ty *
|
|
230
|
+
const tx = Math.floor(x / _chunkSZ6KMZNMcjs.TILE);
|
|
231
|
+
const ty = Math.floor(y / _chunkSZ6KMZNMcjs.TILE);
|
|
232
|
+
const t = this.tiles.get(_chunkSZ6KMZNMcjs.tileKey.call(void 0, tx, ty));
|
|
233
|
+
return t ? t[(y - ty * _chunkSZ6KMZNMcjs.TILE) * _chunkSZ6KMZNMcjs.TILE + (x - tx * _chunkSZ6KMZNMcjs.TILE)] : 0;
|
|
234
234
|
}
|
|
235
235
|
/** Builds up `vals` (over `rect`) with flow towards `ceil`: `c ← c + v·(ceil − c)`. */
|
|
236
236
|
accumulate(rect, vals, ceil) {
|
|
237
237
|
if (rect.width <= 0 || rect.height <= 0) return;
|
|
238
238
|
const w = rect.width;
|
|
239
|
-
const tx0 = Math.floor(rect.x /
|
|
240
|
-
const ty0 = Math.floor(rect.y /
|
|
241
|
-
const tx1 = Math.floor((rect.x + rect.width - 1) /
|
|
242
|
-
const ty1 = Math.floor((rect.y + rect.height - 1) /
|
|
239
|
+
const tx0 = Math.floor(rect.x / _chunkSZ6KMZNMcjs.TILE);
|
|
240
|
+
const ty0 = Math.floor(rect.y / _chunkSZ6KMZNMcjs.TILE);
|
|
241
|
+
const tx1 = Math.floor((rect.x + rect.width - 1) / _chunkSZ6KMZNMcjs.TILE);
|
|
242
|
+
const ty1 = Math.floor((rect.y + rect.height - 1) / _chunkSZ6KMZNMcjs.TILE);
|
|
243
243
|
let touched = false;
|
|
244
244
|
for (let ty = ty0; ty <= ty1; ty++) {
|
|
245
245
|
for (let tx = tx0; tx <= tx1; tx++) {
|
|
246
|
-
const x0 = Math.max(rect.x, tx *
|
|
247
|
-
const y0 = Math.max(rect.y, ty *
|
|
248
|
-
const x1 = Math.min(rect.x + rect.width, tx *
|
|
249
|
-
const y1 = Math.min(rect.y + rect.height, ty *
|
|
246
|
+
const x0 = Math.max(rect.x, tx * _chunkSZ6KMZNMcjs.TILE);
|
|
247
|
+
const y0 = Math.max(rect.y, ty * _chunkSZ6KMZNMcjs.TILE);
|
|
248
|
+
const x1 = Math.min(rect.x + rect.width, tx * _chunkSZ6KMZNMcjs.TILE + _chunkSZ6KMZNMcjs.TILE);
|
|
249
|
+
const y1 = Math.min(rect.y + rect.height, ty * _chunkSZ6KMZNMcjs.TILE + _chunkSZ6KMZNMcjs.TILE);
|
|
250
250
|
let tile;
|
|
251
251
|
for (let y = y0; y < y1; y++) {
|
|
252
252
|
const row = (y - rect.y) * w;
|
|
253
|
-
const trow = (y - ty *
|
|
253
|
+
const trow = (y - ty * _chunkSZ6KMZNMcjs.TILE) * _chunkSZ6KMZNMcjs.TILE;
|
|
254
254
|
for (let x = x0; x < x1; x++) {
|
|
255
255
|
const v = vals[row + (x - rect.x)];
|
|
256
256
|
if (v <= 0) continue;
|
|
257
257
|
if (!tile) {
|
|
258
|
-
const key =
|
|
258
|
+
const key = _chunkSZ6KMZNMcjs.tileKey.call(void 0, tx, ty);
|
|
259
259
|
tile = this.tiles.get(key);
|
|
260
260
|
if (!tile) {
|
|
261
261
|
tile = new Float32Array(TILE_PIXELS);
|
|
@@ -264,7 +264,7 @@ var CoverageMap = (_class2 = class {constructor() { _class2.prototype.__init4.ca
|
|
|
264
264
|
this.dirty.add(key);
|
|
265
265
|
touched = true;
|
|
266
266
|
}
|
|
267
|
-
const ti = trow + (x - tx *
|
|
267
|
+
const ti = trow + (x - tx * _chunkSZ6KMZNMcjs.TILE);
|
|
268
268
|
const c = tile[ti];
|
|
269
269
|
if (ceil > c) tile[ti] = c + v * (ceil - c);
|
|
270
270
|
}
|
|
@@ -336,35 +336,35 @@ var StrokeCoverage = (_class3 = class {
|
|
|
336
336
|
}, _class3);
|
|
337
337
|
function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}) {
|
|
338
338
|
const out = options.into ? new Uint8ClampedArray(options.into) : new Uint8ClampedArray(tileData);
|
|
339
|
-
const ox = tx *
|
|
340
|
-
const oy = ty *
|
|
339
|
+
const ox = tx * _chunkSZ6KMZNMcjs.TILE + s.offset.x;
|
|
340
|
+
const oy = ty * _chunkSZ6KMZNMcjs.TILE + s.offset.y;
|
|
341
341
|
let x0 = 0;
|
|
342
342
|
let y0 = 0;
|
|
343
|
-
let x1 =
|
|
344
|
-
let y1 =
|
|
343
|
+
let x1 = _chunkSZ6KMZNMcjs.TILE;
|
|
344
|
+
let y1 = _chunkSZ6KMZNMcjs.TILE;
|
|
345
345
|
if (options.region) {
|
|
346
346
|
const r = options.region;
|
|
347
347
|
x0 = Math.max(0, Math.floor(r.x) - ox);
|
|
348
348
|
y0 = Math.max(0, Math.floor(r.y) - oy);
|
|
349
|
-
x1 = Math.min(
|
|
350
|
-
y1 = Math.min(
|
|
349
|
+
x1 = Math.min(_chunkSZ6KMZNMcjs.TILE, Math.ceil(r.x + r.width) - ox);
|
|
350
|
+
y1 = Math.min(_chunkSZ6KMZNMcjs.TILE, Math.ceil(r.y + r.height) - oy);
|
|
351
351
|
if (x1 <= x0 || y1 <= y0) return out;
|
|
352
352
|
if (options.into) {
|
|
353
|
-
for (let y = y0; y < y1; y++) out.set(tileData.subarray((y *
|
|
353
|
+
for (let y = y0; y < y1; y++) out.set(tileData.subarray((y * _chunkSZ6KMZNMcjs.TILE + x0) * channels, (y * _chunkSZ6KMZNMcjs.TILE + x1) * channels), (y * _chunkSZ6KMZNMcjs.TILE + x0) * channels);
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
const sel = s.selection;
|
|
357
357
|
const cb = [0, 0, 0, 0];
|
|
358
358
|
const cs = [s.color[0] / 255, s.color[1] / 255, s.color[2] / 255, s.color[3] / 255];
|
|
359
359
|
const bg = [s.background[0] / 255, s.background[1] / 255, s.background[2] / 255, s.background[3] / 255];
|
|
360
|
-
const aligned = s.offset.x %
|
|
361
|
-
const covTile = aligned ? coverage.tiles.get(
|
|
360
|
+
const aligned = s.offset.x % _chunkSZ6KMZNMcjs.TILE === 0 && s.offset.y % _chunkSZ6KMZNMcjs.TILE === 0;
|
|
361
|
+
const covTile = aligned ? coverage.tiles.get(_chunkSZ6KMZNMcjs.tileKey.call(void 0, Math.floor(ox / _chunkSZ6KMZNMcjs.TILE), Math.floor(oy / _chunkSZ6KMZNMcjs.TILE))) : void 0;
|
|
362
362
|
if (aligned && !covTile) return out;
|
|
363
363
|
for (let y = y0; y < y1; y++) {
|
|
364
364
|
const dy = oy + y;
|
|
365
365
|
for (let x = x0; x < x1; x++) {
|
|
366
366
|
const dx = ox + x;
|
|
367
|
-
const c = covTile ? covTile[y *
|
|
367
|
+
const c = covTile ? covTile[y * _chunkSZ6KMZNMcjs.TILE + x] : coverage.get(dx, dy);
|
|
368
368
|
if (c <= 0) continue;
|
|
369
369
|
let k = c * s.opacity;
|
|
370
370
|
if (sel) {
|
|
@@ -373,7 +373,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
373
373
|
}
|
|
374
374
|
if (k > 1) k = 1;
|
|
375
375
|
if (k <= 0) continue;
|
|
376
|
-
const p = y *
|
|
376
|
+
const p = y * _chunkSZ6KMZNMcjs.TILE + x;
|
|
377
377
|
if (channels === 1) {
|
|
378
378
|
const target = s.mode === "erase" ? s.background[0] : s.color[0];
|
|
379
379
|
out[p] = Math.round(out[p] + (target - out[p]) * k);
|
|
@@ -391,7 +391,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
391
391
|
const as = src[3] * k;
|
|
392
392
|
if (!(as > 0)) continue;
|
|
393
393
|
const ao = as + out[i + 3] / 255 * (1 - as);
|
|
394
|
-
|
|
394
|
+
_chunkSZ6KMZNMcjs.mixPigment8.call(void 0, out[i], out[i + 1], out[i + 2], bytes[0], bytes[1], bytes[2], as / ao, cb);
|
|
395
395
|
out[i] = Math.round(cb[0] * 255);
|
|
396
396
|
out[i + 1] = Math.round(cb[1] * 255);
|
|
397
397
|
out[i + 2] = Math.round(cb[2] * 255);
|
|
@@ -399,7 +399,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
399
399
|
continue;
|
|
400
400
|
}
|
|
401
401
|
for (let ch = 0; ch < 4; ch++) cb[ch] = out[i + ch] / 255;
|
|
402
|
-
const o =
|
|
402
|
+
const o = _chunkSZ6KMZNMcjs.blendPixel.call(void 0, s.blend, cb, src, k);
|
|
403
403
|
out[i] = Math.round(o[0] * 255);
|
|
404
404
|
out[i + 1] = Math.round(o[1] * 255);
|
|
405
405
|
out[i + 2] = Math.round(o[2] * 255);
|
|
@@ -409,7 +409,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
409
409
|
return out;
|
|
410
410
|
}
|
|
411
411
|
function coverageTileCoord(key) {
|
|
412
|
-
return
|
|
412
|
+
return _chunkSZ6KMZNMcjs.tileCoord.call(void 0, key);
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
// src/paint/mixer.ts
|
|
@@ -453,7 +453,7 @@ var MixerStroke = (_class4 = class {
|
|
|
453
453
|
this.reservoir = load.reservoir ? [load.reservoir[0], load.reservoir[1], load.reservoir[2]] : null;
|
|
454
454
|
this.amount = this.reservoir ? Math.min(1, Math.max(0, load.amount)) : 0;
|
|
455
455
|
this.pickup = load.pickup ? [load.pickup[0], load.pickup[1], load.pickup[2]] : null;
|
|
456
|
-
this.pig = this.settings.mixing === "pigment" ? { res:
|
|
456
|
+
this.pig = this.settings.mixing === "pigment" ? { res: _chunkSZ6KMZNMcjs.createPigment.call(void 0, _nullishCoalesce(this.reservoir, () => ( [0, 0, 0]))), pick: _chunkSZ6KMZNMcjs.createPigment.call(void 0, _nullishCoalesce(this.pickup, () => ( [0, 0, 0]))), paint: _chunkSZ6KMZNMcjs.createPigment.call(void 0, [0, 0, 0]), canvas: _chunkSZ6KMZNMcjs.createPigment.call(void 0, [0, 0, 0]) } : null;
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
|
|
@@ -493,7 +493,7 @@ var MixerStroke = (_class4 = class {
|
|
|
493
493
|
/** `a` mixed `t` of the way to `b` into `this.out`, by the mixing model. */
|
|
494
494
|
mix(a, pa, b, pb, t) {
|
|
495
495
|
const o = this.out;
|
|
496
|
-
if (pa && pb)
|
|
496
|
+
if (pa && pb) _chunkSZ6KMZNMcjs.lerpPigmentInto.call(void 0, pa, pb, t, o, 0);
|
|
497
497
|
else for (let c = 0; c < 3; c++) o[c] = a[c] + (b[c] - a[c]) * t;
|
|
498
498
|
return o;
|
|
499
499
|
}
|
|
@@ -522,15 +522,15 @@ var MixerStroke = (_class4 = class {
|
|
|
522
522
|
const t = this.target;
|
|
523
523
|
const lx = dx - t.offset.x;
|
|
524
524
|
const ly = dy - t.offset.y;
|
|
525
|
-
const tx = Math.floor(lx /
|
|
526
|
-
const ty = Math.floor(ly /
|
|
525
|
+
const tx = Math.floor(lx / _chunkSZ6KMZNMcjs.TILE);
|
|
526
|
+
const ty = Math.floor(ly / _chunkSZ6KMZNMcjs.TILE);
|
|
527
527
|
if (tx !== this.tx || ty !== this.ty || write && !this.writable) {
|
|
528
528
|
this.tx = tx;
|
|
529
529
|
this.ty = ty;
|
|
530
530
|
this.tile = write ? t.writeTile(tx, ty) : t.readTile(tx, ty);
|
|
531
531
|
this.writable = write;
|
|
532
532
|
}
|
|
533
|
-
return this.tile ? ((ly - ty *
|
|
533
|
+
return this.tile ? ((ly - ty * _chunkSZ6KMZNMcjs.TILE) * _chunkSZ6KMZNMcjs.TILE + (lx - tx * _chunkSZ6KMZNMcjs.TILE)) * 4 : -1;
|
|
534
534
|
}
|
|
535
535
|
dab(d, rect, cov) {
|
|
536
536
|
const { wet, mix, load } = this.settings;
|
|
@@ -563,11 +563,11 @@ var MixerStroke = (_class4 = class {
|
|
|
563
563
|
const canvas = [ar / asum, ag / asum, ab / asum];
|
|
564
564
|
if (!this.pickup) this.pickup = canvas;
|
|
565
565
|
else {
|
|
566
|
-
if (pig)
|
|
566
|
+
if (pig) _chunkSZ6KMZNMcjs.setPigmentColor.call(void 0, pig.canvas, canvas[0], canvas[1], canvas[2]);
|
|
567
567
|
const o = this.mix(this.pickup, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _ => _.pick]), () => ( null)), canvas, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _2 => _2.canvas]), () => ( null)), MIXER_PICKUP_RATE * wet * (asum / Math.max(1e-6, wsum)));
|
|
568
568
|
this.pickup = [o[0], o[1], o[2]];
|
|
569
569
|
}
|
|
570
|
-
if (pig)
|
|
570
|
+
if (pig) _chunkSZ6KMZNMcjs.setPigmentColor.call(void 0, pig.pick, this.pickup[0], this.pickup[1], this.pickup[2]);
|
|
571
571
|
}
|
|
572
572
|
const res = this.reservoir;
|
|
573
573
|
const wr = res ? this.amount * (1 - mix * wet) : 0;
|
|
@@ -575,7 +575,7 @@ var MixerStroke = (_class4 = class {
|
|
|
575
575
|
const total = wr + wp;
|
|
576
576
|
if (total > 1e-6) {
|
|
577
577
|
const paint = res && this.pickup ? [...this.mix(res, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _3 => _3.res]), () => ( null)), this.pickup, _nullishCoalesce(_optionalChain([pig, 'optionalAccess', _4 => _4.pick]), () => ( null)), wp / total)] : [..._nullishCoalesce(res, () => ( this.pickup))];
|
|
578
|
-
if (pig)
|
|
578
|
+
if (pig) _chunkSZ6KMZNMcjs.setPigmentColor.call(void 0, pig.paint, paint[0], paint[1], paint[2]);
|
|
579
579
|
const dep = Math.min(1, total) * this.brush.flow * this.brush.opacity * d.opacity;
|
|
580
580
|
if (dep > 0) this.deposit(rect, cov, paint, dep);
|
|
581
581
|
}
|
|
@@ -617,10 +617,10 @@ var MixerStroke = (_class4 = class {
|
|
|
617
617
|
} else if (pig) {
|
|
618
618
|
const key = px[i] << 16 | px[i + 1] << 8 | px[i + 2];
|
|
619
619
|
if (key !== lastKey) {
|
|
620
|
-
|
|
620
|
+
_chunkSZ6KMZNMcjs.setPigmentColor.call(void 0, pig.canvas, px[i] / 255, px[i + 1] / 255, px[i + 2] / 255);
|
|
621
621
|
lastKey = key;
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
_chunkSZ6KMZNMcjs.lerpPigmentInto.call(void 0, pig.canvas, pig.paint, share, o, 0);
|
|
624
624
|
} else {
|
|
625
625
|
for (let c = 0; c < 3; c++) o[c] = px[i + c] / 255 + (paint[c] - px[i + c] / 255) * share;
|
|
626
626
|
}
|
|
@@ -689,8 +689,8 @@ function createPigmentTools() {
|
|
|
689
689
|
const rgbs = items.map((item, i) => parseHex(item.color, i));
|
|
690
690
|
const total = items.reduce((sum, item) => sum + item.weight, 0);
|
|
691
691
|
if (!(total > 0)) throw new Error("Every weight is 0; give at least one colour a weight above 0.");
|
|
692
|
-
const pigments = rgbs.map((rgb, i) =>
|
|
693
|
-
const mixed =
|
|
692
|
+
const pigments = rgbs.map((rgb, i) => _chunkSZ6KMZNMcjs.createPigment.call(void 0, rgb, { strength: items[i].strength }));
|
|
693
|
+
const mixed = _chunkSZ6KMZNMcjs.mixPigments.call(void 0, pigments, items.map((item) => item.weight));
|
|
694
694
|
const lerp = [0, 1, 2].map((c) => rgbs.reduce((sum, rgb, i) => sum + rgb[c] * items[i].weight, 0) / total);
|
|
695
695
|
return {
|
|
696
696
|
mixed: toHex(mixed),
|
|
@@ -731,4 +731,4 @@ function createPigmentTools() {
|
|
|
731
731
|
|
|
732
732
|
|
|
733
733
|
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.DEFAULT_MIXER = DEFAULT_MIXER; exports.MIXER_PICKUP_RATE = MIXER_PICKUP_RATE; exports.MIXER_DRAIN = MIXER_DRAIN; exports.normalizeMixer = normalizeMixer; exports.EMPTY_MIXER_LOAD = EMPTY_MIXER_LOAD; exports.loadMixer = loadMixer; exports.cleanMixer = cleanMixer; exports.MixerStroke = MixerStroke; exports.createPigmentTools = createPigmentTools;
|
|
734
|
-
//# sourceMappingURL=chunk-
|
|
734
|
+
//# sourceMappingURL=chunk-HUFQD4CB.cjs.map
|