emf-converter 4.6.3 → 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 +31 -3
- package/dist/browser.mjs +31 -3
- package/dist/index.js +31 -3
- package/dist/index.mjs +31 -3
- 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
|
}
|
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
|
}
|
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
|
}
|
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
|
}
|