INNER CODE UNIT · TypeScript

setUpCanvas

silvia-odwyer/photon · webpack_demo/src/index.ts:437

const setUpCanvas = () => {
	const container = document.getElementById("image_container");
	container?.appendChild(newimg);

	canvas = document.getElementById("canvas") as HTMLCanvasElement;
	canvas.width = newimg.width;
	canvas.height = newimg.height;
	const context = canvas.getContext("2d");
	if (!context) {
		throw new Error("Unable to get canvas context.");
	}
	ctx = context;
	ctx.drawImage(newimg, 0, 0);
	ensureBlendCanvasSize();
};

const setUpCanvas2 = () => {
	const container = document.getElementById("image_container");

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…