/** * First (simple) renderer: Canvas 2D. * Composes draw layers over a dark background; the base layer draws * field arrows (⊙ purple toward the viewer / ⊗ gold cross away) at every * readable-grid intersection at viewer scale. * A WebGPU renderer will replace this behind the same interface. */ import { type ViewTransform } from "../core/grid.js"; import { type RgRule } from "../core/rule.js"; import { type RgTheme } from "../core/theme.js"; export type DrawLayer = (ctx: CanvasRenderingContext2D, t: ViewTransform, size: { width: number; height: number; }) => void; export interface GridRenderer { render(t: ViewTransform): void; resize(): void; } export declare function createCanvas2DRenderer(canvas: HTMLCanvasElement, layers: DrawLayer[], opts?: { /** * background fill; false = transparent (compositing over an underlay); * a getter re-reads per frame — live theme swaps need no renderer rebuild */ background?: string | false | (() => string | false); /** cap the backing-store scale (raster cost grows with dpr²) */ maxDpr?: number; }): GridRenderer; /** world-space attractors that bend the grid field (e.g. off-screen nodes) */ export type FieldSource = { x: number; y: number; }; /** * Base layer: every readable-grid point is a unit 3-D FIELD ARROW. * By default the arrows point at the viewer and render as purple dots (⊙, * the arrowhead seen head-on). When `zDir` reports the field pointing into * the screen (e.g. while zooming out), they flip to gold crosses (⊗, the * fletching seen from behind) — the physics notation for out-of/into the * page. With a `field` provider, major arrows tilt sideways under the * inverse-square pull of the sources (off-screen nodes feel like gravity — * the RG flow made visible) and grow a tail. One path per level: perf flat. */ export declare function createGridDotsLayer(rule?: RgRule, field?: () => FieldSource[], /** z of the field arrows: +1 = at the viewer (⊙), -1 = into the screen (⊗) */ zDir?: () => number, /** * global lateral field direction (viewport 3-D rotation): the grid DOTS * keep their screen positions, but every arrow leans this way — rotate * the box 180° and the whole field flips to ⊗ (pointing into the screen) */ fieldTilt?: () => readonly [number, number], /** live theme object (mutated by viewer.setTheme); arrow colors read per frame */ theme?: RgTheme): DrawLayer; /** Default grid-dots layer using DEFAULT_RULE. */ export declare const gridDotsLayer: DrawLayer; //# sourceMappingURL=canvas2d.d.ts.map