@pixerate/editor 0.206.0 → 0.208.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.
Files changed (73) hide show
  1. package/dist/animation-editor/index.cjs +60 -59
  2. package/dist/animation-editor/index.js +6 -5
  3. package/dist/{brushstrokeRender-7LXCU7PD.js → brushstrokeRender-C3UU6GVC.js} +5 -4
  4. package/dist/{brushstrokeRender-VO4ZTWVA.cjs → brushstrokeRender-EAJNE6WP.cjs} +12 -11
  5. package/dist/canvas/index.cjs +8 -8
  6. package/dist/canvas/index.js +1 -1
  7. package/dist/{chunk-2N2QPO3H.js → chunk-2PBZBRP5.js} +9 -7
  8. package/dist/{chunk-7NW46N7I.cjs → chunk-3EHPLDFQ.cjs} +54 -52
  9. package/dist/{chunk-H367YTXI.js → chunk-42TWUPNJ.js} +13 -387
  10. package/dist/chunk-474IQG74.cjs +384 -0
  11. package/dist/{chunk-MLC7HUHO.js → chunk-BGOCAUXH.js} +1 -1
  12. package/dist/chunk-DWYQPL2A.js +2010 -0
  13. package/dist/{chunk-YXKLVD56.js → chunk-F7YA3MMC.js} +2 -2
  14. package/dist/{chunk-ZZGPYNS2.js → chunk-G4E6RUPC.js} +1 -1
  15. package/dist/chunk-HVVR5PZW.js +384 -0
  16. package/dist/{chunk-FR2Q2LVF.cjs → chunk-I7G3RSUJ.cjs} +35 -35
  17. package/dist/chunk-K6PXS6DO.cjs +102 -0
  18. package/dist/{chunk-ZIDUPSP4.js → chunk-KFIOEOCQ.js} +24 -761
  19. package/dist/{chunk-V7GWZIZK.cjs → chunk-KWNMBMKG.cjs} +23 -21
  20. package/dist/chunk-L3G23N5Y.js +763 -0
  21. package/dist/{chunk-GHCXLQ47.js → chunk-NDMXB4PR.js} +2 -2
  22. package/dist/{chunk-CWM3CUUX.cjs → chunk-OLNIPTB3.cjs} +39 -413
  23. package/dist/{chunk-EBDCRTZI.cjs → chunk-PQ3H2AAN.cjs} +92 -90
  24. package/dist/{chunk-BRKVNXDZ.cjs → chunk-QAUIZPYI.cjs} +7 -7
  25. package/dist/{chunk-UYXL6ZWQ.cjs → chunk-QE7D7TZR.cjs} +494 -1231
  26. package/dist/chunk-QYLWG22N.cjs +763 -0
  27. package/dist/{chunk-YQ5C5BVK.cjs → chunk-ROVK6AXX.cjs} +60 -60
  28. package/dist/{chunk-HGTDMKNE.cjs → chunk-UOGKSVRQ.cjs} +126 -221
  29. package/dist/{chunk-EL5PAHNP.js → chunk-USQCKRZG.js} +6 -4
  30. package/dist/{chunk-36OKQDCF.js → chunk-WJ2RBZMM.js} +5 -3
  31. package/dist/chunk-X4LUGTQX.cjs +2010 -0
  32. package/dist/{chunk-NQMP3CWF.js → chunk-YBJXCQTR.js} +15 -110
  33. package/dist/chunk-ZIF4UJJ6.js +102 -0
  34. package/dist/{chunk-WTW7QRTS.cjs → chunk-ZMHPQ6HP.cjs} +1 -1
  35. package/dist/image-editor/controller.d.cts +28 -3
  36. package/dist/image-editor/controller.d.ts +28 -3
  37. package/dist/image-editor/index.cjs +2150 -3380
  38. package/dist/image-editor/index.js +675 -1905
  39. package/dist/image-editor/selection/index.d.cts +2 -0
  40. package/dist/image-editor/selection/index.d.ts +2 -0
  41. package/dist/image-editor/selection/refine-edits.d.cts +13 -4
  42. package/dist/image-editor/selection/refine-edits.d.ts +13 -4
  43. package/dist/image-editor/selection/segment/focus.d.cts +2 -0
  44. package/dist/image-editor/selection/segment/focus.d.ts +2 -0
  45. package/dist/image-editor/selection/segment/grabcut.d.cts +4 -2
  46. package/dist/image-editor/selection/segment/grabcut.d.ts +4 -2
  47. package/dist/image-editor/selection/segment/sky.d.cts +2 -0
  48. package/dist/image-editor/selection/segment/sky.d.ts +2 -0
  49. package/dist/image-editor/selection/segment/subject.d.cts +2 -1
  50. package/dist/image-editor/selection/segment/subject.d.ts +2 -1
  51. package/dist/image-editor/selection/segment/work.d.cts +5 -0
  52. package/dist/image-editor/selection/segment/work.d.ts +5 -0
  53. package/dist/image-editor/selection/select-and-mask.d.cts +136 -0
  54. package/dist/image-editor/selection/select-and-mask.d.ts +136 -0
  55. package/dist/image-editor/selection/worker.d.cts +126 -0
  56. package/dist/image-editor/selection/worker.d.ts +126 -0
  57. package/dist/image-editor/selection-worker.cjs +14 -0
  58. package/dist/image-editor/selection-worker.d.cts +12 -0
  59. package/dist/image-editor/selection-worker.d.ts +12 -0
  60. package/dist/image-editor/selection-worker.js +14 -0
  61. package/dist/image-editor/types.d.cts +8 -0
  62. package/dist/image-editor/types.d.ts +8 -0
  63. package/dist/paint/index.cjs +6 -5
  64. package/dist/paint/index.js +5 -4
  65. package/dist/paint-editor/index.cjs +394 -390
  66. package/dist/paint-editor/index.js +18 -14
  67. package/dist/raster/index.cjs +22 -18
  68. package/dist/raster/index.js +29 -25
  69. package/dist/vector/index.cjs +986 -985
  70. package/dist/vector/index.js +6 -5
  71. package/package.json +11 -1
  72. package/skills/pixerate-image-editor/SKILL.md +1 -1
  73. package/skills/pixerate-image-selection-masking/SKILL.md +4 -2
@@ -0,0 +1,102 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/raster/blur.ts
2
+ function gaussianKernel(sigma) {
3
+ const r = Math.ceil(sigma * 3);
4
+ const k = new Float32Array(2 * r + 1);
5
+ let s = 0;
6
+ for (let i = -r; i <= r; i++) {
7
+ const v = Math.exp(-(i * i) / (2 * sigma * sigma));
8
+ k[i + r] = v;
9
+ s += v;
10
+ }
11
+ for (let i = 0; i < k.length; i++) k[i] /= s;
12
+ return k;
13
+ }
14
+ var DIRECT_GAUSSIAN_MAX_SIGMA = 8;
15
+ function boxRadii(sigma) {
16
+ const n = 3;
17
+ const wIdeal = Math.sqrt(12 * sigma * sigma / n + 1);
18
+ let wl = Math.floor(wIdeal);
19
+ if (wl % 2 === 0) wl--;
20
+ const wu = wl + 2;
21
+ const mIdeal = (12 * sigma * sigma - n * wl * wl - 4 * n * wl - 3 * n) / (-4 * wl - 4);
22
+ const m = Math.round(mIdeal);
23
+ const sizes = [0, 1, 2].map((i) => i < m ? wl : wu);
24
+ return sizes.map((s) => (s - 1) / 2);
25
+ }
26
+ function convolveLine(src, off, stride, len, k, edge, dst) {
27
+ const r = (k.length - 1) / 2;
28
+ for (let i = 0; i < len; i++) {
29
+ let a = 0;
30
+ const lo = i - r;
31
+ for (let j = 0; j < k.length; j++) {
32
+ let x = lo + j;
33
+ if (x < 0 || x >= len) {
34
+ if (edge === "zero") continue;
35
+ x = x < 0 ? 0 : len - 1;
36
+ }
37
+ a += src[off + x * stride] * k[j];
38
+ }
39
+ dst[i] = a;
40
+ }
41
+ }
42
+ function boxesLine(src, off, stride, len, radii, edge, a, b, dst) {
43
+ const pad = radii.reduce((s, r) => s + r, 0);
44
+ const plen = len + 2 * pad;
45
+ for (let i = 0; i < plen; i++) {
46
+ const j = i - pad;
47
+ a[i] = j < 0 ? edge === "zero" ? 0 : src[off] : j >= len ? edge === "zero" ? 0 : src[off + (len - 1) * stride] : src[off + j * stride];
48
+ }
49
+ let from = a;
50
+ let to = b;
51
+ for (const r of radii) {
52
+ let sum = 0;
53
+ for (let i = 0; i <= Math.min(r, plen - 1); i++) sum += from[i];
54
+ const k = 2 * r + 1;
55
+ for (let i = 0; i < plen; i++) {
56
+ to[i] = sum / k;
57
+ const add = i + r + 1;
58
+ const drop = i - r;
59
+ if (add < plen) sum += from[add];
60
+ if (drop >= 0) sum -= from[drop];
61
+ }
62
+ const t = from;
63
+ from = to;
64
+ to = t;
65
+ }
66
+ for (let i = 0; i < len; i++) dst[i] = from[i + pad];
67
+ }
68
+ function gaussianBlur(src, w, h, sigma, edge = "zero") {
69
+ const out = Float32Array.from(src);
70
+ if (!(sigma >= 0.1) || w <= 0 || h <= 0) return out;
71
+ const s = Math.min(sigma, 4 * Math.max(w, h));
72
+ const line = new Float32Array(Math.max(w, h));
73
+ const passes = [];
74
+ if (s <= DIRECT_GAUSSIAN_MAX_SIGMA) {
75
+ const k = gaussianKernel(s);
76
+ passes.push((buf, off, stride, len) => convolveLine(buf, off, stride, len, k, edge, line));
77
+ } else {
78
+ const radii = boxRadii(s);
79
+ const plen = Math.max(w, h) + 2 * radii.reduce((a2, r) => a2 + r, 0);
80
+ const a = new Float32Array(plen);
81
+ const b = new Float32Array(plen);
82
+ passes.push((buf, off, stride, len) => boxesLine(buf, off, stride, len, radii, edge, a, b, line));
83
+ }
84
+ for (const pass of passes) {
85
+ for (let y = 0; y < h; y++) {
86
+ pass(out, y * w, 1, w);
87
+ out.set(line.subarray(0, w), y * w);
88
+ }
89
+ }
90
+ for (const pass of passes) {
91
+ for (let x = 0; x < w; x++) {
92
+ pass(out, x, w, h);
93
+ for (let y = 0; y < h; y++) out[y * w + x] = line[y];
94
+ }
95
+ }
96
+ return out;
97
+ }
98
+
99
+
100
+
101
+
102
+ exports.DIRECT_GAUSSIAN_MAX_SIGMA = DIRECT_GAUSSIAN_MAX_SIGMA; exports.gaussianBlur = gaussianBlur;