import { Seed } from "../rng.js"; import { Genome, Overrides } from "../types.js"; import { Head } from "../head.js"; import { PlateCell } from "../plate.js"; //#region src/integrations/core.d.ts interface FaceOptions { seed?: Seed; /** A genome you already have. Overrides `seed` and `traits`. */ genome?: Genome | null; /** Pin features: `{ nose: 'hook', eyes: { left: { type: 'spiral' } } }`. */ traits?: Overrides; /** Degrees, the way the CLI and the sliders take them. */ yaw?: number; pitch?: number; roll?: number; width?: number; /** Defaults to `width * 1.2` -- portrait, like the reference plates. */ height?: number; /** Head radius in pixels. Defaults to 30% of the smaller side. */ scale?: number; background?: string | null; /** `true` for the default grain, a number for its opacity, `false` for none. */ paper?: boolean | number; backdrop?: boolean; rough?: number; /** Perspective strength in head radii; larger is flatter. */ focal?: number; /** Draw the invisible head over the drawing. */ rig?: boolean; /** * Backing-store pixels per CSS pixel. Defaults to the display's, capped at * 2; set it explicitly when you want an exact pixel count, as a file export * does. */ pixelRatio?: number; } interface PlateOptions { cols?: number; rows?: number; seed?: Seed; traits?: Overrides; /** Degrees: the widest each face may turn, tilt and lean. */ turn?: number; tilt?: number; lean?: number; width?: number; height?: number; scaleFactor?: number; background?: string | null; paper?: boolean | number; rough?: number; /** See `FaceOptions.pixelRatio`. */ pixelRatio?: number; } interface FaceResult { genome: Genome; head: Head; } interface SVGResult extends FaceResult { svg: string; } interface PlateSVGResult { svg: string; faces: PlateCell[]; } /** Width and height a face gets when nobody says otherwise. */ declare function faceSize(o: FaceOptions): { width: number; height: number; scale: number; }; declare function plateSize(o: PlateOptions): { width: number; height: number; }; /** One face as an SVG string, ready to inline. */ declare function faceSVG(o?: FaceOptions): SVGResult; /** A grid of faces as an SVG string, plus where each one landed. */ declare function plateSVG(o?: PlateOptions): PlateSVGResult; /** * Paint one face onto a 2D context, sizing the canvas for the display. * Returns the genome, so a caption can describe what was drawn. */ declare function drawFaceOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas, o?: FaceOptions): FaceResult | null; declare function drawPlateOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas, o?: PlateOptions): PlateCell[]; /** * Which plate cell is under a click, in canvas pixels. Returns null when the * pointer is in the gutter rather than on a face. */ declare function pickFace(faces: PlateCell[], x: number, y: number): PlateCell | null; /** Canvas pixels for a pointer event, undoing CSS scaling and the DPR. */ declare function pointerToCanvas(canvas: HTMLCanvasElement, clientX: number, clientY: number, width: number, height: number): { x: number; y: number; }; //#endregion export { FaceOptions, FaceResult, PlateOptions, PlateSVGResult, SVGResult, drawFaceOnCanvas, drawPlateOnCanvas, faceSVG, faceSize, pickFace, plateSVG, plateSize, pointerToCanvas };