emf-converter 4.6.1 → 4.6.3

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/browser.js CHANGED
@@ -16508,7 +16508,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical
16508
16508
  function blurReduction(radius) {
16509
16509
  return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
16510
16510
  }
16511
- function effectBlur(src, width, height, radius) {
16511
+ function effectBlur(src, width, height, radius, expanded = false) {
16512
16512
  const factor = blurReduction(radius);
16513
16513
  if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
16514
16514
  return gdipBlur(src, width, height, radius);
@@ -16526,6 +16526,21 @@ function effectBlur(src, width, height, radius) {
16526
16526
  }
16527
16527
  }
16528
16528
  const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
16529
+ if (!expanded) {
16530
+ const out2 = new Float64Array(src.length);
16531
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
16532
+ const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
16533
+ const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
16534
+ const x1 = Math.min(w - 1, ix + 1), y1 = Math.min(h - 1, iy + 1);
16535
+ for (let c = 0; c < 4; c++) {
16536
+ const at = (xx, yy) => filtered[(yy * w + xx) * 4 + c];
16537
+ const top = Math.floor((1 - fx) * at(ix, iy) + fx * at(x1, iy));
16538
+ const bottom = Math.floor((1 - fx) * at(ix, y1) + fx * at(x1, y1));
16539
+ out2[(y * width + x) * 4 + c] = Math.floor((1 - fy) * top + fy * bottom);
16540
+ }
16541
+ }
16542
+ return out2;
16543
+ }
16529
16544
  for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
16530
16545
  const out = new Float64Array(src.length);
16531
16546
  for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
@@ -16620,7 +16635,7 @@ function expandedBlur(rgba, width, height, radius, x0, y0, x1, y1, cropped) {
16620
16635
  const gy1 = Math.min(height, y1 + r);
16621
16636
  copyBlock(rgba, width, gx0, gy0, gx1 - gx0, gy1 - gy0, buf, bw, gx0 - (x0 - r), gy0 - (y0 - r));
16622
16637
  }
16623
- const blurred = blurReduction(radius) > 1 ? effectBlur(buf, bw, bh, radius) : gdipBlur(buf, bw, bh, radius, cropped ? r : 0, cropped, false, bw, bh, Math.ceil((y1 - y0) / (x1 - x0)));
16638
+ const blurred = blurReduction(radius) > 1 ? effectBlur(buf, bw, bh, radius, true) : gdipBlur(buf, bw, bh, radius, cropped ? r : 0, cropped, false, bw, bh, Math.ceil((y1 - y0) / (x1 - x0)));
16624
16639
  const w = x1 - x0;
16625
16640
  const out = new Uint8ClampedArray(w * (y1 - y0) * 4);
16626
16641
  for (let y = 0; y < y1 - y0; y++) {
package/dist/browser.mjs CHANGED
@@ -16506,7 +16506,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical
16506
16506
  function blurReduction(radius) {
16507
16507
  return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
16508
16508
  }
16509
- function effectBlur(src, width, height, radius) {
16509
+ function effectBlur(src, width, height, radius, expanded = false) {
16510
16510
  const factor = blurReduction(radius);
16511
16511
  if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
16512
16512
  return gdipBlur(src, width, height, radius);
@@ -16524,6 +16524,21 @@ function effectBlur(src, width, height, radius) {
16524
16524
  }
16525
16525
  }
16526
16526
  const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
16527
+ if (!expanded) {
16528
+ const out2 = new Float64Array(src.length);
16529
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
16530
+ const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
16531
+ const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
16532
+ const x1 = Math.min(w - 1, ix + 1), y1 = Math.min(h - 1, iy + 1);
16533
+ for (let c = 0; c < 4; c++) {
16534
+ const at = (xx, yy) => filtered[(yy * w + xx) * 4 + c];
16535
+ const top = Math.floor((1 - fx) * at(ix, iy) + fx * at(x1, iy));
16536
+ const bottom = Math.floor((1 - fx) * at(ix, y1) + fx * at(x1, y1));
16537
+ out2[(y * width + x) * 4 + c] = Math.floor((1 - fy) * top + fy * bottom);
16538
+ }
16539
+ }
16540
+ return out2;
16541
+ }
16527
16542
  for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
16528
16543
  const out = new Float64Array(src.length);
16529
16544
  for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
@@ -16618,7 +16633,7 @@ function expandedBlur(rgba, width, height, radius, x0, y0, x1, y1, cropped) {
16618
16633
  const gy1 = Math.min(height, y1 + r);
16619
16634
  copyBlock(rgba, width, gx0, gy0, gx1 - gx0, gy1 - gy0, buf, bw, gx0 - (x0 - r), gy0 - (y0 - r));
16620
16635
  }
16621
- const blurred = blurReduction(radius) > 1 ? effectBlur(buf, bw, bh, radius) : gdipBlur(buf, bw, bh, radius, cropped ? r : 0, cropped, false, bw, bh, Math.ceil((y1 - y0) / (x1 - x0)));
16636
+ const blurred = blurReduction(radius) > 1 ? effectBlur(buf, bw, bh, radius, true) : gdipBlur(buf, bw, bh, radius, cropped ? r : 0, cropped, false, bw, bh, Math.ceil((y1 - y0) / (x1 - x0)));
16622
16637
  const w = x1 - x0;
16623
16638
  const out = new Uint8ClampedArray(w * (y1 - y0) * 4);
16624
16639
  for (let y = 0; y < y1 - y0; y++) {
package/dist/index.js CHANGED
@@ -16509,7 +16509,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical
16509
16509
  function blurReduction(radius) {
16510
16510
  return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
16511
16511
  }
16512
- function effectBlur(src, width, height, radius) {
16512
+ function effectBlur(src, width, height, radius, expanded = false) {
16513
16513
  const factor = blurReduction(radius);
16514
16514
  if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
16515
16515
  return gdipBlur(src, width, height, radius);
@@ -16527,6 +16527,21 @@ function effectBlur(src, width, height, radius) {
16527
16527
  }
16528
16528
  }
16529
16529
  const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
16530
+ if (!expanded) {
16531
+ const out2 = new Float64Array(src.length);
16532
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
16533
+ const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
16534
+ const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
16535
+ const x1 = Math.min(w - 1, ix + 1), y1 = Math.min(h - 1, iy + 1);
16536
+ for (let c = 0; c < 4; c++) {
16537
+ const at = (xx, yy) => filtered[(yy * w + xx) * 4 + c];
16538
+ const top = Math.floor((1 - fx) * at(ix, iy) + fx * at(x1, iy));
16539
+ const bottom = Math.floor((1 - fx) * at(ix, y1) + fx * at(x1, y1));
16540
+ out2[(y * width + x) * 4 + c] = Math.floor((1 - fy) * top + fy * bottom);
16541
+ }
16542
+ }
16543
+ return out2;
16544
+ }
16530
16545
  for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
16531
16546
  const out = new Float64Array(src.length);
16532
16547
  for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
@@ -16621,7 +16636,7 @@ function expandedBlur(rgba, width, height, radius, x0, y0, x1, y1, cropped) {
16621
16636
  const gy1 = Math.min(height, y1 + r);
16622
16637
  copyBlock(rgba, width, gx0, gy0, gx1 - gx0, gy1 - gy0, buf, bw, gx0 - (x0 - r), gy0 - (y0 - r));
16623
16638
  }
16624
- const blurred = blurReduction(radius) > 1 ? effectBlur(buf, bw, bh, radius) : gdipBlur(buf, bw, bh, radius, cropped ? r : 0, cropped, false, bw, bh, Math.ceil((y1 - y0) / (x1 - x0)));
16639
+ const blurred = blurReduction(radius) > 1 ? effectBlur(buf, bw, bh, radius, true) : gdipBlur(buf, bw, bh, radius, cropped ? r : 0, cropped, false, bw, bh, Math.ceil((y1 - y0) / (x1 - x0)));
16625
16640
  const w = x1 - x0;
16626
16641
  const out = new Uint8ClampedArray(w * (y1 - y0) * 4);
16627
16642
  for (let y = 0; y < y1 - y0; y++) {
package/dist/index.mjs CHANGED
@@ -16507,7 +16507,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical
16507
16507
  function blurReduction(radius) {
16508
16508
  return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
16509
16509
  }
16510
- function effectBlur(src, width, height, radius) {
16510
+ function effectBlur(src, width, height, radius, expanded = false) {
16511
16511
  const factor = blurReduction(radius);
16512
16512
  if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
16513
16513
  return gdipBlur(src, width, height, radius);
@@ -16525,6 +16525,21 @@ function effectBlur(src, width, height, radius) {
16525
16525
  }
16526
16526
  }
16527
16527
  const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
16528
+ if (!expanded) {
16529
+ const out2 = new Float64Array(src.length);
16530
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
16531
+ const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
16532
+ const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
16533
+ const x1 = Math.min(w - 1, ix + 1), y1 = Math.min(h - 1, iy + 1);
16534
+ for (let c = 0; c < 4; c++) {
16535
+ const at = (xx, yy) => filtered[(yy * w + xx) * 4 + c];
16536
+ const top = Math.floor((1 - fx) * at(ix, iy) + fx * at(x1, iy));
16537
+ const bottom = Math.floor((1 - fx) * at(ix, y1) + fx * at(x1, y1));
16538
+ out2[(y * width + x) * 4 + c] = Math.floor((1 - fy) * top + fy * bottom);
16539
+ }
16540
+ }
16541
+ return out2;
16542
+ }
16528
16543
  for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
16529
16544
  const out = new Float64Array(src.length);
16530
16545
  for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
@@ -16619,7 +16634,7 @@ function expandedBlur(rgba, width, height, radius, x0, y0, x1, y1, cropped) {
16619
16634
  const gy1 = Math.min(height, y1 + r);
16620
16635
  copyBlock(rgba, width, gx0, gy0, gx1 - gx0, gy1 - gy0, buf, bw, gx0 - (x0 - r), gy0 - (y0 - r));
16621
16636
  }
16622
- const blurred = blurReduction(radius) > 1 ? effectBlur(buf, bw, bh, radius) : gdipBlur(buf, bw, bh, radius, cropped ? r : 0, cropped, false, bw, bh, Math.ceil((y1 - y0) / (x1 - x0)));
16637
+ const blurred = blurReduction(radius) > 1 ? effectBlur(buf, bw, bh, radius, true) : gdipBlur(buf, bw, bh, radius, cropped ? r : 0, cropped, false, bw, bh, Math.ceil((y1 - y0) / (x1 - x0)));
16623
16638
  const w = x1 - x0;
16624
16639
  const out = new Uint8ClampedArray(w * (y1 - y0) * 4);
16625
16640
  for (let y = 0; y < y1 - y0; y++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emf-converter",
3
- "version": "4.6.1",
3
+ "version": "4.6.3",
4
4
  "description": "Convert EMF/WMF metafile binaries to PNG data URLs or SVG (markup, data URL, React/JSX)",
5
5
  "keywords": [
6
6
  "canvas",