scrivito
Version:
Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.
18 lines (16 loc) • 448 B
text/typescript
// @rewire
export function drawImgOnCanvas(img: HTMLImageElement): HTMLCanvasElement {
const canvas = document.createElement('canvas');
canvas.height = img.height;
canvas.width = img.width;
const ctx = canvas.getContext('2d')!;
drawOnCanvasContext(img, ctx);
return canvas;
}
// For test purpose only
export function drawOnCanvasContext(
img: HTMLImageElement,
ctx: CanvasRenderingContext2D
): void {
ctx.drawImage(img, 0, 0);
}