@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
16 lines (11 loc) • 449 B
JavaScript
import { downloadUrlAsFile } from "../../../../core/binary/downloadUrlAsFile.js";
import { sampler2d_to_data_url } from "./sampler2d_to_data_url.js";
/**
*
* @param {Sampler2D} sampler
* @param {string} [file_name] what should the file be named?
*/
export function downloadSampler2DAsPNG(sampler, file_name = 'image') {
const dataURL = sampler2d_to_data_url(sampler);
downloadUrlAsFile(dataURL, `${file_name}.png`);
}