emf-converter 4.8.12 → 4.8.13

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
@@ -15906,7 +15906,7 @@ function stopColorAt(stops, t) {
15906
15906
  }
15907
15907
  return stops[stops.length - 1].argb;
15908
15908
  }
15909
- function pathGradientColorAt(shape, x, y) {
15909
+ function pathGradientColorAt(shape, x, y, focusPoint) {
15910
15910
  const { center, boundary, boundaryArgb } = shape;
15911
15911
  const n = boundary.length;
15912
15912
  const px = x - center.x;
@@ -15955,6 +15955,10 @@ function pathGradientColorAt(shape, x, y) {
15955
15955
  const ey = b.y - a.y;
15956
15956
  const cross = ax * ey - ay * ex;
15957
15957
  if (Math.abs(cross) < 1e-12) continue;
15958
+ if (fx === 0 && fy > 0 && Math.abs((focusPoint?.x ?? x) - center.x) < eps && ex > 0 && Math.max(ax, ax + ex) > 0 && Math.abs(ey) > eps) {
15959
+ const u = (((focusPoint?.y ?? y) - center.y) / fy - ay) / ey;
15960
+ if (u >= -eps && u <= 1 + eps) inFocus = true;
15961
+ }
15958
15962
  if ((fx > 0 || Math.abs(px) < eps) && (fy > 0 || Math.abs(py) < eps)) {
15959
15963
  const x2 = fx > 0 ? px / fx : 0;
15960
15964
  const y2 = fy > 0 ? py / fy : 0;
@@ -30409,7 +30413,8 @@ function pathGradientSampler(shape, wrap, device) {
30409
30413
  by = foldIntoTile(by, box.y, box.h, mirrorY, lagY);
30410
30414
  }
30411
30415
  if (wrap === "clamp" && by >= box.y + box.h) continue;
30412
- const c = pathGradientColorAt(shape, bx, by);
30416
+ const focusPoint = bias && shape.focus?.x === 0 ? { x: bx - inv2[0] * bias, y: by - inv2[1] * bias } : void 0;
30417
+ const c = pathGradientColorAt(shape, bx, by, focusPoint);
30413
30418
  if (c === null) {
30414
30419
  continue;
30415
30420
  }
package/dist/browser.mjs CHANGED
@@ -15904,7 +15904,7 @@ function stopColorAt(stops, t) {
15904
15904
  }
15905
15905
  return stops[stops.length - 1].argb;
15906
15906
  }
15907
- function pathGradientColorAt(shape, x, y) {
15907
+ function pathGradientColorAt(shape, x, y, focusPoint) {
15908
15908
  const { center, boundary, boundaryArgb } = shape;
15909
15909
  const n = boundary.length;
15910
15910
  const px = x - center.x;
@@ -15953,6 +15953,10 @@ function pathGradientColorAt(shape, x, y) {
15953
15953
  const ey = b.y - a.y;
15954
15954
  const cross = ax * ey - ay * ex;
15955
15955
  if (Math.abs(cross) < 1e-12) continue;
15956
+ if (fx === 0 && fy > 0 && Math.abs((focusPoint?.x ?? x) - center.x) < eps && ex > 0 && Math.max(ax, ax + ex) > 0 && Math.abs(ey) > eps) {
15957
+ const u = (((focusPoint?.y ?? y) - center.y) / fy - ay) / ey;
15958
+ if (u >= -eps && u <= 1 + eps) inFocus = true;
15959
+ }
15956
15960
  if ((fx > 0 || Math.abs(px) < eps) && (fy > 0 || Math.abs(py) < eps)) {
15957
15961
  const x2 = fx > 0 ? px / fx : 0;
15958
15962
  const y2 = fy > 0 ? py / fy : 0;
@@ -30407,7 +30411,8 @@ function pathGradientSampler(shape, wrap, device) {
30407
30411
  by = foldIntoTile(by, box.y, box.h, mirrorY, lagY);
30408
30412
  }
30409
30413
  if (wrap === "clamp" && by >= box.y + box.h) continue;
30410
- const c = pathGradientColorAt(shape, bx, by);
30414
+ const focusPoint = bias && shape.focus?.x === 0 ? { x: bx - inv2[0] * bias, y: by - inv2[1] * bias } : void 0;
30415
+ const c = pathGradientColorAt(shape, bx, by, focusPoint);
30411
30416
  if (c === null) {
30412
30417
  continue;
30413
30418
  }
package/dist/index.js CHANGED
@@ -15907,7 +15907,7 @@ function stopColorAt(stops, t) {
15907
15907
  }
15908
15908
  return stops[stops.length - 1].argb;
15909
15909
  }
15910
- function pathGradientColorAt(shape, x, y) {
15910
+ function pathGradientColorAt(shape, x, y, focusPoint) {
15911
15911
  const { center, boundary, boundaryArgb } = shape;
15912
15912
  const n = boundary.length;
15913
15913
  const px = x - center.x;
@@ -15956,6 +15956,10 @@ function pathGradientColorAt(shape, x, y) {
15956
15956
  const ey = b.y - a.y;
15957
15957
  const cross = ax * ey - ay * ex;
15958
15958
  if (Math.abs(cross) < 1e-12) continue;
15959
+ if (fx === 0 && fy > 0 && Math.abs((focusPoint?.x ?? x) - center.x) < eps && ex > 0 && Math.max(ax, ax + ex) > 0 && Math.abs(ey) > eps) {
15960
+ const u = (((focusPoint?.y ?? y) - center.y) / fy - ay) / ey;
15961
+ if (u >= -eps && u <= 1 + eps) inFocus = true;
15962
+ }
15959
15963
  if ((fx > 0 || Math.abs(px) < eps) && (fy > 0 || Math.abs(py) < eps)) {
15960
15964
  const x2 = fx > 0 ? px / fx : 0;
15961
15965
  const y2 = fy > 0 ? py / fy : 0;
@@ -30410,7 +30414,8 @@ function pathGradientSampler(shape, wrap, device) {
30410
30414
  by = foldIntoTile(by, box.y, box.h, mirrorY, lagY);
30411
30415
  }
30412
30416
  if (wrap === "clamp" && by >= box.y + box.h) continue;
30413
- const c = pathGradientColorAt(shape, bx, by);
30417
+ const focusPoint = bias && shape.focus?.x === 0 ? { x: bx - inv2[0] * bias, y: by - inv2[1] * bias } : void 0;
30418
+ const c = pathGradientColorAt(shape, bx, by, focusPoint);
30414
30419
  if (c === null) {
30415
30420
  continue;
30416
30421
  }
package/dist/index.mjs CHANGED
@@ -15905,7 +15905,7 @@ function stopColorAt(stops, t) {
15905
15905
  }
15906
15906
  return stops[stops.length - 1].argb;
15907
15907
  }
15908
- function pathGradientColorAt(shape, x, y) {
15908
+ function pathGradientColorAt(shape, x, y, focusPoint) {
15909
15909
  const { center, boundary, boundaryArgb } = shape;
15910
15910
  const n = boundary.length;
15911
15911
  const px = x - center.x;
@@ -15954,6 +15954,10 @@ function pathGradientColorAt(shape, x, y) {
15954
15954
  const ey = b.y - a.y;
15955
15955
  const cross = ax * ey - ay * ex;
15956
15956
  if (Math.abs(cross) < 1e-12) continue;
15957
+ if (fx === 0 && fy > 0 && Math.abs((focusPoint?.x ?? x) - center.x) < eps && ex > 0 && Math.max(ax, ax + ex) > 0 && Math.abs(ey) > eps) {
15958
+ const u = (((focusPoint?.y ?? y) - center.y) / fy - ay) / ey;
15959
+ if (u >= -eps && u <= 1 + eps) inFocus = true;
15960
+ }
15957
15961
  if ((fx > 0 || Math.abs(px) < eps) && (fy > 0 || Math.abs(py) < eps)) {
15958
15962
  const x2 = fx > 0 ? px / fx : 0;
15959
15963
  const y2 = fy > 0 ? py / fy : 0;
@@ -30408,7 +30412,8 @@ function pathGradientSampler(shape, wrap, device) {
30408
30412
  by = foldIntoTile(by, box.y, box.h, mirrorY, lagY);
30409
30413
  }
30410
30414
  if (wrap === "clamp" && by >= box.y + box.h) continue;
30411
- const c = pathGradientColorAt(shape, bx, by);
30415
+ const focusPoint = bias && shape.focus?.x === 0 ? { x: bx - inv2[0] * bias, y: by - inv2[1] * bias } : void 0;
30416
+ const c = pathGradientColorAt(shape, bx, by, focusPoint);
30412
30417
  if (c === null) {
30413
30418
  continue;
30414
30419
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emf-converter",
3
- "version": "4.8.12",
3
+ "version": "4.8.13",
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",