import { type QrCode } from './encode.js'; /** The slice of a 2D context the renderer uses, so it needs no DOM types. */ export interface Canvas2dLike { fillStyle: unknown; fillRect(x: number, y: number, width: number, height: number): void; } /** An `HTMLCanvasElement`, an `OffscreenCanvas`, or anything shaped like one. */ export interface CanvasLike { width: number; height: number; getContext(type: '2d'): Canvas2dLike | null; } export interface CanvasOptions { /** Width and height of the canvas in pixels. Default 8 pixels per module. */ width?: number; /** Quiet zone in modules on every side. Default 4, the standard's minimum. */ margin?: number; /** Colour of dark modules. Default `'#000'`. */ dark?: string; /** Background colour, or `null` to leave the canvas transparent. Default `'#fff'`. */ light?: string | null; } /** * Draws a code onto a canvas, resizing it to `width` square and replacing * whatever it held. Module edges fall on whole pixels, so nothing is * anti-aliased; when `width` is not a multiple of the module count, modules * differ in size by at most one pixel. */ export declare function drawCanvas(canvas: CanvasLike, qr: QrCode, options?: CanvasOptions): void;