@pixerate/editor 0.116.0 → 0.117.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-ZYZGEILO.cjs → chunk-2J3LS7JZ.cjs} +203 -203
- package/dist/{chunk-ZYZGEILO.cjs.map → chunk-2J3LS7JZ.cjs.map} +1 -1
- package/dist/{chunk-TFOPHZ3U.cjs → chunk-7ISPWEJA.cjs} +302 -5
- package/dist/chunk-7ISPWEJA.cjs.map +1 -0
- package/dist/{chunk-2UT4GXYA.cjs → chunk-BYAWOAST.cjs} +109 -41
- package/dist/chunk-BYAWOAST.cjs.map +1 -0
- package/dist/{chunk-PAOWHJ5O.cjs → chunk-EBSYZRSW.cjs} +217 -400
- package/dist/chunk-EBSYZRSW.cjs.map +1 -0
- package/dist/{chunk-XK5LZKBD.js → chunk-HKDTM6VC.js} +298 -1
- package/dist/chunk-HKDTM6VC.js.map +1 -0
- package/dist/{chunk-D53VQGEJ.js → chunk-IVSNUXW7.js} +79 -2
- package/dist/chunk-IVSNUXW7.js.map +1 -0
- package/dist/{chunk-ARQ7PQ6Q.js → chunk-JHXMNOMF.js} +71 -3
- package/dist/chunk-JHXMNOMF.js.map +1 -0
- package/dist/{chunk-HOCPSFGA.cjs → chunk-L2T6EJ5S.cjs} +154 -77
- package/dist/chunk-L2T6EJ5S.cjs.map +1 -0
- package/dist/{chunk-SEBYNBHW.js → chunk-R2JE6SA7.js} +9 -9
- package/dist/{chunk-D53KSJUV.js → chunk-VD2UDVF7.js} +100 -283
- package/dist/chunk-VD2UDVF7.js.map +1 -0
- package/dist/{export-BXxSGBCq.d.cts → export-DMOuzgZZ.d.cts} +8 -3
- package/dist/{export-Dm44YUvS.d.ts → export-Dul1SbPv.d.ts} +8 -3
- package/dist/{flow-COCB42TP.d.cts → flow-4-OC-UkQ.d.cts} +22 -1
- package/dist/{flow-BMtHAmg4.d.ts → flow-Cb7lkPm8.d.ts} +22 -1
- package/dist/image-editor/index.cjs +1112 -1024
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +6 -6
- package/dist/image-editor/index.d.ts +6 -6
- package/dist/image-editor/index.js +124 -36
- package/dist/image-editor/index.js.map +1 -1
- package/dist/paint/index.cjs +8 -4
- package/dist/paint/index.cjs.map +1 -1
- package/dist/paint/index.d.cts +2 -2
- package/dist/paint/index.d.ts +2 -2
- package/dist/paint/index.js +7 -3
- package/dist/paint-editor/index.cjs +242 -242
- package/dist/paint-editor/index.d.cts +4 -4
- package/dist/paint-editor/index.d.ts +4 -4
- package/dist/paint-editor/index.js +4 -4
- package/dist/raster/index.cjs +6 -4
- package/dist/raster/index.cjs.map +1 -1
- package/dist/raster/index.d.cts +2 -2
- package/dist/raster/index.d.ts +2 -2
- package/dist/raster/index.js +27 -25
- package/dist/{render-CrmHOgpo.d.ts → render-B05K68_h.d.ts} +9 -1
- package/dist/{render-B1K_OoLy.d.cts → render-DnAbIKcs.d.cts} +9 -1
- package/dist/vector/index.cjs +11272 -10183
- package/dist/vector/index.cjs.map +1 -1
- package/dist/vector/index.d.cts +135 -1
- package/dist/vector/index.d.ts +135 -1
- package/dist/vector/index.js +11179 -10090
- package/dist/vector/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2UT4GXYA.cjs.map +0 -1
- package/dist/chunk-ARQ7PQ6Q.js.map +0 -1
- package/dist/chunk-D53KSJUV.js.map +0 -1
- package/dist/chunk-D53VQGEJ.js.map +0 -1
- package/dist/chunk-HOCPSFGA.cjs.map +0 -1
- package/dist/chunk-PAOWHJ5O.cjs.map +0 -1
- package/dist/chunk-TFOPHZ3U.cjs.map +0 -1
- package/dist/chunk-XK5LZKBD.js.map +0 -1
- /package/dist/{chunk-SEBYNBHW.js.map → chunk-R2JE6SA7.js.map} +0 -0
|
@@ -7,12 +7,15 @@ import {
|
|
|
7
7
|
finishTile,
|
|
8
8
|
lerpPigmentInto,
|
|
9
9
|
mixPigment8,
|
|
10
|
+
mixPigmentRgb,
|
|
10
11
|
mixPigments,
|
|
11
12
|
pigment8,
|
|
12
13
|
setPigmentColor,
|
|
14
|
+
srgbDecode,
|
|
15
|
+
srgbEncode,
|
|
13
16
|
tileCoord,
|
|
14
17
|
tileKey
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HKDTM6VC.js";
|
|
16
19
|
|
|
17
20
|
// src/paint/brush.ts
|
|
18
21
|
var DEFAULT_BRUSH = {
|
|
@@ -412,6 +415,79 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
412
415
|
}
|
|
413
416
|
return out;
|
|
414
417
|
}
|
|
418
|
+
function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
419
|
+
const linear = samples instanceof Float32Array;
|
|
420
|
+
const scale = linear ? 1 : 65535;
|
|
421
|
+
const out = (options.into ?? samples).slice();
|
|
422
|
+
const ox = tx * TILE + s.offset.x;
|
|
423
|
+
const oy = ty * TILE + s.offset.y;
|
|
424
|
+
let x0 = 0;
|
|
425
|
+
let y0 = 0;
|
|
426
|
+
let x1 = TILE;
|
|
427
|
+
let y1 = TILE;
|
|
428
|
+
if (options.region) {
|
|
429
|
+
const r = options.region;
|
|
430
|
+
x0 = Math.max(0, Math.floor(r.x) - ox);
|
|
431
|
+
y0 = Math.max(0, Math.floor(r.y) - oy);
|
|
432
|
+
x1 = Math.min(TILE, Math.ceil(r.x + r.width) - ox);
|
|
433
|
+
y1 = Math.min(TILE, Math.ceil(r.y + r.height) - oy);
|
|
434
|
+
if (x1 <= x0 || y1 <= y0) return out;
|
|
435
|
+
if (options.into) for (let y = y0; y < y1; y++) out.set(samples.subarray((y * TILE + x0) * 4, (y * TILE + x1) * 4), (y * TILE + x0) * 4);
|
|
436
|
+
}
|
|
437
|
+
const colour = (c) => {
|
|
438
|
+
const v = [c[0] / 255, c[1] / 255, c[2] / 255, c[3] / 255];
|
|
439
|
+
if (linear) for (let k = 0; k < 3; k++) v[k] = srgbDecode(v[k]);
|
|
440
|
+
return v;
|
|
441
|
+
};
|
|
442
|
+
const src = colour(s.mode === "erase" ? s.background : s.color);
|
|
443
|
+
const sel = s.selection;
|
|
444
|
+
const cb = [0, 0, 0, 0];
|
|
445
|
+
const mix = [0, 0, 0];
|
|
446
|
+
const encCb = [0, 0, 0];
|
|
447
|
+
const encSrc = linear ? [srgbEncode(src[0]), srgbEncode(src[1]), srgbEncode(src[2])] : src;
|
|
448
|
+
const put = (i, v) => {
|
|
449
|
+
out[i] = linear ? v : v <= 0 ? 0 : v >= 1 ? 65535 : Math.round(v * 65535);
|
|
450
|
+
};
|
|
451
|
+
for (let y = y0; y < y1; y++) {
|
|
452
|
+
const dy = oy + y;
|
|
453
|
+
for (let x = x0; x < x1; x++) {
|
|
454
|
+
const dx = ox + x;
|
|
455
|
+
const c = coverage.get(dx, dy);
|
|
456
|
+
if (c <= 0) continue;
|
|
457
|
+
let k = c * s.opacity;
|
|
458
|
+
if (sel) {
|
|
459
|
+
if (dx < 0 || dy < 0 || dx >= sel.width || dy >= sel.height) continue;
|
|
460
|
+
k *= sel.data[dy * sel.width + dx] / 255;
|
|
461
|
+
}
|
|
462
|
+
if (k > 1) k = 1;
|
|
463
|
+
if (k <= 0) continue;
|
|
464
|
+
const i = (y * TILE + x) * 4;
|
|
465
|
+
if (s.mode === "erase" && !s.lockTransparency) {
|
|
466
|
+
put(i + 3, out[i + 3] / scale * (1 - k));
|
|
467
|
+
if (out[i + 3] === 0) out[i] = out[i + 1] = out[i + 2] = 0;
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
if (s.lockTransparency && out[i + 3] === 0) continue;
|
|
471
|
+
for (let ch = 0; ch < 4; ch++) cb[ch] = out[i + ch] / scale;
|
|
472
|
+
if (s.blend === "pigment") {
|
|
473
|
+
const as = src[3] * k;
|
|
474
|
+
if (!(as > 0)) continue;
|
|
475
|
+
const ao = as + cb[3] * (1 - as);
|
|
476
|
+
for (let ch = 0; ch < 3; ch++) encCb[ch] = linear ? srgbEncode(cb[ch]) : cb[ch];
|
|
477
|
+
mixPigmentRgb(encCb, encSrc, as / ao, mix);
|
|
478
|
+
for (let ch = 0; ch < 3; ch++) put(i + ch, linear ? srgbDecode(mix[ch]) : mix[ch]);
|
|
479
|
+
if (!s.lockTransparency) put(i + 3, ao);
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
const o = blendPixel(s.blend, cb, src, k);
|
|
483
|
+
put(i, o[0]);
|
|
484
|
+
put(i + 1, o[1]);
|
|
485
|
+
put(i + 2, o[2]);
|
|
486
|
+
if (!s.lockTransparency) put(i + 3, o[3]);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return out;
|
|
490
|
+
}
|
|
415
491
|
function coverageTileCoord(key) {
|
|
416
492
|
return tileCoord(key);
|
|
417
493
|
}
|
|
@@ -3157,6 +3233,7 @@ export {
|
|
|
3157
3233
|
CoverageMap,
|
|
3158
3234
|
StrokeCoverage,
|
|
3159
3235
|
applyStrokeToTile,
|
|
3236
|
+
applyStrokeToDeepTile,
|
|
3160
3237
|
coverageTileCoord,
|
|
3161
3238
|
MIXING_MODELS,
|
|
3162
3239
|
EMPTY_MIXER_LOAD,
|
|
@@ -3259,4 +3336,4 @@ export {
|
|
|
3259
3336
|
flowField,
|
|
3260
3337
|
WetMedium
|
|
3261
3338
|
};
|
|
3262
|
-
//# sourceMappingURL=chunk-
|
|
3339
|
+
//# sourceMappingURL=chunk-IVSNUXW7.js.map
|