emf-converter 4.8.13 → 4.8.14

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
@@ -11732,10 +11732,10 @@ function roundRectCorners(l, t, r, b, cw, ch, compatible = false, clockwise = fa
11732
11732
  ew = 0;
11733
11733
  eh = 0;
11734
11734
  }
11735
- const hy = compatible ? Math.round(eh / 2) : Math.floor(h / 2) - Math.floor((h - eh) / 2);
11735
+ const hy = compatible || clockwise ? Math.round(eh / 2) : Math.floor(h / 2) - Math.floor((h - eh) / 2);
11736
11736
  const topX = compatible ? Math.round(r - ew / 2) : Math.floor(r - ew / 2);
11737
11737
  const hx = r - topX;
11738
- const verticalControl = compatible && clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
11738
+ const verticalControl = clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
11739
11739
  const horizontalControl = Math.ceil(KAPPA * hx);
11740
11740
  const q = [r, t + hy, r, t + hy - verticalControl, r - hx + horizontalControl, t, topX, t];
11741
11741
  const mx = (x) => l + r - x;
@@ -16707,7 +16707,8 @@ function correctRedEyeArea(out, stride, x0, y0, x1, y1, carry) {
16707
16707
  const meanDark = sectorDark[s] / sectorCount[s];
16708
16708
  const ratio = meanDark > 0 ? dark[k] / meanDark : 1;
16709
16709
  const u = distance[k] / radius;
16710
- const falloff = Math.max(strength * (1 - u) * (1 - u), 0.5 * Math.max(0, 1 - ratio) ** 2);
16710
+ const darknessFalloff = ratio < 2 ? 0.5 * (1 - ratio) ** 2 : 0;
16711
+ const falloff = Math.max(strength * (1 - u) * (1 - u), darknessFalloff);
16711
16712
  const rest = (1 - falloff) * mean;
16712
16713
  if (rest >= v) {
16713
16714
  continue;
@@ -29789,7 +29790,7 @@ function roundRectDeviceBeziers(box, cw, ch, clockwise = false, compatible = fal
29789
29790
  for (let i = 0; i < q.length; i += 2) {
29790
29791
  pts.push(...map(q[i], clockwise ? f.t + f.b - q[i + 1] : q[i + 1]));
29791
29792
  }
29792
- if (box.halfX && !clockwise) {
29793
+ if (box.halfX) {
29793
29794
  for (const k of [1, 2, 3, 4, 5, 6, 8, 15]) {
29794
29795
  pts[2 * k]++;
29795
29796
  }
@@ -30880,7 +30881,7 @@ function fixExtent(rCtx, v, axis) {
30880
30881
  return Math.round(Math.abs(v) * k * 16);
30881
30882
  }
30882
30883
  var PS_INSIDEFRAME = 6;
30883
- function insideFrameInset(rCtx, box, rectangle = false) {
30884
+ function insideFrameInset(rCtx, box, rectangle = false, clockwiseRoundRect = false) {
30884
30885
  if ((rCtx.state.penStyle & 15) !== PS_INSIDEFRAME || !isAxisBox(box) || hasWorldRotation(rCtx)) {
30885
30886
  return null;
30886
30887
  }
@@ -30899,7 +30900,7 @@ function insideFrameInset(rCtx, box, rectangle = false) {
30899
30900
  }
30900
30901
  const lo = Math.floor(wx / 2);
30901
30902
  const hi = Math.ceil(wx / 2);
30902
- const y = Math.round(Math.ceil(wy / 2) * py);
30903
+ const y = Math.round((clockwiseRoundRect ? Math.floor(wy / 2) : Math.ceil(wy / 2)) * py);
30903
30904
  return {
30904
30905
  left: Math.round((rectangle ? hi : lo) * px),
30905
30906
  right: Math.round((rectangle ? lo : hi) * px),
@@ -31163,7 +31164,7 @@ function handleRoundRect(rCtx, dataOff, recSize) {
31163
31164
  const cornerH = view.getInt32(dataOff + 20, true);
31164
31165
  const clockwise = rCtx.state.arcDirection === 2;
31165
31166
  const unframed = uprightFixBox(rCtx, l, t, r, b);
31166
- const inset = insideFrameInset(rCtx, unframed);
31167
+ const inset = insideFrameInset(rCtx, unframed, false, clockwise);
31167
31168
  const framed = inset ? insetFixBox(unframed, inset) : unframed;
31168
31169
  const devM = gdiDeviceMatrix(rCtx);
31169
31170
  const cornerFixW = inset ? Math.abs(cornerW * devM[0]) * 16 : fixExtent(rCtx, cornerW, 0);
package/dist/browser.mjs CHANGED
@@ -11730,10 +11730,10 @@ function roundRectCorners(l, t, r, b, cw, ch, compatible = false, clockwise = fa
11730
11730
  ew = 0;
11731
11731
  eh = 0;
11732
11732
  }
11733
- const hy = compatible ? Math.round(eh / 2) : Math.floor(h / 2) - Math.floor((h - eh) / 2);
11733
+ const hy = compatible || clockwise ? Math.round(eh / 2) : Math.floor(h / 2) - Math.floor((h - eh) / 2);
11734
11734
  const topX = compatible ? Math.round(r - ew / 2) : Math.floor(r - ew / 2);
11735
11735
  const hx = r - topX;
11736
- const verticalControl = compatible && clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
11736
+ const verticalControl = clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
11737
11737
  const horizontalControl = Math.ceil(KAPPA * hx);
11738
11738
  const q = [r, t + hy, r, t + hy - verticalControl, r - hx + horizontalControl, t, topX, t];
11739
11739
  const mx = (x) => l + r - x;
@@ -16705,7 +16705,8 @@ function correctRedEyeArea(out, stride, x0, y0, x1, y1, carry) {
16705
16705
  const meanDark = sectorDark[s] / sectorCount[s];
16706
16706
  const ratio = meanDark > 0 ? dark[k] / meanDark : 1;
16707
16707
  const u = distance[k] / radius;
16708
- const falloff = Math.max(strength * (1 - u) * (1 - u), 0.5 * Math.max(0, 1 - ratio) ** 2);
16708
+ const darknessFalloff = ratio < 2 ? 0.5 * (1 - ratio) ** 2 : 0;
16709
+ const falloff = Math.max(strength * (1 - u) * (1 - u), darknessFalloff);
16709
16710
  const rest = (1 - falloff) * mean;
16710
16711
  if (rest >= v) {
16711
16712
  continue;
@@ -29787,7 +29788,7 @@ function roundRectDeviceBeziers(box, cw, ch, clockwise = false, compatible = fal
29787
29788
  for (let i = 0; i < q.length; i += 2) {
29788
29789
  pts.push(...map(q[i], clockwise ? f.t + f.b - q[i + 1] : q[i + 1]));
29789
29790
  }
29790
- if (box.halfX && !clockwise) {
29791
+ if (box.halfX) {
29791
29792
  for (const k of [1, 2, 3, 4, 5, 6, 8, 15]) {
29792
29793
  pts[2 * k]++;
29793
29794
  }
@@ -30878,7 +30879,7 @@ function fixExtent(rCtx, v, axis) {
30878
30879
  return Math.round(Math.abs(v) * k * 16);
30879
30880
  }
30880
30881
  var PS_INSIDEFRAME = 6;
30881
- function insideFrameInset(rCtx, box, rectangle = false) {
30882
+ function insideFrameInset(rCtx, box, rectangle = false, clockwiseRoundRect = false) {
30882
30883
  if ((rCtx.state.penStyle & 15) !== PS_INSIDEFRAME || !isAxisBox(box) || hasWorldRotation(rCtx)) {
30883
30884
  return null;
30884
30885
  }
@@ -30897,7 +30898,7 @@ function insideFrameInset(rCtx, box, rectangle = false) {
30897
30898
  }
30898
30899
  const lo = Math.floor(wx / 2);
30899
30900
  const hi = Math.ceil(wx / 2);
30900
- const y = Math.round(Math.ceil(wy / 2) * py);
30901
+ const y = Math.round((clockwiseRoundRect ? Math.floor(wy / 2) : Math.ceil(wy / 2)) * py);
30901
30902
  return {
30902
30903
  left: Math.round((rectangle ? hi : lo) * px),
30903
30904
  right: Math.round((rectangle ? lo : hi) * px),
@@ -31161,7 +31162,7 @@ function handleRoundRect(rCtx, dataOff, recSize) {
31161
31162
  const cornerH = view.getInt32(dataOff + 20, true);
31162
31163
  const clockwise = rCtx.state.arcDirection === 2;
31163
31164
  const unframed = uprightFixBox(rCtx, l, t, r, b);
31164
- const inset = insideFrameInset(rCtx, unframed);
31165
+ const inset = insideFrameInset(rCtx, unframed, false, clockwise);
31165
31166
  const framed = inset ? insetFixBox(unframed, inset) : unframed;
31166
31167
  const devM = gdiDeviceMatrix(rCtx);
31167
31168
  const cornerFixW = inset ? Math.abs(cornerW * devM[0]) * 16 : fixExtent(rCtx, cornerW, 0);
package/dist/index.js CHANGED
@@ -11733,10 +11733,10 @@ function roundRectCorners(l, t, r, b, cw, ch, compatible = false, clockwise = fa
11733
11733
  ew = 0;
11734
11734
  eh = 0;
11735
11735
  }
11736
- const hy = compatible ? Math.round(eh / 2) : Math.floor(h / 2) - Math.floor((h - eh) / 2);
11736
+ const hy = compatible || clockwise ? Math.round(eh / 2) : Math.floor(h / 2) - Math.floor((h - eh) / 2);
11737
11737
  const topX = compatible ? Math.round(r - ew / 2) : Math.floor(r - ew / 2);
11738
11738
  const hx = r - topX;
11739
- const verticalControl = compatible && clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
11739
+ const verticalControl = clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
11740
11740
  const horizontalControl = Math.ceil(KAPPA * hx);
11741
11741
  const q = [r, t + hy, r, t + hy - verticalControl, r - hx + horizontalControl, t, topX, t];
11742
11742
  const mx = (x) => l + r - x;
@@ -16708,7 +16708,8 @@ function correctRedEyeArea(out, stride, x0, y0, x1, y1, carry) {
16708
16708
  const meanDark = sectorDark[s] / sectorCount[s];
16709
16709
  const ratio = meanDark > 0 ? dark[k] / meanDark : 1;
16710
16710
  const u = distance[k] / radius;
16711
- const falloff = Math.max(strength * (1 - u) * (1 - u), 0.5 * Math.max(0, 1 - ratio) ** 2);
16711
+ const darknessFalloff = ratio < 2 ? 0.5 * (1 - ratio) ** 2 : 0;
16712
+ const falloff = Math.max(strength * (1 - u) * (1 - u), darknessFalloff);
16712
16713
  const rest = (1 - falloff) * mean;
16713
16714
  if (rest >= v) {
16714
16715
  continue;
@@ -29790,7 +29791,7 @@ function roundRectDeviceBeziers(box, cw, ch, clockwise = false, compatible = fal
29790
29791
  for (let i = 0; i < q.length; i += 2) {
29791
29792
  pts.push(...map(q[i], clockwise ? f.t + f.b - q[i + 1] : q[i + 1]));
29792
29793
  }
29793
- if (box.halfX && !clockwise) {
29794
+ if (box.halfX) {
29794
29795
  for (const k of [1, 2, 3, 4, 5, 6, 8, 15]) {
29795
29796
  pts[2 * k]++;
29796
29797
  }
@@ -30881,7 +30882,7 @@ function fixExtent(rCtx, v, axis) {
30881
30882
  return Math.round(Math.abs(v) * k * 16);
30882
30883
  }
30883
30884
  var PS_INSIDEFRAME = 6;
30884
- function insideFrameInset(rCtx, box, rectangle = false) {
30885
+ function insideFrameInset(rCtx, box, rectangle = false, clockwiseRoundRect = false) {
30885
30886
  if ((rCtx.state.penStyle & 15) !== PS_INSIDEFRAME || !isAxisBox(box) || hasWorldRotation(rCtx)) {
30886
30887
  return null;
30887
30888
  }
@@ -30900,7 +30901,7 @@ function insideFrameInset(rCtx, box, rectangle = false) {
30900
30901
  }
30901
30902
  const lo = Math.floor(wx / 2);
30902
30903
  const hi = Math.ceil(wx / 2);
30903
- const y = Math.round(Math.ceil(wy / 2) * py);
30904
+ const y = Math.round((clockwiseRoundRect ? Math.floor(wy / 2) : Math.ceil(wy / 2)) * py);
30904
30905
  return {
30905
30906
  left: Math.round((rectangle ? hi : lo) * px),
30906
30907
  right: Math.round((rectangle ? lo : hi) * px),
@@ -31164,7 +31165,7 @@ function handleRoundRect(rCtx, dataOff, recSize) {
31164
31165
  const cornerH = view.getInt32(dataOff + 20, true);
31165
31166
  const clockwise = rCtx.state.arcDirection === 2;
31166
31167
  const unframed = uprightFixBox(rCtx, l, t, r, b);
31167
- const inset = insideFrameInset(rCtx, unframed);
31168
+ const inset = insideFrameInset(rCtx, unframed, false, clockwise);
31168
31169
  const framed = inset ? insetFixBox(unframed, inset) : unframed;
31169
31170
  const devM = gdiDeviceMatrix(rCtx);
31170
31171
  const cornerFixW = inset ? Math.abs(cornerW * devM[0]) * 16 : fixExtent(rCtx, cornerW, 0);
package/dist/index.mjs CHANGED
@@ -11731,10 +11731,10 @@ function roundRectCorners(l, t, r, b, cw, ch, compatible = false, clockwise = fa
11731
11731
  ew = 0;
11732
11732
  eh = 0;
11733
11733
  }
11734
- const hy = compatible ? Math.round(eh / 2) : Math.floor(h / 2) - Math.floor((h - eh) / 2);
11734
+ const hy = compatible || clockwise ? Math.round(eh / 2) : Math.floor(h / 2) - Math.floor((h - eh) / 2);
11735
11735
  const topX = compatible ? Math.round(r - ew / 2) : Math.floor(r - ew / 2);
11736
11736
  const hx = r - topX;
11737
- const verticalControl = compatible && clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
11737
+ const verticalControl = clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
11738
11738
  const horizontalControl = Math.ceil(KAPPA * hx);
11739
11739
  const q = [r, t + hy, r, t + hy - verticalControl, r - hx + horizontalControl, t, topX, t];
11740
11740
  const mx = (x) => l + r - x;
@@ -16706,7 +16706,8 @@ function correctRedEyeArea(out, stride, x0, y0, x1, y1, carry) {
16706
16706
  const meanDark = sectorDark[s] / sectorCount[s];
16707
16707
  const ratio = meanDark > 0 ? dark[k] / meanDark : 1;
16708
16708
  const u = distance[k] / radius;
16709
- const falloff = Math.max(strength * (1 - u) * (1 - u), 0.5 * Math.max(0, 1 - ratio) ** 2);
16709
+ const darknessFalloff = ratio < 2 ? 0.5 * (1 - ratio) ** 2 : 0;
16710
+ const falloff = Math.max(strength * (1 - u) * (1 - u), darknessFalloff);
16710
16711
  const rest = (1 - falloff) * mean;
16711
16712
  if (rest >= v) {
16712
16713
  continue;
@@ -29788,7 +29789,7 @@ function roundRectDeviceBeziers(box, cw, ch, clockwise = false, compatible = fal
29788
29789
  for (let i = 0; i < q.length; i += 2) {
29789
29790
  pts.push(...map(q[i], clockwise ? f.t + f.b - q[i + 1] : q[i + 1]));
29790
29791
  }
29791
- if (box.halfX && !clockwise) {
29792
+ if (box.halfX) {
29792
29793
  for (const k of [1, 2, 3, 4, 5, 6, 8, 15]) {
29793
29794
  pts[2 * k]++;
29794
29795
  }
@@ -30879,7 +30880,7 @@ function fixExtent(rCtx, v, axis) {
30879
30880
  return Math.round(Math.abs(v) * k * 16);
30880
30881
  }
30881
30882
  var PS_INSIDEFRAME = 6;
30882
- function insideFrameInset(rCtx, box, rectangle = false) {
30883
+ function insideFrameInset(rCtx, box, rectangle = false, clockwiseRoundRect = false) {
30883
30884
  if ((rCtx.state.penStyle & 15) !== PS_INSIDEFRAME || !isAxisBox(box) || hasWorldRotation(rCtx)) {
30884
30885
  return null;
30885
30886
  }
@@ -30898,7 +30899,7 @@ function insideFrameInset(rCtx, box, rectangle = false) {
30898
30899
  }
30899
30900
  const lo = Math.floor(wx / 2);
30900
30901
  const hi = Math.ceil(wx / 2);
30901
- const y = Math.round(Math.ceil(wy / 2) * py);
30902
+ const y = Math.round((clockwiseRoundRect ? Math.floor(wy / 2) : Math.ceil(wy / 2)) * py);
30902
30903
  return {
30903
30904
  left: Math.round((rectangle ? hi : lo) * px),
30904
30905
  right: Math.round((rectangle ? lo : hi) * px),
@@ -31162,7 +31163,7 @@ function handleRoundRect(rCtx, dataOff, recSize) {
31162
31163
  const cornerH = view.getInt32(dataOff + 20, true);
31163
31164
  const clockwise = rCtx.state.arcDirection === 2;
31164
31165
  const unframed = uprightFixBox(rCtx, l, t, r, b);
31165
- const inset = insideFrameInset(rCtx, unframed);
31166
+ const inset = insideFrameInset(rCtx, unframed, false, clockwise);
31166
31167
  const framed = inset ? insetFixBox(unframed, inset) : unframed;
31167
31168
  const devM = gdiDeviceMatrix(rCtx);
31168
31169
  const cornerFixW = inset ? Math.abs(cornerW * devM[0]) * 16 : fixExtent(rCtx, cornerW, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emf-converter",
3
- "version": "4.8.13",
3
+ "version": "4.8.14",
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",