@pixerate/editor 0.248.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-DTDPFBLC.cjs → brushstrokeRender-GCKK7V2I.cjs} +14 -11
- package/dist/{brushstrokeRender-QLCXROJK.js → brushstrokeRender-T3JZST44.js} +7 -4
- package/dist/canvas/index.cjs +8 -8
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-IBDU6EGZ.cjs → chunk-2SMMZDMG.cjs} +35 -35
- package/dist/{chunk-SC2RZ5EF.js → chunk-2VJAVXLI.js} +2 -2
- 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-NZ3O3A5C.js → chunk-6BIDVPED.js} +1 -1
- package/dist/{chunk-2ONK3ERD.cjs → chunk-75K3W4D6.cjs} +20 -20
- package/dist/{chunk-7T7JWTVE.cjs → chunk-BOHDJJ2O.cjs} +8 -8
- package/dist/{chunk-2PBZBRP5.js → chunk-D5KGAO4Z.js} +10 -92
- package/dist/{chunk-5GLYUSNT.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-6G6ZDDDB.cjs → chunk-H4AOUUBE.cjs} +301 -149
- package/dist/{chunk-PQ3H2AAN.cjs → chunk-I7NJPHWV.cjs} +122 -204
- package/dist/{chunk-L6REDLNB.cjs → chunk-IOFVM3L3.cjs} +7 -7
- package/dist/{chunk-42TWUPNJ.js → chunk-IRSTHLQQ.js} +1 -320
- package/dist/{chunk-VNBUDVD4.js → chunk-J7T5QZ45.js} +226 -74
- package/dist/{chunk-VMROIWLL.cjs → chunk-KBYB7OWB.cjs} +3 -3
- package/dist/{chunk-TPWB4Y6L.cjs → chunk-KYX7NZ5V.cjs} +1 -1
- package/dist/chunk-LJRCU3BJ.cjs +301 -0
- package/dist/{chunk-WVS5KQDH.cjs → chunk-LP2MCSBE.cjs} +246 -244
- package/dist/{chunk-XNRBMYNB.js → chunk-O75V4ZS3.js} +1 -1
- package/dist/chunk-OTTT5N3K.js +322 -0
- package/dist/{chunk-Q2HA52V4.js → chunk-PZP2SZIZ.js} +2 -2
- package/dist/{chunk-ZFSLEOSQ.js → chunk-UBRJOIR5.js} +11 -9
- package/dist/chunk-W5M3J7PV.cjs +322 -0
- package/dist/{chunk-4P6H35HU.js → chunk-WA44NKPF.js} +2 -2
- package/dist/{chunk-XWTRATIM.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/index.cjs +1055 -1050
- package/dist/image-editor/index.js +28 -23
- package/dist/paint/index.cjs +8 -5
- package/dist/paint/index.js +13 -10
- package/dist/paint-editor/controller.d.cts +37 -1
- package/dist/paint-editor/controller.d.ts +37 -1
- package/dist/paint-editor/index.cjs +745 -602
- package/dist/paint-editor/index.d.cts +3 -0
- package/dist/paint-editor/index.d.ts +3 -0
- package/dist/paint-editor/index.js +184 -41
- 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/ui.d.cts +10 -2
- package/dist/paint-editor/ui.d.ts +10 -2
- package/dist/raster/index.cjs +6 -4
- package/dist/raster/index.js +12 -10
- 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 +8 -5
- package/skills/pixerate-stickers/SKILL.md +45 -0
|
@@ -1,4 +1,10 @@
|
|
|
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; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9;
|
|
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; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk3K6HWEXZcjs = require('./chunk-3K6HWEXZ.cjs');
|
|
7
|
+
|
|
2
8
|
|
|
3
9
|
|
|
4
10
|
var _chunkYQGCPL5Xcjs = require('./chunk-YQGCPL5X.cjs');
|
|
@@ -13,9 +19,10 @@ var _chunkYQGCPL5Xcjs = require('./chunk-YQGCPL5X.cjs');
|
|
|
13
19
|
|
|
14
20
|
|
|
15
21
|
|
|
22
|
+
var _chunk2VX55NFMcjs = require('./chunk-2VX55NFM.cjs');
|
|
16
23
|
|
|
17
|
-
var _chunkOLNIPTB3cjs = require('./chunk-OLNIPTB3.cjs');
|
|
18
24
|
|
|
25
|
+
var _chunkW5M3J7PVcjs = require('./chunk-W5M3J7PV.cjs');
|
|
19
26
|
|
|
20
27
|
|
|
21
28
|
|
|
@@ -24,91 +31,8 @@ var _chunkOLNIPTB3cjs = require('./chunk-OLNIPTB3.cjs');
|
|
|
24
31
|
|
|
25
32
|
|
|
26
33
|
|
|
27
|
-
var _chunk474IQG74cjs = require('./chunk-474IQG74.cjs');
|
|
28
34
|
|
|
29
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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 = class {
|
|
85
|
-
constructor(size, cellsX, cellsY, octaves, salt) {;_class.prototype.__init.call(this);
|
|
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
|
-
|
|
96
|
-
__init() {this.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
|
-
}, _class);
|
|
35
|
+
var _chunk474IQG74cjs = require('./chunk-474IQG74.cjs');
|
|
112
36
|
|
|
113
37
|
// src/paint/gradient-paint.ts
|
|
114
38
|
var PAINT_GRADIENT_SPACES = ["pigment", "oklab", "srgb"];
|
|
@@ -316,7 +240,7 @@ var PaintGradientSampler = class {
|
|
|
316
240
|
return out;
|
|
317
241
|
}
|
|
318
242
|
if (this.source.space === "pigment") {
|
|
319
|
-
|
|
243
|
+
_chunk2VX55NFMcjs.mixPigment8.call(void 0, q8(ar[0]), q8(ar[1]), q8(ar[2]), q8(br[0]), q8(br[1]), q8(br[2]), v, mixScratch);
|
|
320
244
|
out.rgb = [mixScratch[0], mixScratch[1], mixScratch[2]];
|
|
321
245
|
} else if (this.source.space === "oklab") {
|
|
322
246
|
const la = a.lab;
|
|
@@ -381,7 +305,7 @@ var PaintGradientSampler = class {
|
|
|
381
305
|
case "time":
|
|
382
306
|
return this.along(_nullishCoalesce(d.time, () => ( 0)), map.duration, _nullishCoalesce(map.repeat, () => ( "clamp")), out);
|
|
383
307
|
case "random":
|
|
384
|
-
return this.sample(rand01(this.seed, Math.floor(d.index / (_nullishCoalesce(map.every, () => ( 1)))), RANDOM_STREAM), out);
|
|
308
|
+
return this.sample(_chunk3K6HWEXZcjs.rand01.call(void 0, this.seed, Math.floor(d.index / (_nullishCoalesce(map.every, () => ( 1)))), RANDOM_STREAM), out);
|
|
385
309
|
default:
|
|
386
310
|
return this.sample(0.5, out);
|
|
387
311
|
}
|
|
@@ -656,21 +580,21 @@ function smoothPoints(points, amount) {
|
|
|
656
580
|
return out;
|
|
657
581
|
}
|
|
658
582
|
var pressureOf = (p) => typeof p.pressure === "number" && Number.isFinite(p.pressure) ? Math.min(1, Math.max(0, p.pressure)) : 1;
|
|
659
|
-
var DabWalker = (
|
|
660
|
-
constructor(brush) {;
|
|
583
|
+
var DabWalker = (_class = class {
|
|
584
|
+
constructor(brush) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);
|
|
661
585
|
this.brush = brush;
|
|
662
586
|
}
|
|
663
587
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
588
|
+
__init() {this.last = null}
|
|
589
|
+
__init2() {this.nextAt = 0}
|
|
590
|
+
__init3() {this.pendingFirst = null}
|
|
591
|
+
__init4() {this.index = 0}
|
|
592
|
+
__init5() {this.travelled = 0}
|
|
593
|
+
__init6() {this.dir = 0}
|
|
594
|
+
__init7() {this.firstT = null}
|
|
595
|
+
__init8() {this.lastSpeedT = null}
|
|
596
|
+
__init9() {this.lastSpeedAt = null}
|
|
597
|
+
__init10() {this.speed = null}
|
|
674
598
|
diameter(p) {
|
|
675
599
|
return this.brush.pressureSize ? this.brush.size * pressureOf(p) : this.brush.size;
|
|
676
600
|
}
|
|
@@ -743,7 +667,7 @@ var DabWalker = (_class2 = class {
|
|
|
743
667
|
this.pendingFirst = null;
|
|
744
668
|
}
|
|
745
669
|
}
|
|
746
|
-
},
|
|
670
|
+
}, _class);
|
|
747
671
|
function walkDabs(points, brush) {
|
|
748
672
|
const w = new DabWalker(brush);
|
|
749
673
|
const out = [];
|
|
@@ -801,16 +725,16 @@ function rasterizeDab(d, hardness, rect, out) {
|
|
|
801
725
|
}
|
|
802
726
|
}
|
|
803
727
|
var TILE_PIXELS = _chunk474IQG74cjs.TILE * _chunk474IQG74cjs.TILE;
|
|
804
|
-
var CoverageMap = (
|
|
805
|
-
|
|
728
|
+
var CoverageMap = (_class2 = class {constructor() { _class2.prototype.__init11.call(this);_class2.prototype.__init12.call(this);_class2.prototype.__init13.call(this);_class2.prototype.__init14.call(this); }
|
|
729
|
+
__init11() {this.tiles = /* @__PURE__ */ new Map()}
|
|
806
730
|
/**
|
|
807
731
|
* Gradient paint: the colour laid at each pixel (sRGB 0..1, 3 per pixel), when dabs carry their
|
|
808
732
|
* own colours. Each dab blends its colour in by the share of coverage it adds. Missing: the
|
|
809
733
|
* stroke's one colour (`StrokeApply.color`).
|
|
810
734
|
*/
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
735
|
+
__init12() {this.colors = /* @__PURE__ */ new Map()}
|
|
736
|
+
__init13() {this.bounds = null}
|
|
737
|
+
__init14() {this.dirty = /* @__PURE__ */ new Set()}
|
|
814
738
|
/** The colour at a pixel (gradient paint), or `null` when the stroke has one colour there. */
|
|
815
739
|
colorAt(x, y, out) {
|
|
816
740
|
const tx = Math.floor(x / _chunk474IQG74cjs.TILE);
|
|
@@ -898,16 +822,16 @@ var CoverageMap = (_class3 = class {constructor() { _class3.prototype.__init12.c
|
|
|
898
822
|
this.dirty.clear();
|
|
899
823
|
return out;
|
|
900
824
|
}
|
|
901
|
-
},
|
|
825
|
+
}, _class2);
|
|
902
826
|
function unionRect(a, b) {
|
|
903
827
|
if (!a) return { ...b };
|
|
904
828
|
const x = Math.min(a.x, b.x);
|
|
905
829
|
const y = Math.min(a.y, b.y);
|
|
906
830
|
return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
|
|
907
831
|
}
|
|
908
|
-
var StrokeCoverage = (
|
|
832
|
+
var StrokeCoverage = (_class3 = class {
|
|
909
833
|
/** `paint`: a gradient source (resolved: no `paint` / `secondary` stops) for gradient paint; `seed` for its `random` mapping. */
|
|
910
|
-
constructor(brush, paint = null, seed = 0) {;
|
|
834
|
+
constructor(brush, paint = null, seed = 0) {;_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);_class3.prototype.__init18.call(this);_class3.prototype.__init19.call(this);_class3.prototype.__init20.call(this);
|
|
911
835
|
this.brush = brush;
|
|
912
836
|
this.walker = new DabWalker(brush);
|
|
913
837
|
this.smoothing = brush.smoothing;
|
|
@@ -915,16 +839,16 @@ var StrokeCoverage = (_class4 = class {
|
|
|
915
839
|
this.tipTable = _optionalChain([this, 'access', _3 => _3.sampler, 'optionalAccess', _4 => _4.acrossTip]) ? this.sampler.tipTable(TIP_GRADIENT_STEPS) : null;
|
|
916
840
|
}
|
|
917
841
|
|
|
918
|
-
|
|
842
|
+
__init15() {this.coverage = new CoverageMap()}
|
|
919
843
|
|
|
920
844
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
845
|
+
__init16() {this.smoothPos = null}
|
|
846
|
+
__init17() {this.buf = new Float32Array(0)}
|
|
847
|
+
__init18() {this.field = new Float32Array(0)}
|
|
924
848
|
|
|
925
849
|
|
|
926
|
-
|
|
927
|
-
|
|
850
|
+
__init19() {this.sample = { rgb: [0, 0, 0], alpha: 1 }}
|
|
851
|
+
__init20() {this.dabCount = 0}
|
|
928
852
|
/** Feeds input points; returns the document rectangles the new dabs touched. */
|
|
929
853
|
push(points) {
|
|
930
854
|
const dabs = [];
|
|
@@ -966,7 +890,7 @@ var StrokeCoverage = (_class4 = class {
|
|
|
966
890
|
this.field = scratch.field;
|
|
967
891
|
this.coverage.accumulate(rect, vals, d.opacity, color, field);
|
|
968
892
|
}
|
|
969
|
-
},
|
|
893
|
+
}, _class3);
|
|
970
894
|
var TIP_GRADIENT_STEPS = 32;
|
|
971
895
|
function gradientDabColor(sampler, tipTable, d, params, rect, vals, scratch) {
|
|
972
896
|
if (!tipTable) {
|
|
@@ -1056,7 +980,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
1056
980
|
const as = src[3] * k;
|
|
1057
981
|
if (!(as > 0)) continue;
|
|
1058
982
|
const ao = as + out[i + 3] / 255 * (1 - as);
|
|
1059
|
-
|
|
983
|
+
_chunk2VX55NFMcjs.mixPigment8.call(void 0, out[i], out[i + 1], out[i + 2], bytes[0], bytes[1], bytes[2], as / ao, cb);
|
|
1060
984
|
out[i] = Math.round(cb[0] * 255);
|
|
1061
985
|
out[i + 1] = Math.round(cb[1] * 255);
|
|
1062
986
|
out[i + 2] = Math.round(cb[2] * 255);
|
|
@@ -1064,7 +988,7 @@ function applyStrokeToTile(coverage, tileData, channels, tx, ty, s, options = {}
|
|
|
1064
988
|
continue;
|
|
1065
989
|
}
|
|
1066
990
|
for (let ch = 0; ch < 4; ch++) cb[ch] = out[i + ch] / 255;
|
|
1067
|
-
const o =
|
|
991
|
+
const o = _chunk2VX55NFMcjs.blendPixel.call(void 0, s.blend, cb, src, k);
|
|
1068
992
|
out[i] = Math.round(o[0] * 255);
|
|
1069
993
|
out[i + 1] = Math.round(o[1] * 255);
|
|
1070
994
|
out[i + 2] = Math.round(o[2] * 255);
|
|
@@ -1096,7 +1020,7 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1096
1020
|
const grey = (s.mode === "erase" ? s.background[0] : s.color[0]) / 255 * scale;
|
|
1097
1021
|
const colour = (c) => {
|
|
1098
1022
|
const v = [c[0] / 255, c[1] / 255, c[2] / 255, c[3] / 255];
|
|
1099
|
-
if (linear) for (let k = 0; k < 3; k++) v[k] =
|
|
1023
|
+
if (linear) for (let k = 0; k < 3; k++) v[k] = _chunk2VX55NFMcjs.srgbDecode.call(void 0, v[k]);
|
|
1100
1024
|
return v;
|
|
1101
1025
|
};
|
|
1102
1026
|
const src0 = colour(s.mode === "erase" ? s.background : s.color);
|
|
@@ -1108,7 +1032,7 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1108
1032
|
const cb = [0, 0, 0, 0];
|
|
1109
1033
|
const mix = [0, 0, 0];
|
|
1110
1034
|
const encCb = [0, 0, 0];
|
|
1111
|
-
const encSrc0 = linear ? [
|
|
1035
|
+
const encSrc0 = linear ? [_chunk2VX55NFMcjs.srgbEncode.call(void 0, src0[0]), _chunk2VX55NFMcjs.srgbEncode.call(void 0, src0[1]), _chunk2VX55NFMcjs.srgbEncode.call(void 0, src0[2])] : src0;
|
|
1112
1036
|
const put = (i, v) => {
|
|
1113
1037
|
out[i] = linear ? v : v <= 0 ? 0 : v >= 1 ? 65535 : Math.round(v * 65535);
|
|
1114
1038
|
};
|
|
@@ -1128,7 +1052,7 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1128
1052
|
if (k <= 0) continue;
|
|
1129
1053
|
src = src0;
|
|
1130
1054
|
if (pixelColor) {
|
|
1131
|
-
for (let ch = 0; ch < 3; ch++) ownSrc[ch] = linear ?
|
|
1055
|
+
for (let ch = 0; ch < 3; ch++) ownSrc[ch] = linear ? _chunk2VX55NFMcjs.srgbDecode.call(void 0, own[ch]) : own[ch];
|
|
1132
1056
|
src = ownSrc;
|
|
1133
1057
|
}
|
|
1134
1058
|
if (n === 1) {
|
|
@@ -1150,13 +1074,13 @@ function applyStrokeToDeepTile(coverage, samples, tx, ty, s, options = {}) {
|
|
|
1150
1074
|
const as = src[3] * k;
|
|
1151
1075
|
if (!(as > 0)) continue;
|
|
1152
1076
|
const ao = as + cb[3] * (1 - as);
|
|
1153
|
-
for (let ch = 0; ch < 3; ch++) encCb[ch] = linear ?
|
|
1154
|
-
|
|
1155
|
-
for (let ch = 0; ch < 3; ch++) put(i + ch, linear ?
|
|
1077
|
+
for (let ch = 0; ch < 3; ch++) encCb[ch] = linear ? _chunk2VX55NFMcjs.srgbEncode.call(void 0, cb[ch]) : cb[ch];
|
|
1078
|
+
_chunk2VX55NFMcjs.mixPigmentRgb.call(void 0, encCb, pixelColor ? own : encSrc0, as / ao, mix);
|
|
1079
|
+
for (let ch = 0; ch < 3; ch++) put(i + ch, linear ? _chunk2VX55NFMcjs.srgbDecode.call(void 0, mix[ch]) : mix[ch]);
|
|
1156
1080
|
if (!s.lockTransparency) put(i + 3, ao);
|
|
1157
1081
|
continue;
|
|
1158
1082
|
}
|
|
1159
|
-
const o =
|
|
1083
|
+
const o = _chunk2VX55NFMcjs.blendPixel.call(void 0, s.blend, cb, src, k);
|
|
1160
1084
|
put(i, o[0]);
|
|
1161
1085
|
put(i + 1, o[1]);
|
|
1162
1086
|
put(i + 2, o[2]);
|
|
@@ -1177,31 +1101,31 @@ function patternHeights(pattern, n, seed) {
|
|
|
1177
1101
|
const out = new Float32Array(n * n);
|
|
1178
1102
|
const salt = Math.imul(seed | 0, 2654435761) + 17;
|
|
1179
1103
|
if (pattern === "smooth") return out.fill(1);
|
|
1180
|
-
const noise = (cx, cy, oct, s = 0) => new TileableNoise(n, cx, cy, oct, salt + s);
|
|
1104
|
+
const noise = (cx, cy, oct, s = 0) => new (0, _chunk3K6HWEXZcjs.TileableNoise)(n, cx, cy, oct, salt + s);
|
|
1181
1105
|
const k = n / GRAIN_TILE;
|
|
1182
1106
|
switch (pattern) {
|
|
1183
1107
|
case "cold-pressed": {
|
|
1184
1108
|
const base = noise(20 * k, 20 * k, 4);
|
|
1185
1109
|
const fine = noise(64 * k, 64 * k, 2, 3);
|
|
1186
1110
|
for (let y = 0; y < n; y++)
|
|
1187
|
-
for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.8 + 0.5 + (fine.at(x, y) - 0.5) * 0.5 + (hash2(x, y, salt) - 0.5) * 0.12);
|
|
1111
|
+
for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.8 + 0.5 + (fine.at(x, y) - 0.5) * 0.5 + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.12);
|
|
1188
1112
|
break;
|
|
1189
1113
|
}
|
|
1190
1114
|
case "hot-pressed": {
|
|
1191
1115
|
const base = noise(40 * k, 40 * k, 3);
|
|
1192
|
-
for (let y = 0; y < n; y++) for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.1 + 0.6 + (hash2(x, y, salt) - 0.5) * 0.08);
|
|
1116
|
+
for (let y = 0; y < n; y++) for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.1 + 0.6 + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.08);
|
|
1193
1117
|
break;
|
|
1194
1118
|
}
|
|
1195
1119
|
case "rough": {
|
|
1196
1120
|
const base = noise(10 * k, 10 * k, 5);
|
|
1197
1121
|
const blot = noise(28 * k, 28 * k, 2, 5);
|
|
1198
1122
|
for (let y = 0; y < n; y++)
|
|
1199
|
-
for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 2.4 + 0.5 + (blot.at(x, y) - 0.5) * 0.7 + (hash2(x, y, salt) - 0.5) * 0.15);
|
|
1123
|
+
for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 2.4 + 0.5 + (blot.at(x, y) - 0.5) * 0.7 + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.15);
|
|
1200
1124
|
break;
|
|
1201
1125
|
}
|
|
1202
1126
|
case "vellum": {
|
|
1203
1127
|
const base = noise(40 * k, 40 * k, 3);
|
|
1204
|
-
for (let y = 0; y < n; y++) for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.6 + 0.55 + (hash2(x, y, salt) - 0.5) * 0.2);
|
|
1128
|
+
for (let y = 0; y < n; y++) for (let x = 0; x < n; x++) out[y * n + x] = clamp01((base.at(x, y) - 0.5) * 1.6 + 0.55 + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.2);
|
|
1205
1129
|
break;
|
|
1206
1130
|
}
|
|
1207
1131
|
case "laid": {
|
|
@@ -1222,7 +1146,7 @@ function patternHeights(pattern, n, seed) {
|
|
|
1222
1146
|
const base = noise(16 * k, 16 * k, 3, 7);
|
|
1223
1147
|
for (let y = 0; y < n; y++)
|
|
1224
1148
|
for (let x = 0; x < n; x++) {
|
|
1225
|
-
const g = hash2(x, y, salt ^ 85);
|
|
1149
|
+
const g = _chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt ^ 85);
|
|
1226
1150
|
out[y * n + x] = clamp01((fibres.at(x, y) - 0.5) * 1.5 + (base.at(x, y) - 0.5) * 0.7 + 0.55 + (g < 0.1 ? -0.3 : 0));
|
|
1227
1151
|
}
|
|
1228
1152
|
break;
|
|
@@ -1231,7 +1155,7 @@ function patternHeights(pattern, n, seed) {
|
|
|
1231
1155
|
const grit = noise(96 * k, 96 * k, 2);
|
|
1232
1156
|
for (let y = 0; y < n; y++)
|
|
1233
1157
|
for (let x = 0; x < n; x++) {
|
|
1234
|
-
const h = hash2(x, y, salt);
|
|
1158
|
+
const h = _chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt);
|
|
1235
1159
|
out[y * n + x] = clamp01((grit.at(x, y) - 0.5) * 2.4 + 0.5 + (h - 0.5) * 0.7);
|
|
1236
1160
|
}
|
|
1237
1161
|
break;
|
|
@@ -1252,7 +1176,7 @@ function patternHeights(pattern, n, seed) {
|
|
|
1252
1176
|
const weft = Math.sin(Math.PI * (fy - cy));
|
|
1253
1177
|
const top = (cx + cy) % 2 === 0 ? warp : weft;
|
|
1254
1178
|
const irregular = pattern === "linen" ? (slub.at(x, y) - 0.5) * 0.5 : 0;
|
|
1255
|
-
out[y * n + x] = clamp01(0.2 + 0.7 * top + irregular + (hash2(x, y, salt) - 0.5) * 0.15);
|
|
1179
|
+
out[y * n + x] = clamp01(0.2 + 0.7 * top + irregular + (_chunk3K6HWEXZcjs.hash2.call(void 0, x, y, salt) - 0.5) * 0.15);
|
|
1256
1180
|
}
|
|
1257
1181
|
break;
|
|
1258
1182
|
}
|
|
@@ -1277,15 +1201,15 @@ function grainHeights(pattern, seed, size = GRAIN_TILE) {
|
|
|
1277
1201
|
}
|
|
1278
1202
|
return h;
|
|
1279
1203
|
}
|
|
1280
|
-
var PaperGrain = (
|
|
1281
|
-
|
|
1204
|
+
var PaperGrain = (_class4 = class {
|
|
1205
|
+
__init21() {this.size = GRAIN_TILE}
|
|
1282
1206
|
|
|
1283
1207
|
|
|
1284
1208
|
|
|
1285
1209
|
|
|
1286
1210
|
|
|
1287
1211
|
|
|
1288
|
-
constructor(paper, media = "dry") {;
|
|
1212
|
+
constructor(paper, media = "dry") {;_class4.prototype.__init21.call(this);
|
|
1289
1213
|
const raw = grainHeights(paper.pattern, paper.seed);
|
|
1290
1214
|
const t = paper[media];
|
|
1291
1215
|
this.flat = paper.pattern === "smooth";
|
|
@@ -1328,7 +1252,7 @@ var PaperGrain = (_class5 = class {
|
|
|
1328
1252
|
const bot = h[d + a] + (h[d + b] - h[d + a]) * fx;
|
|
1329
1253
|
return top + (bot - top) * fy;
|
|
1330
1254
|
}
|
|
1331
|
-
},
|
|
1255
|
+
}, _class4);
|
|
1332
1256
|
function grainCatch(h, depth, pressure) {
|
|
1333
1257
|
if (depth <= 0) return 1;
|
|
1334
1258
|
const t = depth * (0.75 - 0.65 * Math.min(1, Math.max(0, pressure)));
|
|
@@ -1385,11 +1309,11 @@ function pathStrokeDabs(samples, options) {
|
|
|
1385
1309
|
let opacity = brush.opacity * op;
|
|
1386
1310
|
const j = options.jitter;
|
|
1387
1311
|
if (j) {
|
|
1388
|
-
if (j.size) diameter *= Math.max(0.05, 1 + j.size * randSigned(j.seed, i, JITTER_SIZE));
|
|
1389
|
-
if (j.angle) angle += j.angle * Math.PI * randSigned(j.seed, i, JITTER_ANGLE);
|
|
1390
|
-
if (j.opacity) opacity *= 1 - j.opacity * (randSigned(j.seed, i, JITTER_OPACITY) * 0.5 + 0.5);
|
|
1312
|
+
if (j.size) diameter *= Math.max(0.05, 1 + j.size * _chunk3K6HWEXZcjs.randSigned.call(void 0, j.seed, i, JITTER_SIZE));
|
|
1313
|
+
if (j.angle) angle += j.angle * Math.PI * _chunk3K6HWEXZcjs.randSigned.call(void 0, j.seed, i, JITTER_ANGLE);
|
|
1314
|
+
if (j.opacity) opacity *= 1 - j.opacity * (_chunk3K6HWEXZcjs.randSigned.call(void 0, j.seed, i, JITTER_OPACITY) * 0.5 + 0.5);
|
|
1391
1315
|
if (j.scatter) {
|
|
1392
|
-
const off = j.scatter * diameter * randSigned(j.seed, i, JITTER_SCATTER);
|
|
1316
|
+
const off = j.scatter * diameter * _chunk3K6HWEXZcjs.randSigned.call(void 0, j.seed, i, JITTER_SCATTER);
|
|
1393
1317
|
x += Math.sin(dir) * off;
|
|
1394
1318
|
y += Math.cos(dir) * off;
|
|
1395
1319
|
}
|
|
@@ -1649,7 +1573,7 @@ function renderBrushstroke(input, brush, options = {}) {
|
|
|
1649
1573
|
}
|
|
1650
1574
|
function brushstrokeDataUrl(stroke) {
|
|
1651
1575
|
const { width, height, data } = stroke.image;
|
|
1652
|
-
return width && height ?
|
|
1576
|
+
return width && height ? _chunkW5M3J7PVcjs.pngDataUrl.call(void 0, width, height, data) : "";
|
|
1653
1577
|
}
|
|
1654
1578
|
function brushstrokeToCanvas(stroke, createCanvas) {
|
|
1655
1579
|
const { width, height, data } = stroke.image;
|
|
@@ -1677,14 +1601,14 @@ function brushstrokeKey(input, brush, options = {}) {
|
|
|
1677
1601
|
const scale = finite2(options.scale) ? options.scale : 1;
|
|
1678
1602
|
return `${hashString(path).toString(16)}:${path.length}:${hashString(rest2).toString(16)}:${scale}`;
|
|
1679
1603
|
}
|
|
1680
|
-
var BrushstrokeCache = (
|
|
1681
|
-
constructor(capacity = 64) {;
|
|
1604
|
+
var BrushstrokeCache = (_class5 = class {
|
|
1605
|
+
constructor(capacity = 64) {;_class5.prototype.__init22.call(this);_class5.prototype.__init23.call(this);
|
|
1682
1606
|
this.capacity = capacity;
|
|
1683
1607
|
}
|
|
1684
1608
|
|
|
1685
|
-
|
|
1609
|
+
__init22() {this.entries = /* @__PURE__ */ new Map()}
|
|
1686
1610
|
/** Renders that missed the cache (for tests and stats). */
|
|
1687
|
-
|
|
1611
|
+
__init23() {this.misses = 0}
|
|
1688
1612
|
get size() {
|
|
1689
1613
|
return this.entries.size;
|
|
1690
1614
|
}
|
|
@@ -1706,7 +1630,7 @@ var BrushstrokeCache = (_class6 = class {
|
|
|
1706
1630
|
clear() {
|
|
1707
1631
|
this.entries.clear();
|
|
1708
1632
|
}
|
|
1709
|
-
},
|
|
1633
|
+
}, _class5);
|
|
1710
1634
|
|
|
1711
1635
|
// src/paint/exchange.ts
|
|
1712
1636
|
var MIXING_MODELS = ["rgb", "pigment"];
|
|
@@ -1716,20 +1640,20 @@ var MIXER_DRAIN = 0.08;
|
|
|
1716
1640
|
function exchangeRates(pickup, mix, load, mixing) {
|
|
1717
1641
|
return { pickup: MIXER_PICKUP_RATE * pickup, mix: mix * pickup, drain: MIXER_DRAIN * (1 - load), mixing };
|
|
1718
1642
|
}
|
|
1719
|
-
var PaintExchange = (
|
|
1720
|
-
constructor(rates, load) {;
|
|
1643
|
+
var PaintExchange = (_class6 = class {
|
|
1644
|
+
constructor(rates, load) {;_class6.prototype.__init24.call(this);
|
|
1721
1645
|
this.rates = rates;
|
|
1722
1646
|
this.reservoir = load.reservoir ? [load.reservoir[0], load.reservoir[1], load.reservoir[2]] : null;
|
|
1723
1647
|
this.amount = this.reservoir ? Math.min(1, Math.max(0, load.amount)) : 0;
|
|
1724
1648
|
this.well = load.pickup ? [load.pickup[0], load.pickup[1], load.pickup[2]] : null;
|
|
1725
|
-
this.pig = rates.mixing === "pigment" ? { res:
|
|
1649
|
+
this.pig = rates.mixing === "pigment" ? { res: _chunk2VX55NFMcjs.createPigment.call(void 0, _nullishCoalesce(this.reservoir, () => ( [0, 0, 0]))), well: _chunk2VX55NFMcjs.createPigment.call(void 0, _nullishCoalesce(this.well, () => ( [0, 0, 0]))), paint: _chunk2VX55NFMcjs.createPigment.call(void 0, [0, 0, 0]), canvas: _chunk2VX55NFMcjs.createPigment.call(void 0, [0, 0, 0]) } : null;
|
|
1726
1650
|
}
|
|
1727
1651
|
|
|
1728
1652
|
|
|
1729
1653
|
|
|
1730
1654
|
|
|
1731
1655
|
|
|
1732
|
-
|
|
1656
|
+
__init24() {this.out = [0, 0, 0]}
|
|
1733
1657
|
/** What the brush carries now. */
|
|
1734
1658
|
get load() {
|
|
1735
1659
|
return { reservoir: this.reservoir ? [...this.reservoir] : null, amount: this.amount, pickup: this.well ? [...this.well] : null };
|
|
@@ -1752,21 +1676,21 @@ var PaintExchange = (_class7 = class {
|
|
|
1752
1676
|
this.reservoir[1] = g;
|
|
1753
1677
|
this.reservoir[2] = b;
|
|
1754
1678
|
}
|
|
1755
|
-
if (this.pig)
|
|
1679
|
+
if (this.pig) _chunk2VX55NFMcjs.setPigmentColor.call(void 0, this.pig.res, r, g, b);
|
|
1756
1680
|
}
|
|
1757
1681
|
/** `a` mixed `t` of the way to `b` into `this.out`, by the mixing model. */
|
|
1758
1682
|
mix(a, pa, b, pb, t) {
|
|
1759
1683
|
const o = this.out;
|
|
1760
|
-
if (pa && pb)
|
|
1684
|
+
if (pa && pb) _chunk2VX55NFMcjs.lerpPigmentInto.call(void 0, pa, pb, t, o, 0);
|
|
1761
1685
|
else for (let c = 0; c < 3; c++) o[c] = a[c] + (b[c] - a[c]) * t;
|
|
1762
1686
|
return o;
|
|
1763
1687
|
}
|
|
1764
1688
|
/** `a` mixed `t` of the way to `b` (sRGB 0..1) by the mixing model, into `out`. */
|
|
1765
1689
|
mixColors(a, b, t, out) {
|
|
1766
1690
|
if (this.pig) {
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1691
|
+
_chunk2VX55NFMcjs.setPigmentColor.call(void 0, this.pig.canvas, a[0], a[1], a[2]);
|
|
1692
|
+
_chunk2VX55NFMcjs.setPigmentColor.call(void 0, this.pig.paint, b[0], b[1], b[2]);
|
|
1693
|
+
_chunk2VX55NFMcjs.lerpPigmentInto.call(void 0, this.pig.canvas, this.pig.paint, t, out, 0);
|
|
1770
1694
|
} else for (let c = 0; c < 3; c++) out[c] = a[c] + (b[c] - a[c]) * t;
|
|
1771
1695
|
return out;
|
|
1772
1696
|
}
|
|
@@ -1776,11 +1700,11 @@ var PaintExchange = (_class7 = class {
|
|
|
1776
1700
|
const pig = this.pig;
|
|
1777
1701
|
if (!this.well) this.well = [sample.rgb[0], sample.rgb[1], sample.rgb[2]];
|
|
1778
1702
|
else {
|
|
1779
|
-
if (pig)
|
|
1703
|
+
if (pig) _chunk2VX55NFMcjs.setPigmentColor.call(void 0, pig.canvas, sample.rgb[0], sample.rgb[1], sample.rgb[2]);
|
|
1780
1704
|
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);
|
|
1781
1705
|
this.well = [o[0], o[1], o[2]];
|
|
1782
1706
|
}
|
|
1783
|
-
if (pig)
|
|
1707
|
+
if (pig) _chunk2VX55NFMcjs.setPigmentColor.call(void 0, pig.well, this.well[0], this.well[1], this.well[2]);
|
|
1784
1708
|
}
|
|
1785
1709
|
/**
|
|
1786
1710
|
* 2. The dab's paint: the reservoir mixed with the well, written to `out`. Returns the total
|
|
@@ -1805,36 +1729,36 @@ var PaintExchange = (_class7 = class {
|
|
|
1805
1729
|
out[1] = c[1];
|
|
1806
1730
|
out[2] = c[2];
|
|
1807
1731
|
}
|
|
1808
|
-
if (pig)
|
|
1732
|
+
if (pig) _chunk2VX55NFMcjs.setPigmentColor.call(void 0, pig.paint, out[0], out[1], out[2]);
|
|
1809
1733
|
return total;
|
|
1810
1734
|
}
|
|
1811
1735
|
/** 3. The reservoir drains. */
|
|
1812
1736
|
drain() {
|
|
1813
1737
|
this.amount *= 1 - this.rates.drain;
|
|
1814
1738
|
}
|
|
1815
|
-
},
|
|
1739
|
+
}, _class6);
|
|
1816
1740
|
function put255(px, i, v) {
|
|
1817
1741
|
if (px instanceof Float32Array) px[i] = v > 0 ? v * 255 : 0;
|
|
1818
1742
|
else px[i] = Math.round(v * 255);
|
|
1819
1743
|
}
|
|
1820
|
-
var TileMedium = (
|
|
1821
|
-
constructor(target, options = {}) {;
|
|
1744
|
+
var TileMedium = (_class7 = class {
|
|
1745
|
+
constructor(target, options = {}) {;_class7.prototype.__init25.call(this);_class7.prototype.__init26.call(this);_class7.prototype.__init27.call(this);_class7.prototype.__init28.call(this);_class7.prototype.__init29.call(this);_class7.prototype.__init30.call(this);_class7.prototype.__init31.call(this);_class7.prototype.__init32.call(this);_class7.prototype.__init33.call(this);_class7.prototype.__init34.call(this);
|
|
1822
1746
|
this.target = target;
|
|
1823
1747
|
this.options = options;
|
|
1824
1748
|
}
|
|
1825
1749
|
|
|
1826
1750
|
|
|
1827
1751
|
// The tile last looked up by `locate` (and whether it came from `writeTile`).
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1752
|
+
__init25() {this.tx = NaN}
|
|
1753
|
+
__init26() {this.ty = NaN}
|
|
1754
|
+
__init27() {this.tile = null}
|
|
1755
|
+
__init28() {this.writable = false}
|
|
1756
|
+
__init29() {this.canvasPig = _chunk2VX55NFMcjs.createPigment.call(void 0, [0, 0, 0])}
|
|
1757
|
+
__init30() {this.paintPig = _chunk2VX55NFMcjs.createPigment.call(void 0, [0, 0, 0])}
|
|
1758
|
+
__init31() {this.paintKey = -1}
|
|
1759
|
+
__init32() {this.cb = [0, 0, 0, 0]}
|
|
1760
|
+
__init33() {this.src = [0, 0, 0, 1]}
|
|
1761
|
+
__init34() {this.o = [0, 0, 0]}
|
|
1838
1762
|
/** Forgets the cached tile (call when another writer may have replaced tiles). */
|
|
1839
1763
|
reset() {
|
|
1840
1764
|
this.tx = NaN;
|
|
@@ -1935,7 +1859,7 @@ var TileMedium = (_class8 = class {
|
|
|
1935
1859
|
src[0] = pr;
|
|
1936
1860
|
src[1] = pg;
|
|
1937
1861
|
src[2] = pb;
|
|
1938
|
-
const r =
|
|
1862
|
+
const r = _chunk2VX55NFMcjs.blendPixel.call(void 0, blend, cb, src, k);
|
|
1939
1863
|
put255(px, i, r[0]);
|
|
1940
1864
|
put255(px, i + 1, r[1]);
|
|
1941
1865
|
put255(px, i + 2, r[2]);
|
|
@@ -1950,23 +1874,23 @@ var TileMedium = (_class8 = class {
|
|
|
1950
1874
|
o[1] = pg;
|
|
1951
1875
|
o[2] = pb;
|
|
1952
1876
|
} else if (pigment && field) {
|
|
1953
|
-
|
|
1877
|
+
_chunk2VX55NFMcjs.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);
|
|
1954
1878
|
} else if (pigment) {
|
|
1955
1879
|
const key = px instanceof Float32Array ? -2 : px[i] << 16 | px[i + 1] << 8 | px[i + 2];
|
|
1956
1880
|
if (key !== lastKey || key === -2) {
|
|
1957
|
-
|
|
1881
|
+
_chunk2VX55NFMcjs.setPigmentColor.call(void 0, this.canvasPig, px[i] / 255, px[i + 1] / 255, px[i + 2] / 255);
|
|
1958
1882
|
lastKey = key;
|
|
1959
1883
|
}
|
|
1960
1884
|
let pp = paintPigment;
|
|
1961
1885
|
if (!pp) {
|
|
1962
1886
|
const pkey = Math.round(pr * 255) << 16 | Math.round(pg * 255) << 8 | Math.round(pb * 255);
|
|
1963
1887
|
if (pkey !== this.paintKey) {
|
|
1964
|
-
|
|
1888
|
+
_chunk2VX55NFMcjs.setPigmentColor.call(void 0, this.paintPig, pr, pg, pb);
|
|
1965
1889
|
this.paintKey = pkey;
|
|
1966
1890
|
}
|
|
1967
1891
|
pp = this.paintPig;
|
|
1968
1892
|
}
|
|
1969
|
-
|
|
1893
|
+
_chunk2VX55NFMcjs.lerpPigmentInto.call(void 0, this.canvasPig, pp, share, o, 0);
|
|
1970
1894
|
} else {
|
|
1971
1895
|
o[0] = px[i] / 255 + (pr - px[i] / 255) * share;
|
|
1972
1896
|
o[1] = px[i + 1] / 255 + (pg - px[i + 1] / 255) * share;
|
|
@@ -1979,7 +1903,7 @@ var TileMedium = (_class8 = class {
|
|
|
1979
1903
|
}
|
|
1980
1904
|
}
|
|
1981
1905
|
}
|
|
1982
|
-
},
|
|
1906
|
+
}, _class7);
|
|
1983
1907
|
|
|
1984
1908
|
// src/paint/blending.ts
|
|
1985
1909
|
var DEFAULT_BLENDER = { strength: 0.5, distance: 0.35, mixing: "pigment" };
|
|
@@ -1995,9 +1919,9 @@ function blendRadius(settings, radius) {
|
|
|
1995
1919
|
return Math.max(1, Math.round(settings.distance * 2 * radius));
|
|
1996
1920
|
}
|
|
1997
1921
|
function createBlenderScratch() {
|
|
1998
|
-
return { sums: new Float64Array(0), mix: { rgb: [0, 0, 0], strength: 1, ks: new Float32Array(
|
|
1922
|
+
return { sums: new Float64Array(0), mix: { rgb: [0, 0, 0], strength: 1, ks: new Float32Array(_chunk2VX55NFMcjs.PIGMENT_BANDS), scatter: 1 }, out: [0, 0, 0] };
|
|
1999
1923
|
}
|
|
2000
|
-
var N =
|
|
1924
|
+
var N = _chunk2VX55NFMcjs.PIGMENT_BANDS;
|
|
2001
1925
|
function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
2002
1926
|
const R = blendRadius(settings, radius);
|
|
2003
1927
|
const W = rect.width + 2 * R;
|
|
@@ -2022,7 +1946,7 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
|
2022
1946
|
const a = px[i + 3] / 255;
|
|
2023
1947
|
if (a > 0) {
|
|
2024
1948
|
if (pigment) {
|
|
2025
|
-
const p =
|
|
1949
|
+
const p = _chunk2VX55NFMcjs.pigment8.call(void 0, Math.round(px[i]), Math.round(px[i + 1]), Math.round(px[i + 2]));
|
|
2026
1950
|
const sa = p.scatter * p.strength * a;
|
|
2027
1951
|
for (let k = 0; k < N; k++) row[k] += sa * p.ks[k];
|
|
2028
1952
|
row[N] += sa;
|
|
@@ -2080,8 +2004,8 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
|
2080
2004
|
const sa = sum(N, x1, y1, x2, y2);
|
|
2081
2005
|
for (let c = 0; c < N; c++) mixPig.ks[c] = sum(c, x1, y1, x2, y2) / sa;
|
|
2082
2006
|
mixPig.scatter = sa / asum;
|
|
2083
|
-
if (a <= 0 || share >= 1)
|
|
2084
|
-
else
|
|
2007
|
+
if (a <= 0 || share >= 1) _chunk2VX55NFMcjs.lerpPigmentInto.call(void 0, mixPig, mixPig, 0, out, 0);
|
|
2008
|
+
else _chunk2VX55NFMcjs.lerpPigmentInto.call(void 0, _chunk2VX55NFMcjs.pigment8.call(void 0, Math.round(px[i]), Math.round(px[i + 1]), Math.round(px[i + 2])), mixPig, share, out, 0);
|
|
2085
2009
|
} else {
|
|
2086
2010
|
for (let c = 0; c < 3; c++) {
|
|
2087
2011
|
const m = sum(c, x1, y1, x2, y2) / asum;
|
|
@@ -2095,8 +2019,8 @@ function blenderDab(medium, rect, cov, opacity, radius, settings, scratch) {
|
|
|
2095
2019
|
}
|
|
2096
2020
|
}
|
|
2097
2021
|
}
|
|
2098
|
-
var SmudgeTip = (
|
|
2099
|
-
constructor(settings, diameter) {;
|
|
2022
|
+
var SmudgeTip = (_class8 = class {
|
|
2023
|
+
constructor(settings, diameter) {;_class8.prototype.__init35.call(this);_class8.prototype.__init36.call(this);
|
|
2100
2024
|
this.settings = settings;
|
|
2101
2025
|
this.size = Math.max(2, Math.min(512, Math.ceil(diameter)));
|
|
2102
2026
|
this.patch = new Float32Array(this.size * this.size * 4);
|
|
@@ -2104,8 +2028,8 @@ var SmudgeTip = (_class9 = class {
|
|
|
2104
2028
|
|
|
2105
2029
|
|
|
2106
2030
|
|
|
2107
|
-
|
|
2108
|
-
|
|
2031
|
+
__init35() {this.loaded = false}
|
|
2032
|
+
__init36() {this.out = [0, 0, 0]}
|
|
2109
2033
|
cell(d, px, py) {
|
|
2110
2034
|
const s = this.size;
|
|
2111
2035
|
const r = Math.max(0.5, d.radius);
|
|
@@ -2141,7 +2065,7 @@ var SmudgeTip = (_class9 = class {
|
|
|
2141
2065
|
mix(a0, a1, a2, b0, b1, b2, t) {
|
|
2142
2066
|
const o = this.out;
|
|
2143
2067
|
if (this.settings.mixing === "pigment") {
|
|
2144
|
-
|
|
2068
|
+
_chunk2VX55NFMcjs.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);
|
|
2145
2069
|
} else {
|
|
2146
2070
|
o[0] = a0 + (b0 - a0) * t;
|
|
2147
2071
|
o[1] = a1 + (b1 - a1) * t;
|
|
@@ -2216,7 +2140,7 @@ var SmudgeTip = (_class9 = class {
|
|
|
2216
2140
|
}
|
|
2217
2141
|
}
|
|
2218
2142
|
}
|
|
2219
|
-
},
|
|
2143
|
+
}, _class8);
|
|
2220
2144
|
|
|
2221
2145
|
// src/paint/mixer.ts
|
|
2222
2146
|
var DEFAULT_MIXER = {
|
|
@@ -2249,22 +2173,22 @@ function loadMixer(load, color) {
|
|
|
2249
2173
|
function cleanMixer(load) {
|
|
2250
2174
|
return { reservoir: load.reservoir, amount: load.amount, pickup: null };
|
|
2251
2175
|
}
|
|
2252
|
-
var MixerStroke = (
|
|
2253
|
-
constructor(brush, settings, load, target) {;
|
|
2176
|
+
var MixerStroke = (_class9 = class {
|
|
2177
|
+
constructor(brush, settings, load, target) {;_class9.prototype.__init37.call(this);_class9.prototype.__init38.call(this);_class9.prototype.__init39.call(this);_class9.prototype.__init40.call(this);_class9.prototype.__init41.call(this);
|
|
2254
2178
|
this.brush = brush;
|
|
2255
2179
|
this.walker = new DabWalker(brush);
|
|
2256
2180
|
this.exchange = new PaintExchange(mixerRates(normalizeMixer(settings)), load);
|
|
2257
2181
|
this.medium = new TileMedium(target);
|
|
2258
2182
|
}
|
|
2259
2183
|
|
|
2260
|
-
|
|
2261
|
-
|
|
2184
|
+
__init37() {this.dabCount = 0}
|
|
2185
|
+
__init38() {this.bounds = null}
|
|
2262
2186
|
|
|
2263
|
-
|
|
2264
|
-
|
|
2187
|
+
__init39() {this.smoothPos = null}
|
|
2188
|
+
__init40() {this.buf = new Float32Array(0)}
|
|
2265
2189
|
|
|
2266
2190
|
|
|
2267
|
-
|
|
2191
|
+
__init41() {this.paintColor = [0, 0, 0]}
|
|
2268
2192
|
/** The brush load after the dabs so far. */
|
|
2269
2193
|
get load() {
|
|
2270
2194
|
return this.exchange.load;
|
|
@@ -2312,7 +2236,7 @@ var MixerStroke = (_class10 = class {
|
|
|
2312
2236
|
}
|
|
2313
2237
|
ex.drain();
|
|
2314
2238
|
}
|
|
2315
|
-
},
|
|
2239
|
+
}, _class9);
|
|
2316
2240
|
function union(a, b) {
|
|
2317
2241
|
if (!a) return { ...b };
|
|
2318
2242
|
const x = Math.min(a.x, b.x);
|
|
@@ -2410,10 +2334,4 @@ function union(a, b) {
|
|
|
2410
2334
|
|
|
2411
2335
|
|
|
2412
2336
|
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
exports.mix32 = mix32; exports.hash2 = hash2; exports.rand01 = rand01; exports.randSigned = randSigned; exports.seedFromString = seedFromString; exports.TileableNoise = TileableNoise; exports.PAINT_GRADIENT_SPACES = PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_REPEATS = PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_MAPPINGS = PAINT_GRADIENT_MAPPINGS; exports.DEFAULT_PAINT_GRADIENT_MAPPING = DEFAULT_PAINT_GRADIENT_MAPPING; exports.PAINT_GRADIENT_FULL_SPEED = PAINT_GRADIENT_FULL_SPEED; exports.PaintSourceError = PaintSourceError; exports.normalizeHexColor = normalizeHexColor; exports.hexToPaintRgb = hexToPaintRgb; exports.parsePaintSource = parsePaintSource; exports.readPaintSource = readPaintSource; exports.resolvePaintGradient = resolvePaintGradient; exports.scalePaintGradient = scalePaintGradient; exports.solidPaint = solidPaint; exports.isGradientPaint = isGradientPaint; exports.paintSourceColor = paintSourceColor; exports.paintSourceCss = paintSourceCss; exports.PaintGradientSampler = PaintGradientSampler; exports.PAINT_GRADIENT_JSON_SCHEMA = PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_COLOR_JSON_SCHEMA = PAINT_COLOR_JSON_SCHEMA; exports.PAINT_SOURCE_JSON_SCHEMA = PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_GRADIENT_MAPPING_LABELS = PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_SPACE_LABELS = PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_GRADIENT_REPEAT_LABELS = PAINT_GRADIENT_REPEAT_LABELS; exports.DEFAULT_PAINT_GRADIENT = DEFAULT_PAINT_GRADIENT; exports.PAINT_GRADIENT_PRESETS = PAINT_GRADIENT_PRESETS; exports.addPaintGradientStop = addPaintGradientStop; exports.removePaintGradientStop = removePaintGradientStop; exports.updatePaintGradientStop = updatePaintGradientStop; exports.reversePaintGradient = reversePaintGradient; exports.paintGradientMappingFor = paintGradientMappingFor; exports.PAINT_GRADIENT_KIT = PAINT_GRADIENT_KIT; 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.TIP_GRADIENT_STEPS = TIP_GRADIENT_STEPS; exports.gradientDabColor = gradientDabColor; exports.applyStrokeToTile = applyStrokeToTile; exports.applyStrokeToDeepTile = applyStrokeToDeepTile; exports.coverageTileCoord = coverageTileCoord; exports.GRAIN_PATTERNS = GRAIN_PATTERNS; exports.GRAIN_TILE = GRAIN_TILE; exports.grainHeights = grainHeights; exports.PaperGrain = PaperGrain; exports.grainCatch = grainCatch; exports.strokeGrainCatch = strokeGrainCatch; exports.pathStrokeDabs = pathStrokeDabs; exports.pathStrokeCoverage = pathStrokeCoverage; exports.paintPathStroke = paintPathStroke; exports.brushstrokeSamples = brushstrokeSamples; exports.brushstrokeStrokeOptions = brushstrokeStrokeOptions; exports.isBrushstrokeBrush = isBrushstrokeBrush; exports.renderBrushstroke = renderBrushstroke; exports.brushstrokeDataUrl = brushstrokeDataUrl; exports.brushstrokeToCanvas = brushstrokeToCanvas; exports.brushstrokeKey = brushstrokeKey; exports.BrushstrokeCache = BrushstrokeCache; 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.put255 = put255; exports.TileMedium = TileMedium; 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.DEFAULT_MIXER = DEFAULT_MIXER; exports.normalizeMixer = normalizeMixer; exports.mixerRates = mixerRates; exports.loadMixer = loadMixer; exports.cleanMixer = cleanMixer; exports.MixerStroke = MixerStroke;
|
|
2337
|
+
exports.PAINT_GRADIENT_SPACES = PAINT_GRADIENT_SPACES; exports.PAINT_GRADIENT_REPEATS = PAINT_GRADIENT_REPEATS; exports.PAINT_GRADIENT_MAPPINGS = PAINT_GRADIENT_MAPPINGS; exports.DEFAULT_PAINT_GRADIENT_MAPPING = DEFAULT_PAINT_GRADIENT_MAPPING; exports.PAINT_GRADIENT_FULL_SPEED = PAINT_GRADIENT_FULL_SPEED; exports.PaintSourceError = PaintSourceError; exports.normalizeHexColor = normalizeHexColor; exports.hexToPaintRgb = hexToPaintRgb; exports.parsePaintSource = parsePaintSource; exports.readPaintSource = readPaintSource; exports.resolvePaintGradient = resolvePaintGradient; exports.scalePaintGradient = scalePaintGradient; exports.solidPaint = solidPaint; exports.isGradientPaint = isGradientPaint; exports.paintSourceColor = paintSourceColor; exports.paintSourceCss = paintSourceCss; exports.PaintGradientSampler = PaintGradientSampler; exports.PAINT_GRADIENT_JSON_SCHEMA = PAINT_GRADIENT_JSON_SCHEMA; exports.PAINT_COLOR_JSON_SCHEMA = PAINT_COLOR_JSON_SCHEMA; exports.PAINT_SOURCE_JSON_SCHEMA = PAINT_SOURCE_JSON_SCHEMA; exports.PAINT_GRADIENT_MAPPING_LABELS = PAINT_GRADIENT_MAPPING_LABELS; exports.PAINT_GRADIENT_SPACE_LABELS = PAINT_GRADIENT_SPACE_LABELS; exports.PAINT_GRADIENT_REPEAT_LABELS = PAINT_GRADIENT_REPEAT_LABELS; exports.DEFAULT_PAINT_GRADIENT = DEFAULT_PAINT_GRADIENT; exports.PAINT_GRADIENT_PRESETS = PAINT_GRADIENT_PRESETS; exports.addPaintGradientStop = addPaintGradientStop; exports.removePaintGradientStop = removePaintGradientStop; exports.updatePaintGradientStop = updatePaintGradientStop; exports.reversePaintGradient = reversePaintGradient; exports.paintGradientMappingFor = paintGradientMappingFor; exports.PAINT_GRADIENT_KIT = PAINT_GRADIENT_KIT; 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.TIP_GRADIENT_STEPS = TIP_GRADIENT_STEPS; exports.gradientDabColor = gradientDabColor; exports.applyStrokeToTile = applyStrokeToTile; exports.applyStrokeToDeepTile = applyStrokeToDeepTile; exports.coverageTileCoord = coverageTileCoord; exports.GRAIN_PATTERNS = GRAIN_PATTERNS; exports.GRAIN_TILE = GRAIN_TILE; exports.grainHeights = grainHeights; exports.PaperGrain = PaperGrain; exports.grainCatch = grainCatch; exports.strokeGrainCatch = strokeGrainCatch; exports.pathStrokeDabs = pathStrokeDabs; exports.pathStrokeCoverage = pathStrokeCoverage; exports.paintPathStroke = paintPathStroke; exports.brushstrokeSamples = brushstrokeSamples; exports.brushstrokeStrokeOptions = brushstrokeStrokeOptions; exports.isBrushstrokeBrush = isBrushstrokeBrush; exports.renderBrushstroke = renderBrushstroke; exports.brushstrokeDataUrl = brushstrokeDataUrl; exports.brushstrokeToCanvas = brushstrokeToCanvas; exports.brushstrokeKey = brushstrokeKey; exports.BrushstrokeCache = BrushstrokeCache; 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.put255 = put255; exports.TileMedium = TileMedium; 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.DEFAULT_MIXER = DEFAULT_MIXER; exports.normalizeMixer = normalizeMixer; exports.mixerRates = mixerRates; exports.loadMixer = loadMixer; exports.cleanMixer = cleanMixer; exports.MixerStroke = MixerStroke;
|