/** * Builds Node `canvas`-backed `ImageBitmap`, `OffscreenCanvas`, and * `createImageBitmap` polyfills. * * The `canvas` package (https://github.com/Automattic/node-canvas) is a * native module, so rather than this file depending on it directly (and * forcing that dependency -- or a specific version of it -- onto every * consumer of these polyfills), the caller supplies its own `canvas` * module instance here. * @param {{ * Image: new () => import('canvas').Image, * Canvas: new ( * width: number, height: number * ) => import('canvas').Canvas * }} canvasModule The `canvas` package (or an equivalent), as imported * by the caller, e.g., `import * as canvas from 'canvas';`. * @returns {{ * ImageBitmap: ReturnType, * OffscreenCanvas: ReturnType, * createImageBitmap: ( * source: ImageBitmapSource * ) => Promise>> * }} */ export function buildCanvasPolyfills(canvasModule: { Image: new () => import("canvas").Image; Canvas: new (width: number, height: number) => import("canvas").Canvas; }): { ImageBitmap: ReturnType; OffscreenCanvas: ReturnType; createImageBitmap: (source: ImageBitmapSource) => Promise>>; }; /** * @param {{Image: new () => import('canvas').Image}} canvasModule * @returns {new () => import('canvas').Image & { * [Symbol.toStringTag]: string, * close: () => void * }} */ declare function buildImageBitmap(canvasModule: { Image: new () => import("canvas").Image; }): new () => import("canvas").Image & { [Symbol.toStringTag]: string; close: () => void; }; /** * @param {{ * Canvas: new ( * width: number, height: number * ) => import('canvas').Canvas * }} canvasModule * @param {ReturnType} ImageBitmap * @returns {new (width: number, height: number) => { * [Symbol.toStringTag]: string, * width: number, * height: number, * getContext: ( * contextType: "2d"|"3d", * contextAttributes?: import('canvas').NodeCanvasRenderingContext2DSettings * ) => import('canvas').CanvasRenderingContext2D, * transferToImageBitmap: () => InstanceType, * convertToBlob: (options?: {type?: string}) => Promise * }} */ declare function buildOffscreenCanvas(canvasModule: { Canvas: new (width: number, height: number) => import("canvas").Canvas; }, ImageBitmap: ReturnType): new (width: number, height: number) => { [Symbol.toStringTag]: string; width: number; height: number; getContext: (contextType: "2d" | "3d", contextAttributes?: import("canvas").NodeCanvasRenderingContext2DSettings) => import("canvas").CanvasRenderingContext2D; transferToImageBitmap: () => InstanceType; convertToBlob: (options?: { type?: string; }) => Promise; }; export {}; //# sourceMappingURL=buildCanvasPolyfills.d.ts.map