import { d } from './index'; import { BoundingBoxConfig } from '../../types'; /** Configuration for UV transformations. */ export interface TransformConfig { offsetX: number; offsetY: number; rotation: number; scale: number; anchorX: number; anchorY: number; edges: 'stretch' | 'transparent' | 'mirror' | 'wrap'; } /** * Checks if transformation config requires actual transformation. Returns true only if * values differ from defaults. Critical for performance — default transforms have ZERO * overhead. (CPU.) */ export declare const needsTransformation: (transform: TransformConfig | undefined) => boolean; /** * Applies 2D transformations to UV coordinates (translation, rotation, scale, custom anchor, * aspect-ratio aware). Transform order: center at anchor → scale → aspect-normalize → rotate * in square space → un-normalize → offset → un-center. */ export declare const applyUVTransform: import('typegpu').TgpuFn<(uv: d.Vec2f, offsetX: d.F32, offsetY: d.F32, rotation: d.F32, scale: d.F32, anchorX: d.F32, anchorY: d.F32, aspectRatio: d.F32) => d.Vec2f>; /** * Applies the INVERSE of `applyUVTransform` (reverse order, inverted operations). Used in UV * context propagation to apply view transformations without RTT. Uniform values are explicit args. */ export declare const applyInverseUVTransform: import('typegpu').TgpuFn<(uv: d.Vec2f, offsetX: d.F32, offsetY: d.F32, rotation: d.F32, scale: d.F32, anchorX: d.F32, anchorY: d.F32, aspectRatio: d.F32) => d.Vec2f>; /** * Pre-computed UV-space geometry derived from a BoundingBoxConfig. All values in UV space * (0-1 fractions), Y-down convention. */ export interface BoundingBoxUVParams { centerX: number; centerY: number; halfWidthUV: number; halfHeightUV: number; cornerRadiusUV: number; rotation: number; } /** * Converts a BoundingBoxConfig to UV-space geometry params for the renderer. Flips Y so the * output is ready for GPU use. (CPU.) */ export declare const boundingBoxToUVParams: (bbox: BoundingBoxConfig, canvasWidth: number, canvasHeight: number) => BoundingBoxUVParams; /** * Returns 1 inside the rotated bounding-box rectangle, 0 outside (rounded-rect SDF). * Rotation is aspect-corrected. The screen UV is the explicit `uv` arg. * * `aaFeather` is the HALF-WIDTH of the coverage ramp, in the same square space the SDF is * measured in (x aspect-corrected, y = canvas-height UV) — so half a device pixel is * `0.5 / viewportHeightPx`. The ramp is centred on the true edge, which means a pixel whose * centre sits half a pixel inside reads a full 1.0 (no darkened border row on a box whose edge * lands on the canvas edge) while a partially covered edge pixel gets fractional alpha instead * of a binary one. `aaFeather <= 0` selects the legacy binary step exactly — including 1.0 ON the * edge (`sdf == 0`), which the ramp reports as half coverage. Only worth asking for when the caller * genuinely wants a binary mask, since a hard edge visibly stair-steps as soon as anything * downstream (a distortion, a layer transform) magnifies it. */ export declare const applyRectangularClipMask: import('typegpu').TgpuFn<(uv: d.Vec2f, centerX: d.F32, centerY: d.F32, halfWidth: d.F32, halfHeight: d.F32, cornerRadius: d.F32, rotation: d.F32, aspectRatio: d.F32, aaFeather: d.F32) => d.F32>; /** * Maps screen UV into the bounding box's local [0,1] space for the generator "resize" fit * mode (non-uniform fill of both axes, box centre → local 0.5,0.5, rotation applied). * Reduces to identity at a full-canvas box. The screen UV is the explicit `uv` arg. */ export declare const boundingBoxToGeneratorUVContext: import('typegpu').TgpuFn<(uv: d.Vec2f, centerX: d.F32, centerY: d.F32, halfWidth: d.F32, halfHeight: d.F32, rotation: d.F32, aspectRatio: d.F32) => d.Vec2f>; /** * Box geometry for the CPU screen↔box-local mapping. UV fractions, renderer Y-down; * rotation in degrees; aspectRatio = canvas width / height. */ export interface BoxLocalGeometry { centerX: number; centerY: number; halfWidthUV: number; halfHeightUV: number; rotationDeg: number; aspectRatio: number; } /** * CPU/JS equivalent of `boundingBoxToGeneratorUVContext`, in plain numbers. Used by the mouse * driver and Design Editor handles so GPU content, mouse tracking, and drag handles agree. * Exact inverse of `boxLocalToScreenUV`. (CPU.) */ export declare const screenUVToBoxLocal: (sx: number, sy: number, g: BoxLocalGeometry) => { x: number; y: number; }; /** Box-local fraction [0,1] (Y-down) → screen-UV point (Y-down). Inverse of screenUVToBoxLocal. */ export declare const boxLocalToScreenUV: (bx: number, by: number, g: BoxLocalGeometry) => { x: number; y: number; }; //# sourceMappingURL=uvTransform.d.ts.map