emf-converter 4.4.7 → 4.4.8
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 +38 -6
- package/dist/browser.mjs +38 -6
- package/dist/index.js +38 -6
- package/dist/index.mjs +38 -6
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -15763,11 +15763,11 @@ function mirror(p, n) {
|
|
|
15763
15763
|
}
|
|
15764
15764
|
return p;
|
|
15765
15765
|
}
|
|
15766
|
-
function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
15766
|
+
function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical = false, edgeWidth = w, edgeHeight = h) {
|
|
15767
15767
|
const k = blurKernel(radius);
|
|
15768
15768
|
const taps = (k.length - 1) / 2;
|
|
15769
|
-
const horizontalIndex =
|
|
15770
|
-
const verticalIndex =
|
|
15769
|
+
const horizontalIndex = taps >= edgeWidth ? (x) => Math.max(0, Math.min(w - 1, x)) : (x) => mirror(x, w);
|
|
15770
|
+
const verticalIndex = taps >= edgeHeight ? (y) => Math.max(0, Math.min(h - 1, y)) : (y) => mirror(y, h);
|
|
15771
15771
|
const out = new Float64Array(w * h * 4);
|
|
15772
15772
|
for (let y = 0; y < h; y++) {
|
|
15773
15773
|
const row = y * w * 4;
|
|
@@ -15793,7 +15793,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
|
15793
15793
|
}
|
|
15794
15794
|
if (taps > 0 && vRow >= 0 && vRow < h) {
|
|
15795
15795
|
const horizontal = out.slice();
|
|
15796
|
-
const endRow = Math.min(h, vRow +
|
|
15796
|
+
const endRow = fullVertical ? h : Math.min(h, vRow + Math.ceil(h / w));
|
|
15797
15797
|
for (let row = vRow; row < endRow; row++) {
|
|
15798
15798
|
const col = new Float64Array(w * 4);
|
|
15799
15799
|
for (let j = -taps; j <= taps; j++) {
|
|
@@ -15811,14 +15811,46 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
|
15811
15811
|
}
|
|
15812
15812
|
return out;
|
|
15813
15813
|
}
|
|
15814
|
+
function blurReduction(radius) {
|
|
15815
|
+
return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
|
|
15816
|
+
}
|
|
15817
|
+
function effectBlur(src, width, height, radius) {
|
|
15818
|
+
const factor = blurReduction(radius);
|
|
15819
|
+
if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
|
|
15820
|
+
return gdipBlur(src, width, height, radius);
|
|
15821
|
+
}
|
|
15822
|
+
const w = Math.ceil(width / factor);
|
|
15823
|
+
const h = Math.ceil(height / factor);
|
|
15824
|
+
const reduced = new Uint8ClampedArray(w * h * 4);
|
|
15825
|
+
for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) {
|
|
15826
|
+
const x1 = Math.min(width, (x + 1) * factor), y1 = Math.min(height, (y + 1) * factor);
|
|
15827
|
+
const count = (x1 - x * factor) * (y1 - y * factor);
|
|
15828
|
+
for (let c = 0; c < 4; c++) {
|
|
15829
|
+
let sum = 0;
|
|
15830
|
+
for (let yy = y * factor; yy < y1; yy++) for (let xx = x * factor; xx < x1; xx++) sum += src[(yy * width + xx) * 4 + c];
|
|
15831
|
+
reduced[(y * w + x) * 4 + c] = Math.floor(sum / count);
|
|
15832
|
+
}
|
|
15833
|
+
}
|
|
15834
|
+
const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
|
|
15835
|
+
for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
|
|
15836
|
+
const out = new Float64Array(src.length);
|
|
15837
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
15838
|
+
const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
|
|
15839
|
+
const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
|
|
15840
|
+
const a = (iy * w + ix) * 4, b = (iy * w + Math.min(w - 1, ix + 1)) * 4;
|
|
15841
|
+
const d = (Math.min(h - 1, iy + 1) * w + ix) * 4, e = (Math.min(h - 1, iy + 1) * w + Math.min(w - 1, ix + 1)) * 4;
|
|
15842
|
+
for (let c = 0; c < 4; c++) out[(y * width + x) * 4 + c] = Math.round((1 - fy) * ((1 - fx) * filtered[a + c] + fx * filtered[b + c]) + fy * ((1 - fx) * filtered[d + c] + fx * filtered[e + c]));
|
|
15843
|
+
}
|
|
15844
|
+
return out;
|
|
15845
|
+
}
|
|
15814
15846
|
function applyBlur(src, w, h, radius) {
|
|
15815
|
-
return Uint8ClampedArray.from(
|
|
15847
|
+
return Uint8ClampedArray.from(effectBlur(src, w, h, radius), Math.round);
|
|
15816
15848
|
}
|
|
15817
15849
|
function sharpenGain(_radius, amount) {
|
|
15818
15850
|
return roundHalfDown(64 * amount / (250 - 2 * amount)) / 64;
|
|
15819
15851
|
}
|
|
15820
15852
|
function applySharpen(src, w, h, radius, amount) {
|
|
15821
|
-
const blurred =
|
|
15853
|
+
const blurred = effectBlur(src, w, h, radius);
|
|
15822
15854
|
const gain = sharpenGain(radius, amount);
|
|
15823
15855
|
const out = new Uint8ClampedArray(src);
|
|
15824
15856
|
for (let i = 0; i < src.length; i += 4) {
|
package/dist/browser.mjs
CHANGED
|
@@ -15761,11 +15761,11 @@ function mirror(p, n) {
|
|
|
15761
15761
|
}
|
|
15762
15762
|
return p;
|
|
15763
15763
|
}
|
|
15764
|
-
function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
15764
|
+
function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical = false, edgeWidth = w, edgeHeight = h) {
|
|
15765
15765
|
const k = blurKernel(radius);
|
|
15766
15766
|
const taps = (k.length - 1) / 2;
|
|
15767
|
-
const horizontalIndex =
|
|
15768
|
-
const verticalIndex =
|
|
15767
|
+
const horizontalIndex = taps >= edgeWidth ? (x) => Math.max(0, Math.min(w - 1, x)) : (x) => mirror(x, w);
|
|
15768
|
+
const verticalIndex = taps >= edgeHeight ? (y) => Math.max(0, Math.min(h - 1, y)) : (y) => mirror(y, h);
|
|
15769
15769
|
const out = new Float64Array(w * h * 4);
|
|
15770
15770
|
for (let y = 0; y < h; y++) {
|
|
15771
15771
|
const row = y * w * 4;
|
|
@@ -15791,7 +15791,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
|
15791
15791
|
}
|
|
15792
15792
|
if (taps > 0 && vRow >= 0 && vRow < h) {
|
|
15793
15793
|
const horizontal = out.slice();
|
|
15794
|
-
const endRow = Math.min(h, vRow +
|
|
15794
|
+
const endRow = fullVertical ? h : Math.min(h, vRow + Math.ceil(h / w));
|
|
15795
15795
|
for (let row = vRow; row < endRow; row++) {
|
|
15796
15796
|
const col = new Float64Array(w * 4);
|
|
15797
15797
|
for (let j = -taps; j <= taps; j++) {
|
|
@@ -15809,14 +15809,46 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
|
15809
15809
|
}
|
|
15810
15810
|
return out;
|
|
15811
15811
|
}
|
|
15812
|
+
function blurReduction(radius) {
|
|
15813
|
+
return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
|
|
15814
|
+
}
|
|
15815
|
+
function effectBlur(src, width, height, radius) {
|
|
15816
|
+
const factor = blurReduction(radius);
|
|
15817
|
+
if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
|
|
15818
|
+
return gdipBlur(src, width, height, radius);
|
|
15819
|
+
}
|
|
15820
|
+
const w = Math.ceil(width / factor);
|
|
15821
|
+
const h = Math.ceil(height / factor);
|
|
15822
|
+
const reduced = new Uint8ClampedArray(w * h * 4);
|
|
15823
|
+
for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) {
|
|
15824
|
+
const x1 = Math.min(width, (x + 1) * factor), y1 = Math.min(height, (y + 1) * factor);
|
|
15825
|
+
const count = (x1 - x * factor) * (y1 - y * factor);
|
|
15826
|
+
for (let c = 0; c < 4; c++) {
|
|
15827
|
+
let sum = 0;
|
|
15828
|
+
for (let yy = y * factor; yy < y1; yy++) for (let xx = x * factor; xx < x1; xx++) sum += src[(yy * width + xx) * 4 + c];
|
|
15829
|
+
reduced[(y * w + x) * 4 + c] = Math.floor(sum / count);
|
|
15830
|
+
}
|
|
15831
|
+
}
|
|
15832
|
+
const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
|
|
15833
|
+
for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
|
|
15834
|
+
const out = new Float64Array(src.length);
|
|
15835
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
15836
|
+
const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
|
|
15837
|
+
const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
|
|
15838
|
+
const a = (iy * w + ix) * 4, b = (iy * w + Math.min(w - 1, ix + 1)) * 4;
|
|
15839
|
+
const d = (Math.min(h - 1, iy + 1) * w + ix) * 4, e = (Math.min(h - 1, iy + 1) * w + Math.min(w - 1, ix + 1)) * 4;
|
|
15840
|
+
for (let c = 0; c < 4; c++) out[(y * width + x) * 4 + c] = Math.round((1 - fy) * ((1 - fx) * filtered[a + c] + fx * filtered[b + c]) + fy * ((1 - fx) * filtered[d + c] + fx * filtered[e + c]));
|
|
15841
|
+
}
|
|
15842
|
+
return out;
|
|
15843
|
+
}
|
|
15812
15844
|
function applyBlur(src, w, h, radius) {
|
|
15813
|
-
return Uint8ClampedArray.from(
|
|
15845
|
+
return Uint8ClampedArray.from(effectBlur(src, w, h, radius), Math.round);
|
|
15814
15846
|
}
|
|
15815
15847
|
function sharpenGain(_radius, amount) {
|
|
15816
15848
|
return roundHalfDown(64 * amount / (250 - 2 * amount)) / 64;
|
|
15817
15849
|
}
|
|
15818
15850
|
function applySharpen(src, w, h, radius, amount) {
|
|
15819
|
-
const blurred =
|
|
15851
|
+
const blurred = effectBlur(src, w, h, radius);
|
|
15820
15852
|
const gain = sharpenGain(radius, amount);
|
|
15821
15853
|
const out = new Uint8ClampedArray(src);
|
|
15822
15854
|
for (let i = 0; i < src.length; i += 4) {
|
package/dist/index.js
CHANGED
|
@@ -15764,11 +15764,11 @@ function mirror(p, n) {
|
|
|
15764
15764
|
}
|
|
15765
15765
|
return p;
|
|
15766
15766
|
}
|
|
15767
|
-
function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
15767
|
+
function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical = false, edgeWidth = w, edgeHeight = h) {
|
|
15768
15768
|
const k = blurKernel(radius);
|
|
15769
15769
|
const taps = (k.length - 1) / 2;
|
|
15770
|
-
const horizontalIndex =
|
|
15771
|
-
const verticalIndex =
|
|
15770
|
+
const horizontalIndex = taps >= edgeWidth ? (x) => Math.max(0, Math.min(w - 1, x)) : (x) => mirror(x, w);
|
|
15771
|
+
const verticalIndex = taps >= edgeHeight ? (y) => Math.max(0, Math.min(h - 1, y)) : (y) => mirror(y, h);
|
|
15772
15772
|
const out = new Float64Array(w * h * 4);
|
|
15773
15773
|
for (let y = 0; y < h; y++) {
|
|
15774
15774
|
const row = y * w * 4;
|
|
@@ -15794,7 +15794,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
|
15794
15794
|
}
|
|
15795
15795
|
if (taps > 0 && vRow >= 0 && vRow < h) {
|
|
15796
15796
|
const horizontal = out.slice();
|
|
15797
|
-
const endRow = Math.min(h, vRow +
|
|
15797
|
+
const endRow = fullVertical ? h : Math.min(h, vRow + Math.ceil(h / w));
|
|
15798
15798
|
for (let row = vRow; row < endRow; row++) {
|
|
15799
15799
|
const col = new Float64Array(w * 4);
|
|
15800
15800
|
for (let j = -taps; j <= taps; j++) {
|
|
@@ -15812,14 +15812,46 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
|
15812
15812
|
}
|
|
15813
15813
|
return out;
|
|
15814
15814
|
}
|
|
15815
|
+
function blurReduction(radius) {
|
|
15816
|
+
return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
|
|
15817
|
+
}
|
|
15818
|
+
function effectBlur(src, width, height, radius) {
|
|
15819
|
+
const factor = blurReduction(radius);
|
|
15820
|
+
if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
|
|
15821
|
+
return gdipBlur(src, width, height, radius);
|
|
15822
|
+
}
|
|
15823
|
+
const w = Math.ceil(width / factor);
|
|
15824
|
+
const h = Math.ceil(height / factor);
|
|
15825
|
+
const reduced = new Uint8ClampedArray(w * h * 4);
|
|
15826
|
+
for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) {
|
|
15827
|
+
const x1 = Math.min(width, (x + 1) * factor), y1 = Math.min(height, (y + 1) * factor);
|
|
15828
|
+
const count = (x1 - x * factor) * (y1 - y * factor);
|
|
15829
|
+
for (let c = 0; c < 4; c++) {
|
|
15830
|
+
let sum = 0;
|
|
15831
|
+
for (let yy = y * factor; yy < y1; yy++) for (let xx = x * factor; xx < x1; xx++) sum += src[(yy * width + xx) * 4 + c];
|
|
15832
|
+
reduced[(y * w + x) * 4 + c] = Math.floor(sum / count);
|
|
15833
|
+
}
|
|
15834
|
+
}
|
|
15835
|
+
const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
|
|
15836
|
+
for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
|
|
15837
|
+
const out = new Float64Array(src.length);
|
|
15838
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
15839
|
+
const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
|
|
15840
|
+
const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
|
|
15841
|
+
const a = (iy * w + ix) * 4, b = (iy * w + Math.min(w - 1, ix + 1)) * 4;
|
|
15842
|
+
const d = (Math.min(h - 1, iy + 1) * w + ix) * 4, e = (Math.min(h - 1, iy + 1) * w + Math.min(w - 1, ix + 1)) * 4;
|
|
15843
|
+
for (let c = 0; c < 4; c++) out[(y * width + x) * 4 + c] = Math.round((1 - fy) * ((1 - fx) * filtered[a + c] + fx * filtered[b + c]) + fy * ((1 - fx) * filtered[d + c] + fx * filtered[e + c]));
|
|
15844
|
+
}
|
|
15845
|
+
return out;
|
|
15846
|
+
}
|
|
15815
15847
|
function applyBlur(src, w, h, radius) {
|
|
15816
|
-
return Uint8ClampedArray.from(
|
|
15848
|
+
return Uint8ClampedArray.from(effectBlur(src, w, h, radius), Math.round);
|
|
15817
15849
|
}
|
|
15818
15850
|
function sharpenGain(_radius, amount) {
|
|
15819
15851
|
return roundHalfDown(64 * amount / (250 - 2 * amount)) / 64;
|
|
15820
15852
|
}
|
|
15821
15853
|
function applySharpen(src, w, h, radius, amount) {
|
|
15822
|
-
const blurred =
|
|
15854
|
+
const blurred = effectBlur(src, w, h, radius);
|
|
15823
15855
|
const gain = sharpenGain(radius, amount);
|
|
15824
15856
|
const out = new Uint8ClampedArray(src);
|
|
15825
15857
|
for (let i = 0; i < src.length; i += 4) {
|
package/dist/index.mjs
CHANGED
|
@@ -15762,11 +15762,11 @@ function mirror(p, n) {
|
|
|
15762
15762
|
}
|
|
15763
15763
|
return p;
|
|
15764
15764
|
}
|
|
15765
|
-
function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
15765
|
+
function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical = false, edgeWidth = w, edgeHeight = h) {
|
|
15766
15766
|
const k = blurKernel(radius);
|
|
15767
15767
|
const taps = (k.length - 1) / 2;
|
|
15768
|
-
const horizontalIndex =
|
|
15769
|
-
const verticalIndex =
|
|
15768
|
+
const horizontalIndex = taps >= edgeWidth ? (x) => Math.max(0, Math.min(w - 1, x)) : (x) => mirror(x, w);
|
|
15769
|
+
const verticalIndex = taps >= edgeHeight ? (y) => Math.max(0, Math.min(h - 1, y)) : (y) => mirror(y, h);
|
|
15770
15770
|
const out = new Float64Array(w * h * 4);
|
|
15771
15771
|
for (let y = 0; y < h; y++) {
|
|
15772
15772
|
const row = y * w * 4;
|
|
@@ -15792,7 +15792,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
|
15792
15792
|
}
|
|
15793
15793
|
if (taps > 0 && vRow >= 0 && vRow < h) {
|
|
15794
15794
|
const horizontal = out.slice();
|
|
15795
|
-
const endRow = Math.min(h, vRow +
|
|
15795
|
+
const endRow = fullVertical ? h : Math.min(h, vRow + Math.ceil(h / w));
|
|
15796
15796
|
for (let row = vRow; row < endRow; row++) {
|
|
15797
15797
|
const col = new Float64Array(w * 4);
|
|
15798
15798
|
for (let j = -taps; j <= taps; j++) {
|
|
@@ -15810,14 +15810,46 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false) {
|
|
|
15810
15810
|
}
|
|
15811
15811
|
return out;
|
|
15812
15812
|
}
|
|
15813
|
+
function blurReduction(radius) {
|
|
15814
|
+
return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
|
|
15815
|
+
}
|
|
15816
|
+
function effectBlur(src, width, height, radius) {
|
|
15817
|
+
const factor = blurReduction(radius);
|
|
15818
|
+
if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
|
|
15819
|
+
return gdipBlur(src, width, height, radius);
|
|
15820
|
+
}
|
|
15821
|
+
const w = Math.ceil(width / factor);
|
|
15822
|
+
const h = Math.ceil(height / factor);
|
|
15823
|
+
const reduced = new Uint8ClampedArray(w * h * 4);
|
|
15824
|
+
for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) {
|
|
15825
|
+
const x1 = Math.min(width, (x + 1) * factor), y1 = Math.min(height, (y + 1) * factor);
|
|
15826
|
+
const count = (x1 - x * factor) * (y1 - y * factor);
|
|
15827
|
+
for (let c = 0; c < 4; c++) {
|
|
15828
|
+
let sum = 0;
|
|
15829
|
+
for (let yy = y * factor; yy < y1; yy++) for (let xx = x * factor; xx < x1; xx++) sum += src[(yy * width + xx) * 4 + c];
|
|
15830
|
+
reduced[(y * w + x) * 4 + c] = Math.floor(sum / count);
|
|
15831
|
+
}
|
|
15832
|
+
}
|
|
15833
|
+
const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
|
|
15834
|
+
for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
|
|
15835
|
+
const out = new Float64Array(src.length);
|
|
15836
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
15837
|
+
const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
|
|
15838
|
+
const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
|
|
15839
|
+
const a = (iy * w + ix) * 4, b = (iy * w + Math.min(w - 1, ix + 1)) * 4;
|
|
15840
|
+
const d = (Math.min(h - 1, iy + 1) * w + ix) * 4, e = (Math.min(h - 1, iy + 1) * w + Math.min(w - 1, ix + 1)) * 4;
|
|
15841
|
+
for (let c = 0; c < 4; c++) out[(y * width + x) * 4 + c] = Math.round((1 - fy) * ((1 - fx) * filtered[a + c] + fx * filtered[b + c]) + fy * ((1 - fx) * filtered[d + c] + fx * filtered[e + c]));
|
|
15842
|
+
}
|
|
15843
|
+
return out;
|
|
15844
|
+
}
|
|
15813
15845
|
function applyBlur(src, w, h, radius) {
|
|
15814
|
-
return Uint8ClampedArray.from(
|
|
15846
|
+
return Uint8ClampedArray.from(effectBlur(src, w, h, radius), Math.round);
|
|
15815
15847
|
}
|
|
15816
15848
|
function sharpenGain(_radius, amount) {
|
|
15817
15849
|
return roundHalfDown(64 * amount / (250 - 2 * amount)) / 64;
|
|
15818
15850
|
}
|
|
15819
15851
|
function applySharpen(src, w, h, radius, amount) {
|
|
15820
|
-
const blurred =
|
|
15852
|
+
const blurred = effectBlur(src, w, h, radius);
|
|
15821
15853
|
const gain = sharpenGain(radius, amount);
|
|
15822
15854
|
const out = new Uint8ClampedArray(src);
|
|
15823
15855
|
for (let i = 0; i < src.length; i += 4) {
|