import { Expr, GpuFragmentParams, GpuMapSampleUVs } from '../../gpu/contract'; import { RttFilterParams } from '../../gpu/scaffolds/rttFilter'; import { GatherEffect } from '../types'; import { PropRef } from '../values'; /** A generator paint part — what `StdGeneratorDefinition.paint` accepts. */ export type PatternPaint = (params: GpuFragmentParams) => Expr; /** What a paint slot accepts: a prop binding or another paint part. */ export type PaintSlot = PropRef | PatternPaint; /** * A lattice frame's coordinate convention. `'flippedY'` = image-style Y-down, positive rotation * counter-clockwise; `'clockwise'` = Y as-is, positive rotation clockwise; `'plain'` = Y as-is, * positive rotation counter-clockwise. The convention is part of each pattern's look — the * shader file states it alongside the cell count. */ export type CellFrameConvention = 'flippedY' | 'clockwise' | 'plain'; /** * The lattice frame part: maps the paint UV (uvContext-aware) into rotated, aspect-corrected * lattice space, scaled to `cells` lattice units. Everything drawn IN the cells composes on top. */ export declare function cellFrame(slots: { cells: PropRef; rotation: PropRef; convention: CellFrameConvention; }): PatternPaint; /** The per-cell brightness-jitter part: scale a fill's RGB by a variation factor (alpha untouched). */ export declare function vary(color: PaintSlot, factor: PaintSlot): PatternPaint; /** The stroke-over-fill part: mix `fill` → `stroke` by the stroke mask in the `space` colour space. */ export declare function strokeOver(layers: { fill: PaintSlot; stroke: PaintSlot; mask: PaintSlot; space?: PropRef; }): PatternPaint; /** * Sample the given mapped props at the CELL CENTRE rather than the fragment position, so a * mapped size/thickness transitions as whole cells instead of being clipped at map-source * boundaries. `rotation` (degrees) rotates the lattice about the canvas centre before snapping. * Uses the raw canvas UV/viewport (the global, not effectiveViewportSize) — declare it on the * definition's `mapSampleUVs` field. */ export declare function sampleMapsAtCellCentres(slots: { cells: PropRef; rotation?: PropRef; props: string[]; }): GpuMapSampleUVs; /** Pair a colour's RGB with a separately built alpha. */ export declare function withAlpha(color: PaintSlot, alpha: PaintSlot): PatternPaint; /** Read a colour's alpha channel. */ export declare function alphaOf(color: PaintSlot): PatternPaint; /** Read a colour's RGB channels. */ export declare function rgbOf(color: PaintSlot): PatternPaint; /** Multiply two slot values. */ export declare function times(a: PaintSlot, b: PaintSlot): PatternPaint; /** Linear mix `from` → `to` by `amount` (component-wise, no colour-space handling). */ export declare function mixOf(from: PaintSlot, to: PaintSlot, amount: PaintSlot): PatternPaint; /** Finish an RGB value as a fully opaque colour. */ export declare function opaque(rgb: PaintSlot): PatternPaint; /** * Checker cells: the analytically anti-aliased checker blend factor (Quilez 2D filter over the * screen-space footprint). `cells` counts cells along the canvas height (square cells). */ export declare function checkerCells(slots: { cells: PropRef; softness: PropRef; }): PatternPaint; /** * Stripe bands: the analytically anti-aliased directional stripe mask (Quilez 1D filter, * `balance` as the duty threshold), scrolled by the node's accumulated animation time plus * `offset`. Requires `animatedTime: {speed}` on the definition. */ export declare function stripeBands(slots: { angle: PropRef; density: PropRef; balance: PropRef; softness: PropRef; offset: PropRef; }): PatternPaint; /** * Zigzag bands: the fwidth-anti-aliased chevron stripe mask, scrolled by the node's accumulated * animation time plus `offset`. Requires `animatedTime: {speed}` on the definition. */ export declare function zigzagBands(slots: { count: PropRef; angle: PropRef; balance: PropRef; softness: PropRef; offset: PropRef; }): PatternPaint; /** * Ring waves: the mask of concentric rings emanating from `center`, animated by the node's * accumulated time plus `phase`. Requires `animatedTime: {speed}` on the definition. */ export declare function ringWaves(slots: { center: PropRef; frequency: PropRef; thickness: PropRef; softness: PropRef; phase: PropRef; }): PatternPaint; /** * Falling streaks: directional streaks with per-column random speed/phase and a rounded leading * cap, driven by the node's accumulated animation time. `mask` is the streak coverage, `fade` * the lead→trail position within a streak. Requires `animatedTime: {speed}` on the definition. */ export declare function fallingStreaks(slots: { angle: PropRef; density: PropRef; speedVariance: PropRef; trailLength: PropRef; strokeWidth: PropRef; rounding: PropRef; balance: PropRef; }): { mask: PatternPaint; fade: PatternPaint; }; /** * Dot lattice: the coverage of a square lattice of anti-aliased discs with optional brick-style * row stagger, per-row animated drift (the node's accumulated time × per-row random speed), and * a per-dot twinkle on the global clock. Requires `animatedTime: {speed}` on the definition. */ export declare function dotLattice(slots: { density: PropRef; dotSize: PropRef; offset: PropRef; speedVariance: PropRef; twinkle: PropRef; }): PatternPaint; /** * Grid lines drawn in a lattice frame: Quilez axis integrals over the dpdx/dpdy footprint. * `lines` is the line mask, `shade` the per-cell variation factor for the cell fill. */ export declare function gridLines(slots: { frame: PatternPaint; thickness: PropRef; softness: PropRef; variation: PropRef; }): { lines: PatternPaint; shade: PatternPaint; }; /** * Honeycomb lines drawn in a lattice frame (pointy-top hexagons). `lines` is the line mask, * `shade` the per-cell variation factor for the cell fill. */ export declare function hexLines(slots: { frame: PatternPaint; thickness: PropRef; softness: PropRef; variation: PropRef; }): { lines: PatternPaint; shade: PatternPaint; }; /** * Skewed equilateral-triangle lines drawn in a lattice frame, with per-row animated drift. * `lines` is the line mask, `shade` the per-cell variation factor. Requires * `animatedTime: {speed}` on the definition. */ export declare function triangleLines(slots: { frame: PatternPaint; thickness: PropRef; softness: PropRef; variation: PropRef; speedVariance: PropRef; }): { lines: PatternPaint; shade: PatternPaint; }; /** * Brick courses: staggered rows with mortar gaps, optional rotation, static offset, and per-row * animated drift (the node's accumulated time). `bricks` is the brick coverage mask, `shade` * the per-brick variation factor. Brick keeps its OWN frame part (`patternPaints.brickFrame`) * rather than the shared {@link cellFrame} slot — its raw-UV, non-uniform-cell framing is not * byte-equivalent to any lattice frame convention (Gate-C candidate; see the note on * `brickFrame`). Requires `animatedTime: {speed}` on the definition. */ export declare function brickCourses(slots: { cellsX: PropRef; cellsY: PropRef; mortar: PropRef; softness: PropRef; variation: PropRef; rotation: PropRef; offset: PropRef; speedVariance: PropRef; seed: PropRef; }): { bricks: PatternPaint; shade: PatternPaint; }; /** * Truchet arcs drawn in a lattice frame: quarter-circle arc tiles, orientation hashed per tile * (`seed` reshuffles the maze). Returns the arc line mask. */ export declare function truchetArcs(slots: { frame: PatternPaint; thickness: PropRef; softness: PropRef; seed: PropRef; }): PatternPaint; /** * Weave threads drawn in a lattice frame: interlaced horizontal/vertical thread bands with a * checkerboard over-under rule, compositing `colors[0]` (horizontal) and `colors[1]` (vertical) * by per-thread alpha weight — not a colour-space mix, so there is no `space` slot. */ export declare function weaveThreads(slots: { frame: PatternPaint; gap: PropRef; /** `[horizontal, vertical]` thread colours. */ colors: [PropRef, PropRef]; }): PatternPaint; /** * Rhombille (tumbling-blocks) faces drawn in a lattice frame — three shaded rhombus faces per * hexagon read as a 3D cube. `random` is the per-cube colour hash, `tone` the face shading * factor, `wire` the edge-line mask. */ export declare function isoCubeFaces(slots: { frame: PatternPaint; thickness: PropRef; softness: PropRef; }): { random: PatternPaint; tone: PatternPaint; wire: PatternPaint; }; /** * Halftone plate part: the rotated dot-screen coverage for one ink plate — dot size follows * `intensity` (the plate's ink value at this pixel), spaced by `frequency` at the plate's screen * `angle`. */ export declare function dotScreenMask(uv: Expr, aspect: Expr, angle: Expr, intensity: Expr, frequency: Expr): Expr; /** * Halftone plate part: subtractive ink lay-down — white where the plate leaves paper bare, * fading toward the ink colour (× ink alpha) where the dot covers. Plates multiply together. */ export declare function inkTransmission(inkColor: Expr, inkMask: Expr): Expr; /** * Classic halftone gather recipe: the child sampled once (straight alpha), its brightness * modulating a single rotated dot plate. */ export declare function dotScreen(slots: { angle: PropRef; frequency: PropRef; }): GatherEffect; /** One ink plate of a {@link cmykPress}: which CMYK channel it prints, at which screen angle, in which ink. */ export interface InkPlateSpec { readonly channel: 'cyan' | 'magenta' | 'yellow' | 'black'; readonly screenAngle: PropRef; readonly ink: PropRef; } export declare function inkPlate(spec: InkPlateSpec): InkPlateSpec; /** * CMYK press gather recipe: one subtractive plate per ink, laid down in order. Each plate samples * the child at its own registration offset around `misprintAngle` (quarter turns per plate index; * mis-registration shows as colour fringing), reads its CMYK channel, screens it through * `dotScreenMask`, and multiplies its `inkTransmission` into the paper. Alpha follows the * un-offset centre sample; every tap is straight-alpha. */ export declare function cmykPress(slots: { paper: PropRef; frequency: PropRef; misprint: PropRef; misprintAngle: PropRef; plates: InkPlateSpec[]; }): GatherEffect; /** * Compile-time recipe switch: pick a whole gather recipe from a structural enum prop. `read` * maps the raw compile-time value (robust to a pre-transform string) to a case key. All cases * must share their alpha discipline and carry no setup hooks. */ export declare function chosenBy(prop: PropRef, read: (raw: unknown) => K, recipes: Record): GatherEffect; /** One post-sample gather stage: a value derived from the child RTT. */ export type GatherStage = (params: RttFilterParams) => Expr; /** * The dither grid frame: the shared cell geometry of a pixel-grid screen. `coord` is the dither * cell coordinate, `source` the child sampled once per cell (the pixellated source colour). The * grid is sized against the LOGICAL (authored-frame) resolution so the dot count stays constant * under infinite-canvas resolution scaling. */ export interface PixelGrid { readonly size: PropRef; readonly coord: GatherStage; readonly source: GatherStage; } export declare function pixelGrid(slots: { size: PropRef; }): PixelGrid; /** * Ordered-dither part: the threshold FIELD for a compile-time pattern mode — the closed-form * Bayer 2/4/8 or clustered-dot lattice values, or the blue/white-noise hashes, at the dither * cell coordinate. Feed it to `ditherOrderedResult` to quantise a luminance against it. * (Floyd–Steinberg is not a threshold field — its quantisation diffuses error serially.) */ export declare function orderedThreshold(pattern: number, coord: Expr): Expr; /** * The quantise stage: the 0..1 dither result for the grid cell. The ordered modes compose an * `orderedThreshold` field with the cell luminance; the compile-time Floyd–Steinberg mode has no * threshold field — it samples the 64 block-cell luminances and runs its tile-confined serpentine * error diffusion, reading off this fragment's cell. */ export declare function quantise(slots: { grid: PixelGrid; pattern: PropRef; threshold: PropRef; spread: PropRef; }): GatherStage; /** * The dither compose gather recipe: colour the quantised `levels`. The compile-time `mode` * branches — custom mixes `colors[0]`→`colors[1]`, source darkens/brightens the grid's own * pixellated child colour. Every tap is straight-alpha. */ export declare function ditherInks(slots: { grid: PixelGrid; levels: GatherStage; mode: PropRef; colors: [PropRef, PropRef]; }): GatherEffect; //# sourceMappingURL=patterns.d.ts.map