/// /** * Helpers to manage the resolution of canvas elements. * * @module */ /** * subscribe to changes in `window.devicePixelRatio`. * * @returns stop / deregister callback */ export declare function monitorDevicePixelRatio(cb: () => void): () => void; /** * subscribe to changes in the natural resolution of an on-screen element (usually a ``). * * put another way, `cb` is called whenever {@link getNaturalResolution} would return a different value. * under the hood, this combines {@link monitorDevicePixelRatio} with a `ResizeObserver`. * * @returns stop / deregister callback */ export declare function monitorNaturalResolution(target: Element, cb: () => void): () => void; /** * get the natural resolution of an element (usually a ``), i.e. its size in native screen pixels. * * under the hood, this combines `clientWidth` / `clientHeight` with `devicePixelRatio`. */ export declare const getNaturalResolution: (target: Element) => [number, number]; /** applies the passed resolution to the canvas, by setting `width` / `height` if different */ export declare function applyCanvasResolution(canvas: HTMLCanvasElement, resolution: [number, number]): void; /** equivalent to `applyCanvasResolution(canvas, getNaturalResolution(canvas))` */ export declare const matchCanvasResolution: (canvas: HTMLCanvasElement) => void;