import type { Scene, SceneItem, SceneOptions, SceneSource } from "./scene.types.ts"; /** What `toPNG` takes besides the drawing. */ export interface PngOptions extends SceneOptions { /** The width of the picture in pixels. 1200 when neither a width nor a height is given. */ width?: number; height?: number; /** A colour behind the drawing; the picture is transparent where there is none. */ background?: string; /** Options for resvg's font handling, passed as its `font` option (`{ fontFiles: [...], loadSystemFonts: false }`). */ font?: Record; } /** * A shape wholly outside the drawing's frame, stroke included. resvg (the PNG renderer) stops the whole process, with a panic in its geometry code, on a shape with an opacity below 1 that lies wholly outside the * viewBox (a goal's net beyond a soccer pitch's penalty area, seen through a range), and such a shape paints nothing, so it is left out of the picture. Text and images are kept. */ export declare function isOutside(item: SceneItem, view: Scene["viewBox"]): boolean; /** The scene without the shapes that lie wholly outside its frame. */ export declare function cullOutside(scene: Scene): Scene; /** The message of the error thrown when the peer is not there. */ export declare const PNG_PEER_MISSING = "toPNG needs the optional package @resvg/resvg-js: install it with `npm install @resvg/resvg-js`. It runs in Node only; in a browser draw to a canvas with drawToCanvas and call canvas.toBlob."; /** * A drawing as PNG bytes, by resvg-js (an optional peer dependency, loaded when this is called, in Node only). The drawing may be the options of `drawKyogijo`, an * SVG the package wrote or a scene; light or dark by `theme`. Without the peer installed this throws an error that says what to install. * @example * ```ts * import { toPNG } from "@johnmorrisdotca/kyogijo-stadiums/png"; * // Without the peer installed this stays undefined; with it, the bytes start with the PNG signature. * const png = await toPNG({ sport: "nhl", id: "rink" }, { width: 800, theme: "dark" }).catch(() => undefined); * console.log(png === undefined || (png[1] === 80 && png[2] === 78 && png[3] === 71)); * // true * ``` */ export declare function toPNG(source: SceneSource, options?: PngOptions): Promise;