import { Expr, GpuFragmentParams, KitTexture } from '../../gpu/contract'; import { d } from '../../gpu/kit/index'; import { RttFilterParams } from '../../gpu/scaffolds/rttFilter'; import { GatherEffect } from '../types'; import { PropRef } from '../values'; /** One gather stage: a value derived from the child RTT. */ export type GatherStage = (params: RttFilterParams) => Expr; /** * The bleed frame: the tap position with a time-wobbled edge break, shared by the original * sample and every brush tap. `amount` at 0 compiles the wobble away (pair with * `recompile: crosses(0)` on the definition); the wobble is authored in LOGICAL pixels. */ export declare function bleedWarp(slots: { amount: PropRef; }): GatherStage; /** The four overlapping Kuwahara quadrants: premultiplied sum + rgb sum² each, plus the tap weight. */ export type KuwaharaBrush = (params: RttFilterParams) => { quadrants: { sum: Expr; sq: Expr; }[]; invN: number; }; /** * The Kuwahara brush: 4 overlapping quadrants of taps around the `at` frame, accumulating * premultiplied sum + rgb sum² per quadrant at the builder level. `radius` is a compile-time * brush size (the tap loop is unrolled in JS, stride-2 taps at texel-pair midpoints so one * bilinear fetch covers a 2×2 block); every tap is hoisted into a local so it samples exactly * once. The footprint is authored in LOGICAL pixels so it stays the same physical size at any * DPR. */ export declare function kuwahara(slots: { at: GatherStage; radius: PropRef; }): KuwaharaBrush; /** * The paper-grain stage: screen-space (device-pixel) value noise. `amount` at 0 compiles the * noise away (pair with `recompile: crosses(0)` on the definition). */ export declare function paperGrain(slots: { amount: PropRef; }): GatherStage; /** * The wash compose gather recipe: the winning-quadrant Kuwahara mean (lowest variance, mixed * back toward the original by `strength`) over the `at` frame, broken by the paper grain toward * `paperColor`. The gather runs in PREMULTIPLIED space and unpremultiplies once in the compose, * so the result is straight alpha. `strength` at 0 compiles the whole gather away (pair with * `recompile: crosses(0)` on the definition). */ export declare function wash(slots: { at: GatherStage; brush: KuwaharaBrush; grain: GatherStage; paper: PropRef; paperColor: PropRef; strength: PropRef; }): GatherEffect; /** The Sobel ring: the two 4-luma bundles around the centre tap, plus the centre sample itself. */ export type SobelRing = (params: RttFilterParams) => { sobelA: Expr; sobelB: Expr; centre: Expr; centreLum: Expr; }; /** * The Sobel tap ring: 8 straight-alpha tap luminances at `spacing` around the fragment (packed * `[tl, t, tr, l]` / `[r, bl, b, br]`), plus the centre sample and its luminance. Multi-tap → a * true gather, not a uvRemap candidate. */ export declare function sobelTaps(slots: { spacing: PropRef; }): SobelRing; /** * The chalk-sketch compose gather recipe: the Sobel edge magnitude from the ring becomes the * stroke outline, cross-hatch line families fill darker regions, and value-noise dust breaks up * the strokes over the board colour. Straight alpha throughout (every tap is unpremultiplied). */ export declare function chalkSketch(slots: { edges: SobelRing; sensitivity: PropRef; hatchScale: PropRef; shading: PropRef; grain: PropRef; board: PropRef; chalk: PropRef; }): GatherEffect; /** One custom-tier fragment stage. */ export type FragmentStage = (params: GpuFragmentParams) => Expr; /** * The character grid frame: the cell struct (`cellCenter`, `cellUV`, `isOutside`) shared by the * cell sample, the glyph lookup, and the tint. */ export declare function charGrid(slots: { cellSize: PropRef; spacing: PropRef; }): FragmentStage; /** The per-cell child colour: the child sampled once at the cell centre, unpremultiplied. */ export declare function cellSample(slots: { grid: FragmentStage; }): FragmentStage; /** * The glyph lookup: the cell brightness (gamma-curved) picks a glyph from the CPU-rasterised * atlas, sampled nearest/clamped at the cell-local UV. Requires the * `_charCount`/`_atlasScale`/`_atlasSize` extraFields on the definition; the `atlas` slot runs * the host raster lifecycle at composition time and returns the glyph texture. */ export declare function glyphFor(slots: { grid: FragmentStage; cell: FragmentStage; gamma: PropRef; atlas: (params: GpuFragmentParams) => KitTexture; }): FragmentStage; /** * The glyph tint compose: the glyph shaped by the cell colour, with background / out-of-bounds / * below-threshold pixels turned transparent. Returns the fragment closure for the custom tier's * `gpu.fragment`. */ export declare function glyphTint(slots: { grid: FragmentStage; cell: FragmentStage; glyph: FragmentStage; alphaThreshold: PropRef; preserveAlpha: PropRef; }): FragmentStage; /** * Oriented-box placement field: aspect-corrected screen UV → rotated box-local UV + inside mask. * `center` is the TRANSFORMED position prop (transformPosition stores (x, 1-y)), so `1 - center.y` * recovers the authored y. Returns vec3(localU, localV, insideMask); the consumer samples its * content texture at `.xy` and gates by `.z`. No V-flip — media textures written via * `copyExternalImageToTexture` are top-left origin, matching the local V directly. */ export declare const orientedBoxField: import('typegpu').TgpuFn<(uv: d.Vec2f, aspect: d.F32, center: d.Vec2f, rotationDeg: d.F32, halfW: d.F32, halfH: d.F32) => d.Vec3f>; /** * One hatched line plate. Lines run along `angleDeg`; the coordinate perpendicular to them * carries a cosine wave whose crests are inked. `level` (0 = black, 1 = white) slides the ink * threshold across the wave, so darker tone → wider ink until the lines merge to solid; * `reliefPhase` shifts the wave with image brightness — the classic engraved "lines climb over * the form" look. `aa` is the analytic per-pixel wave footprint used for the smoothstep edge. */ export declare const hatchPlate: import('typegpu').TgpuFn<(p: d.Vec2f, angleDeg: d.F32, frequency: d.F32, reliefPhase: d.F32, level: d.F32, aa: d.F32) => d.F32>; /** * The spiral plate: an Archimedean spiral around `c` — rings spaced 1/frequency apart, each * advancing one full spacing per turn, so the line spirals continuously outward from the centre * (the classic guilloché portrait cut). Same tonal threshold + relief displacement as the * straight plate; the angular term's footprint grows toward the centre, so the spiral naturally * tightens into a dense knot there. */ export declare const spiralPlate: import('typegpu').TgpuFn<(p: d.Vec2f, c: d.Vec2f, frequency: d.F32, reliefPhase: d.F32, level: d.F32, aa: d.F32) => d.F32>; /** * The linework composite (factory — `style` is a compile-time JS branch: 0 = single line plate, * 1 = cross-hatch (base + a +72° plate engaging in the shadows + a −38° plate in the deepest * blacks — the classic copper-plate build-up), 2 = one continuous spiral cut around `center`). * * Shared tonal front-end: pivot-0.5 contrast curve on luminance, wavy burin-stroke domain warp, * analytic AA, brightness→phase relief — then the style's plate stack inked between `paper` * and `ink`. p0 = (angleDeg, frequency, relief, waviness); p1 = (contrast, viewportY, 0, 0). */ export declare function makeLineworkComposite(style: number): import('typegpu').TgpuFn<(childColor: d.Vec4f, uv: d.Vec2f, aspect: d.F32, paper: d.Vec4f, ink: d.Vec4f, center: d.Vec2f, p0: d.Vec4f, p1: d.Vec4f) => d.Vec4f>; /** * Line-engraving gather noun: sample the composed child once (unpremultiplied) and redraw it as * luminance-displaced line work between `paper` and `ink`. `style` binds a compile-time prop — * exactly one plate stack is emitted per composition. The composite works on and returns * STRAIGHT alpha, so no unpremultiply tail is appended. */ export declare function linework(slots: { style: PropRef; frequency: PropRef; angle: PropRef; center: PropRef; relief: PropRef; waviness: PropRef; contrast: PropRef; ink: PropRef; paper: PropRef; }): GatherEffect; //# sourceMappingURL=stylize.d.ts.map