import { Rng } from "./rng.js"; import { BlobOptions, DotOptions, EllipseOptions, HatchOptions, PathCmd, Pt, ScribbleOptions, SpeckleOptions, StrokeOptions, Surface } from "./types.js"; //#region src/pen.d.ts interface PenOptions { /** Pixels per head radius. */ px?: number; ink?: string; rough?: number; width?: number; } declare function resample(pts: Pt[], step: number): Pt[]; /** Quadratic through midpoints: smooth, no visible corners. */ declare function smooth(pts: Pt[], closed?: boolean): PathCmd[]; declare class Pen { s: Surface; rng: Rng; px: number; ink: string; rough: number; width: number; step: number; constructor(surface: Surface, rng: Rng, opts?: PenOptions); /** Ink width for a relative weight, never thinner than a real nib. */ w(mult?: number): number; /** * Push a polyline around: a smooth AR(1) walk perpendicular to the line, * plus a single slow bow across the whole stroke. */ private _waver; /** Let an open stroke run past its endpoints, like a real pen does. */ private _overshoot; /** * The workhorse. Draws a sketchy line through `pts`. * passes: 2 gives the doubled-over ink look; 1 is a light single trace. */ stroke(pts: Pt[] | null | undefined, o?: StrokeOptions): void; line(a: Pt, b: Pt, o?: StrokeOptions): void; /** * Many small strokes as ONE path. Hatching a beard is fifty lines; fifty * elements is fifty times the file for no visual gain. */ strokeMany(paths: Pt[][], o?: StrokeOptions): void; /** Cheap roughening for two-point strokes: just shove the ends about. */ private _twitch; /** Filled shape with a wobbly edge, optionally outlined. */ blob(pts: Pt[] | null | undefined, o?: BlobOptions): void; ellipse(cx: number, cy: number, rx: number, ry: number, rot?: number, o?: EllipseOptions): Pt[]; arc(cx: number, cy: number, rx: number, ry: number, a0: number, a1: number, rot?: number, o?: EllipseOptions): Pt[]; dot(x: number, y: number, r: number, o?: DotOptions): void; clip(poly: Pt[] | null | undefined, fn: () => void): void; /** Parallel pencil shading, clipped to a region. */ hatch(poly: Pt[] | null | undefined, o?: HatchOptions): void; /** Loose circular scribble fill -- crayon, not pencil. */ scribble(poly: Pt[], o?: ScribbleOptions): void; /** Short marks scattered in a region -- stubble, freckles, texture. */ speckle(poly: Pt[], o?: SpeckleOptions): void; } //#endregion export { Pen, Pen as default, PenOptions, resample, smooth };