asciify-engine 1.0.6 → 1.0.7
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/embed.js +1 -1
- package/dist/index.cjs +12 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -717,22 +717,24 @@ function renderFrameToCanvas(ctx, frame, options, canvasWidth, canvasHeight, tim
|
|
|
717
717
|
}
|
|
718
718
|
ctx.globalAlpha = 1;
|
|
719
719
|
}
|
|
720
|
-
function serializeFrame(frame,
|
|
720
|
+
function serializeFrame(frame, fullColor) {
|
|
721
721
|
const rows = frame.length;
|
|
722
722
|
const cols = rows > 0 ? frame[0].length : 0;
|
|
723
|
-
const
|
|
724
|
-
|
|
723
|
+
const stride = fullColor ? 4 : 2;
|
|
724
|
+
const buf = new Uint8Array(1 + rows * cols * stride);
|
|
725
|
+
buf[0] = stride;
|
|
726
|
+
let i = 1;
|
|
725
727
|
for (let y = 0; y < rows; y++) {
|
|
726
728
|
for (let x = 0; x < cols; x++) {
|
|
727
729
|
const cell = frame[y][x];
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
buf[i++] = cell.char.charCodeAt(0) & 255;
|
|
730
|
+
if (fullColor) {
|
|
731
|
+
buf[i++] = cell.r;
|
|
732
|
+
buf[i++] = cell.g;
|
|
733
|
+
buf[i++] = cell.b;
|
|
734
|
+
buf[i++] = cell.a;
|
|
734
735
|
} else {
|
|
735
736
|
buf[i++] = Math.round(0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b);
|
|
737
|
+
buf[i++] = cell.a;
|
|
736
738
|
}
|
|
737
739
|
}
|
|
738
740
|
}
|
|
@@ -830,7 +832,7 @@ async function asciifyVideo(source, canvas, { fontSize = 10, style = "classic",
|
|
|
830
832
|
cancelAnimationFrame(animId);
|
|
831
833
|
};
|
|
832
834
|
}
|
|
833
|
-
var EMBED_CDN_VERSION = "1.0.
|
|
835
|
+
var EMBED_CDN_VERSION = "1.0.7";
|
|
834
836
|
function buildEmbedOpts(options, rows, cols, width, height, fps, animated) {
|
|
835
837
|
const o = {
|
|
836
838
|
r: rows,
|