emf-converter 4.6.2 → 4.6.4
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 +48 -5
- package/dist/browser.mjs +48 -5
- package/dist/index.js +48 -5
- package/dist/index.mjs +48 -5
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -15598,9 +15598,37 @@ function mix(c0, c1, f) {
|
|
|
15598
15598
|
c0[3] + (c1[3] - c0[3]) * f
|
|
15599
15599
|
];
|
|
15600
15600
|
}
|
|
15601
|
+
var f32Buffer = new Float32Array(1);
|
|
15602
|
+
var f32Bits = new Int32Array(f32Buffer.buffer);
|
|
15603
|
+
function truncF32(x) {
|
|
15604
|
+
const r = Math.fround(x);
|
|
15605
|
+
if (Math.abs(r) > Math.abs(x)) {
|
|
15606
|
+
f32Buffer[0] = r;
|
|
15607
|
+
f32Bits[0] -= 1;
|
|
15608
|
+
return f32Buffer[0];
|
|
15609
|
+
}
|
|
15610
|
+
return r;
|
|
15611
|
+
}
|
|
15612
|
+
function blendFactor(positions, factors, t) {
|
|
15613
|
+
const n = Math.min(positions.length, factors.length);
|
|
15614
|
+
if (n === 0) {
|
|
15615
|
+
return t;
|
|
15616
|
+
}
|
|
15617
|
+
if (t <= positions[0]) {
|
|
15618
|
+
return factors[0];
|
|
15619
|
+
}
|
|
15620
|
+
for (let i = 1; i < n; i++) {
|
|
15621
|
+
if (t <= positions[i]) {
|
|
15622
|
+
const span = truncF32(positions[i] - positions[i - 1]);
|
|
15623
|
+
const s = span > 0 ? truncF32(truncF32(t - positions[i - 1]) / span) : 1;
|
|
15624
|
+
return truncF32(factors[i - 1] + truncF32(truncF32(factors[i] - factors[i - 1]) * s));
|
|
15625
|
+
}
|
|
15626
|
+
}
|
|
15627
|
+
return factors[n - 1];
|
|
15628
|
+
}
|
|
15601
15629
|
function mixBlend(c0, c1, f) {
|
|
15602
|
-
const g =
|
|
15603
|
-
const ch = (a, b) => (
|
|
15630
|
+
const g = truncF32(1 - f);
|
|
15631
|
+
const ch = (a, b) => truncF32(truncF32(a * g) + truncF32(b * f));
|
|
15604
15632
|
return [ch(c0[0], c1[0]), ch(c0[1], c1[1]), ch(c0[2], c1[2]), ch(c0[3], c1[3])];
|
|
15605
15633
|
}
|
|
15606
15634
|
function rampColorAt(ramp, t) {
|
|
@@ -15623,7 +15651,7 @@ function rampColorAt(ramp, t) {
|
|
|
15623
15651
|
const start = premultiplied(ramp.startArgb, gamma);
|
|
15624
15652
|
const end = premultiplied(ramp.endArgb, gamma);
|
|
15625
15653
|
if (ramp.blend && !gamma) {
|
|
15626
|
-
return mixBlend(start, end,
|
|
15654
|
+
return mixBlend(start, end, blendFactor(ramp.blend.positions, ramp.blend.factors, t));
|
|
15627
15655
|
}
|
|
15628
15656
|
return mix(start, end, ramp.blend ? piecewise(ramp.blend.positions, ramp.blend.factors, t) : t);
|
|
15629
15657
|
}
|
|
@@ -16508,7 +16536,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical
|
|
|
16508
16536
|
function blurReduction(radius) {
|
|
16509
16537
|
return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
|
|
16510
16538
|
}
|
|
16511
|
-
function effectBlur(src, width, height, radius) {
|
|
16539
|
+
function effectBlur(src, width, height, radius, expanded = false) {
|
|
16512
16540
|
const factor = blurReduction(radius);
|
|
16513
16541
|
if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
|
|
16514
16542
|
return gdipBlur(src, width, height, radius);
|
|
@@ -16526,6 +16554,21 @@ function effectBlur(src, width, height, radius) {
|
|
|
16526
16554
|
}
|
|
16527
16555
|
}
|
|
16528
16556
|
const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
|
|
16557
|
+
if (!expanded) {
|
|
16558
|
+
const out2 = new Float64Array(src.length);
|
|
16559
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
16560
|
+
const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
|
|
16561
|
+
const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
|
|
16562
|
+
const x1 = Math.min(w - 1, ix + 1), y1 = Math.min(h - 1, iy + 1);
|
|
16563
|
+
for (let c = 0; c < 4; c++) {
|
|
16564
|
+
const at = (xx, yy) => filtered[(yy * w + xx) * 4 + c];
|
|
16565
|
+
const top = Math.floor((1 - fx) * at(ix, iy) + fx * at(x1, iy));
|
|
16566
|
+
const bottom = Math.floor((1 - fx) * at(ix, y1) + fx * at(x1, y1));
|
|
16567
|
+
out2[(y * width + x) * 4 + c] = Math.floor((1 - fy) * top + fy * bottom);
|
|
16568
|
+
}
|
|
16569
|
+
}
|
|
16570
|
+
return out2;
|
|
16571
|
+
}
|
|
16529
16572
|
for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
|
|
16530
16573
|
const out = new Float64Array(src.length);
|
|
16531
16574
|
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
@@ -16620,7 +16663,7 @@ function expandedBlur(rgba, width, height, radius, x0, y0, x1, y1, cropped) {
|
|
|
16620
16663
|
const gy1 = Math.min(height, y1 + r);
|
|
16621
16664
|
copyBlock(rgba, width, gx0, gy0, gx1 - gx0, gy1 - gy0, buf, bw, gx0 - (x0 - r), gy0 - (y0 - r));
|
|
16622
16665
|
}
|
|
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)));
|
|
16666
|
+
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
16667
|
const w = x1 - x0;
|
|
16625
16668
|
const out = new Uint8ClampedArray(w * (y1 - y0) * 4);
|
|
16626
16669
|
for (let y = 0; y < y1 - y0; y++) {
|
package/dist/browser.mjs
CHANGED
|
@@ -15596,9 +15596,37 @@ function mix(c0, c1, f) {
|
|
|
15596
15596
|
c0[3] + (c1[3] - c0[3]) * f
|
|
15597
15597
|
];
|
|
15598
15598
|
}
|
|
15599
|
+
var f32Buffer = new Float32Array(1);
|
|
15600
|
+
var f32Bits = new Int32Array(f32Buffer.buffer);
|
|
15601
|
+
function truncF32(x) {
|
|
15602
|
+
const r = Math.fround(x);
|
|
15603
|
+
if (Math.abs(r) > Math.abs(x)) {
|
|
15604
|
+
f32Buffer[0] = r;
|
|
15605
|
+
f32Bits[0] -= 1;
|
|
15606
|
+
return f32Buffer[0];
|
|
15607
|
+
}
|
|
15608
|
+
return r;
|
|
15609
|
+
}
|
|
15610
|
+
function blendFactor(positions, factors, t) {
|
|
15611
|
+
const n = Math.min(positions.length, factors.length);
|
|
15612
|
+
if (n === 0) {
|
|
15613
|
+
return t;
|
|
15614
|
+
}
|
|
15615
|
+
if (t <= positions[0]) {
|
|
15616
|
+
return factors[0];
|
|
15617
|
+
}
|
|
15618
|
+
for (let i = 1; i < n; i++) {
|
|
15619
|
+
if (t <= positions[i]) {
|
|
15620
|
+
const span = truncF32(positions[i] - positions[i - 1]);
|
|
15621
|
+
const s = span > 0 ? truncF32(truncF32(t - positions[i - 1]) / span) : 1;
|
|
15622
|
+
return truncF32(factors[i - 1] + truncF32(truncF32(factors[i] - factors[i - 1]) * s));
|
|
15623
|
+
}
|
|
15624
|
+
}
|
|
15625
|
+
return factors[n - 1];
|
|
15626
|
+
}
|
|
15599
15627
|
function mixBlend(c0, c1, f) {
|
|
15600
|
-
const g =
|
|
15601
|
-
const ch = (a, b) => (
|
|
15628
|
+
const g = truncF32(1 - f);
|
|
15629
|
+
const ch = (a, b) => truncF32(truncF32(a * g) + truncF32(b * f));
|
|
15602
15630
|
return [ch(c0[0], c1[0]), ch(c0[1], c1[1]), ch(c0[2], c1[2]), ch(c0[3], c1[3])];
|
|
15603
15631
|
}
|
|
15604
15632
|
function rampColorAt(ramp, t) {
|
|
@@ -15621,7 +15649,7 @@ function rampColorAt(ramp, t) {
|
|
|
15621
15649
|
const start = premultiplied(ramp.startArgb, gamma);
|
|
15622
15650
|
const end = premultiplied(ramp.endArgb, gamma);
|
|
15623
15651
|
if (ramp.blend && !gamma) {
|
|
15624
|
-
return mixBlend(start, end,
|
|
15652
|
+
return mixBlend(start, end, blendFactor(ramp.blend.positions, ramp.blend.factors, t));
|
|
15625
15653
|
}
|
|
15626
15654
|
return mix(start, end, ramp.blend ? piecewise(ramp.blend.positions, ramp.blend.factors, t) : t);
|
|
15627
15655
|
}
|
|
@@ -16506,7 +16534,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical
|
|
|
16506
16534
|
function blurReduction(radius) {
|
|
16507
16535
|
return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
|
|
16508
16536
|
}
|
|
16509
|
-
function effectBlur(src, width, height, radius) {
|
|
16537
|
+
function effectBlur(src, width, height, radius, expanded = false) {
|
|
16510
16538
|
const factor = blurReduction(radius);
|
|
16511
16539
|
if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
|
|
16512
16540
|
return gdipBlur(src, width, height, radius);
|
|
@@ -16524,6 +16552,21 @@ function effectBlur(src, width, height, radius) {
|
|
|
16524
16552
|
}
|
|
16525
16553
|
}
|
|
16526
16554
|
const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
|
|
16555
|
+
if (!expanded) {
|
|
16556
|
+
const out2 = new Float64Array(src.length);
|
|
16557
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
16558
|
+
const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
|
|
16559
|
+
const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
|
|
16560
|
+
const x1 = Math.min(w - 1, ix + 1), y1 = Math.min(h - 1, iy + 1);
|
|
16561
|
+
for (let c = 0; c < 4; c++) {
|
|
16562
|
+
const at = (xx, yy) => filtered[(yy * w + xx) * 4 + c];
|
|
16563
|
+
const top = Math.floor((1 - fx) * at(ix, iy) + fx * at(x1, iy));
|
|
16564
|
+
const bottom = Math.floor((1 - fx) * at(ix, y1) + fx * at(x1, y1));
|
|
16565
|
+
out2[(y * width + x) * 4 + c] = Math.floor((1 - fy) * top + fy * bottom);
|
|
16566
|
+
}
|
|
16567
|
+
}
|
|
16568
|
+
return out2;
|
|
16569
|
+
}
|
|
16527
16570
|
for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
|
|
16528
16571
|
const out = new Float64Array(src.length);
|
|
16529
16572
|
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
@@ -16618,7 +16661,7 @@ function expandedBlur(rgba, width, height, radius, x0, y0, x1, y1, cropped) {
|
|
|
16618
16661
|
const gy1 = Math.min(height, y1 + r);
|
|
16619
16662
|
copyBlock(rgba, width, gx0, gy0, gx1 - gx0, gy1 - gy0, buf, bw, gx0 - (x0 - r), gy0 - (y0 - r));
|
|
16620
16663
|
}
|
|
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)));
|
|
16664
|
+
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
16665
|
const w = x1 - x0;
|
|
16623
16666
|
const out = new Uint8ClampedArray(w * (y1 - y0) * 4);
|
|
16624
16667
|
for (let y = 0; y < y1 - y0; y++) {
|
package/dist/index.js
CHANGED
|
@@ -15599,9 +15599,37 @@ function mix(c0, c1, f) {
|
|
|
15599
15599
|
c0[3] + (c1[3] - c0[3]) * f
|
|
15600
15600
|
];
|
|
15601
15601
|
}
|
|
15602
|
+
var f32Buffer = new Float32Array(1);
|
|
15603
|
+
var f32Bits = new Int32Array(f32Buffer.buffer);
|
|
15604
|
+
function truncF32(x) {
|
|
15605
|
+
const r = Math.fround(x);
|
|
15606
|
+
if (Math.abs(r) > Math.abs(x)) {
|
|
15607
|
+
f32Buffer[0] = r;
|
|
15608
|
+
f32Bits[0] -= 1;
|
|
15609
|
+
return f32Buffer[0];
|
|
15610
|
+
}
|
|
15611
|
+
return r;
|
|
15612
|
+
}
|
|
15613
|
+
function blendFactor(positions, factors, t) {
|
|
15614
|
+
const n = Math.min(positions.length, factors.length);
|
|
15615
|
+
if (n === 0) {
|
|
15616
|
+
return t;
|
|
15617
|
+
}
|
|
15618
|
+
if (t <= positions[0]) {
|
|
15619
|
+
return factors[0];
|
|
15620
|
+
}
|
|
15621
|
+
for (let i = 1; i < n; i++) {
|
|
15622
|
+
if (t <= positions[i]) {
|
|
15623
|
+
const span = truncF32(positions[i] - positions[i - 1]);
|
|
15624
|
+
const s = span > 0 ? truncF32(truncF32(t - positions[i - 1]) / span) : 1;
|
|
15625
|
+
return truncF32(factors[i - 1] + truncF32(truncF32(factors[i] - factors[i - 1]) * s));
|
|
15626
|
+
}
|
|
15627
|
+
}
|
|
15628
|
+
return factors[n - 1];
|
|
15629
|
+
}
|
|
15602
15630
|
function mixBlend(c0, c1, f) {
|
|
15603
|
-
const g =
|
|
15604
|
-
const ch = (a, b) => (
|
|
15631
|
+
const g = truncF32(1 - f);
|
|
15632
|
+
const ch = (a, b) => truncF32(truncF32(a * g) + truncF32(b * f));
|
|
15605
15633
|
return [ch(c0[0], c1[0]), ch(c0[1], c1[1]), ch(c0[2], c1[2]), ch(c0[3], c1[3])];
|
|
15606
15634
|
}
|
|
15607
15635
|
function rampColorAt(ramp, t) {
|
|
@@ -15624,7 +15652,7 @@ function rampColorAt(ramp, t) {
|
|
|
15624
15652
|
const start = premultiplied(ramp.startArgb, gamma);
|
|
15625
15653
|
const end = premultiplied(ramp.endArgb, gamma);
|
|
15626
15654
|
if (ramp.blend && !gamma) {
|
|
15627
|
-
return mixBlend(start, end,
|
|
15655
|
+
return mixBlend(start, end, blendFactor(ramp.blend.positions, ramp.blend.factors, t));
|
|
15628
15656
|
}
|
|
15629
15657
|
return mix(start, end, ramp.blend ? piecewise(ramp.blend.positions, ramp.blend.factors, t) : t);
|
|
15630
15658
|
}
|
|
@@ -16509,7 +16537,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical
|
|
|
16509
16537
|
function blurReduction(radius) {
|
|
16510
16538
|
return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
|
|
16511
16539
|
}
|
|
16512
|
-
function effectBlur(src, width, height, radius) {
|
|
16540
|
+
function effectBlur(src, width, height, radius, expanded = false) {
|
|
16513
16541
|
const factor = blurReduction(radius);
|
|
16514
16542
|
if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
|
|
16515
16543
|
return gdipBlur(src, width, height, radius);
|
|
@@ -16527,6 +16555,21 @@ function effectBlur(src, width, height, radius) {
|
|
|
16527
16555
|
}
|
|
16528
16556
|
}
|
|
16529
16557
|
const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
|
|
16558
|
+
if (!expanded) {
|
|
16559
|
+
const out2 = new Float64Array(src.length);
|
|
16560
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
16561
|
+
const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
|
|
16562
|
+
const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
|
|
16563
|
+
const x1 = Math.min(w - 1, ix + 1), y1 = Math.min(h - 1, iy + 1);
|
|
16564
|
+
for (let c = 0; c < 4; c++) {
|
|
16565
|
+
const at = (xx, yy) => filtered[(yy * w + xx) * 4 + c];
|
|
16566
|
+
const top = Math.floor((1 - fx) * at(ix, iy) + fx * at(x1, iy));
|
|
16567
|
+
const bottom = Math.floor((1 - fx) * at(ix, y1) + fx * at(x1, y1));
|
|
16568
|
+
out2[(y * width + x) * 4 + c] = Math.floor((1 - fy) * top + fy * bottom);
|
|
16569
|
+
}
|
|
16570
|
+
}
|
|
16571
|
+
return out2;
|
|
16572
|
+
}
|
|
16530
16573
|
for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
|
|
16531
16574
|
const out = new Float64Array(src.length);
|
|
16532
16575
|
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
@@ -16621,7 +16664,7 @@ function expandedBlur(rgba, width, height, radius, x0, y0, x1, y1, cropped) {
|
|
|
16621
16664
|
const gy1 = Math.min(height, y1 + r);
|
|
16622
16665
|
copyBlock(rgba, width, gx0, gy0, gx1 - gx0, gy1 - gy0, buf, bw, gx0 - (x0 - r), gy0 - (y0 - r));
|
|
16623
16666
|
}
|
|
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)));
|
|
16667
|
+
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
16668
|
const w = x1 - x0;
|
|
16626
16669
|
const out = new Uint8ClampedArray(w * (y1 - y0) * 4);
|
|
16627
16670
|
for (let y = 0; y < y1 - y0; y++) {
|
package/dist/index.mjs
CHANGED
|
@@ -15597,9 +15597,37 @@ function mix(c0, c1, f) {
|
|
|
15597
15597
|
c0[3] + (c1[3] - c0[3]) * f
|
|
15598
15598
|
];
|
|
15599
15599
|
}
|
|
15600
|
+
var f32Buffer = new Float32Array(1);
|
|
15601
|
+
var f32Bits = new Int32Array(f32Buffer.buffer);
|
|
15602
|
+
function truncF32(x) {
|
|
15603
|
+
const r = Math.fround(x);
|
|
15604
|
+
if (Math.abs(r) > Math.abs(x)) {
|
|
15605
|
+
f32Buffer[0] = r;
|
|
15606
|
+
f32Bits[0] -= 1;
|
|
15607
|
+
return f32Buffer[0];
|
|
15608
|
+
}
|
|
15609
|
+
return r;
|
|
15610
|
+
}
|
|
15611
|
+
function blendFactor(positions, factors, t) {
|
|
15612
|
+
const n = Math.min(positions.length, factors.length);
|
|
15613
|
+
if (n === 0) {
|
|
15614
|
+
return t;
|
|
15615
|
+
}
|
|
15616
|
+
if (t <= positions[0]) {
|
|
15617
|
+
return factors[0];
|
|
15618
|
+
}
|
|
15619
|
+
for (let i = 1; i < n; i++) {
|
|
15620
|
+
if (t <= positions[i]) {
|
|
15621
|
+
const span = truncF32(positions[i] - positions[i - 1]);
|
|
15622
|
+
const s = span > 0 ? truncF32(truncF32(t - positions[i - 1]) / span) : 1;
|
|
15623
|
+
return truncF32(factors[i - 1] + truncF32(truncF32(factors[i] - factors[i - 1]) * s));
|
|
15624
|
+
}
|
|
15625
|
+
}
|
|
15626
|
+
return factors[n - 1];
|
|
15627
|
+
}
|
|
15600
15628
|
function mixBlend(c0, c1, f) {
|
|
15601
|
-
const g =
|
|
15602
|
-
const ch = (a, b) => (
|
|
15629
|
+
const g = truncF32(1 - f);
|
|
15630
|
+
const ch = (a, b) => truncF32(truncF32(a * g) + truncF32(b * f));
|
|
15603
15631
|
return [ch(c0[0], c1[0]), ch(c0[1], c1[1]), ch(c0[2], c1[2]), ch(c0[3], c1[3])];
|
|
15604
15632
|
}
|
|
15605
15633
|
function rampColorAt(ramp, t) {
|
|
@@ -15622,7 +15650,7 @@ function rampColorAt(ramp, t) {
|
|
|
15622
15650
|
const start = premultiplied(ramp.startArgb, gamma);
|
|
15623
15651
|
const end = premultiplied(ramp.endArgb, gamma);
|
|
15624
15652
|
if (ramp.blend && !gamma) {
|
|
15625
|
-
return mixBlend(start, end,
|
|
15653
|
+
return mixBlend(start, end, blendFactor(ramp.blend.positions, ramp.blend.factors, t));
|
|
15626
15654
|
}
|
|
15627
15655
|
return mix(start, end, ramp.blend ? piecewise(ramp.blend.positions, ramp.blend.factors, t) : t);
|
|
15628
15656
|
}
|
|
@@ -16507,7 +16535,7 @@ function gdipBlur(src, w, h, radius, vRow = 0, vZeroAbove = false, fullVertical
|
|
|
16507
16535
|
function blurReduction(radius) {
|
|
16508
16536
|
return radius < 20 ? 1 : radius < 40 ? 2 : radius <= 80 ? 4 : radius < 160 ? 8 : 16;
|
|
16509
16537
|
}
|
|
16510
|
-
function effectBlur(src, width, height, radius) {
|
|
16538
|
+
function effectBlur(src, width, height, radius, expanded = false) {
|
|
16511
16539
|
const factor = blurReduction(radius);
|
|
16512
16540
|
if (factor === 1 || (width < 4 || height < 4) && (width % factor !== 0 || height % factor !== 0)) {
|
|
16513
16541
|
return gdipBlur(src, width, height, radius);
|
|
@@ -16525,6 +16553,21 @@ function effectBlur(src, width, height, radius) {
|
|
|
16525
16553
|
}
|
|
16526
16554
|
}
|
|
16527
16555
|
const filtered = gdipBlur(reduced, w, h, radius / factor, 0, false, true, Math.floor(width / factor), Math.floor(height / factor));
|
|
16556
|
+
if (!expanded) {
|
|
16557
|
+
const out2 = new Float64Array(src.length);
|
|
16558
|
+
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
16559
|
+
const px = clamp((x + 0.5) / factor - 0.5, 0, w - 1), py = clamp((y + 0.5) / factor - 0.5, 0, h - 1);
|
|
16560
|
+
const ix = Math.floor(px), iy = Math.floor(py), fx = px - ix, fy = py - iy;
|
|
16561
|
+
const x1 = Math.min(w - 1, ix + 1), y1 = Math.min(h - 1, iy + 1);
|
|
16562
|
+
for (let c = 0; c < 4; c++) {
|
|
16563
|
+
const at = (xx, yy) => filtered[(yy * w + xx) * 4 + c];
|
|
16564
|
+
const top = Math.floor((1 - fx) * at(ix, iy) + fx * at(x1, iy));
|
|
16565
|
+
const bottom = Math.floor((1 - fx) * at(ix, y1) + fx * at(x1, y1));
|
|
16566
|
+
out2[(y * width + x) * 4 + c] = Math.floor((1 - fy) * top + fy * bottom);
|
|
16567
|
+
}
|
|
16568
|
+
}
|
|
16569
|
+
return out2;
|
|
16570
|
+
}
|
|
16528
16571
|
for (let i = 0; i < filtered.length; i++) filtered[i] = Math.round(filtered[i]);
|
|
16529
16572
|
const out = new Float64Array(src.length);
|
|
16530
16573
|
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
@@ -16619,7 +16662,7 @@ function expandedBlur(rgba, width, height, radius, x0, y0, x1, y1, cropped) {
|
|
|
16619
16662
|
const gy1 = Math.min(height, y1 + r);
|
|
16620
16663
|
copyBlock(rgba, width, gx0, gy0, gx1 - gx0, gy1 - gy0, buf, bw, gx0 - (x0 - r), gy0 - (y0 - r));
|
|
16621
16664
|
}
|
|
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)));
|
|
16665
|
+
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
16666
|
const w = x1 - x0;
|
|
16624
16667
|
const out = new Uint8ClampedArray(w * (y1 - y0) * 4);
|
|
16625
16668
|
for (let y = 0; y < y1 - y0; y++) {
|