mirror of
https://github.com/whscullin/apple2js.git
synced 2024-01-12 14:14:38 +00:00
af57378852
Remove globals from video implementations to allow further refactoring. Experiment with testing video modes.
10 lines
359 B
TypeScript
10 lines
359 B
TypeScript
export const createImageFromImageData = (data: ImageData) => {
|
|
const canvas = document.createElement('canvas');
|
|
canvas.width = data.width;
|
|
canvas.height = data.height;
|
|
const ctx = canvas.getContext('2d')!;
|
|
ctx.putImageData(data, 0, 0);
|
|
const url = canvas.toDataURL('image/png');
|
|
return Buffer.from(url.split(',')[1], 'base64');
|
|
};
|