INNER CODE UNIT · TypeScript

ensureBlendCanvasSize

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

const ensureBlendCanvasSize = () => {
	if (!canvas2 || !ctx2 || !newimg || !img2) {
		return;
	}
	const targetWidth = newimg.width >= img2.width ? newimg.width + 1 : img2.width;
	const targetHeight =
		newimg.height >= img2.height ? newimg.height + 1 : img2.height;
	if (canvas2.width !== targetWidth || canvas2.height !== targetHeight) {
		canvas2.width = targetWidth;
		canvas2.height = targetHeight;
	}
	ctx2.clearRect(0, 0, canvas2.width, canvas2.height);
	ctx2.drawImage(img2, 0, 0, canvas2.width, canvas2.height);
};

const blendWithMode = (
	photon: ExtendedPhotonModule,
	base: ReturnType<ExtendedPhotonModule["open_image"]>,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…