import { d } from './index'; import { Expr, KitTexture } from '../contract'; /** cover — scale to cover the viewport (never smaller than the viewport). */ export declare const scaleCover: import('typegpu').TgpuFn<(dims: d.Vec2f, vp: d.Vec2f) => d.Vec2f>; /** contain — scale to fit within the viewport (never larger than the viewport). */ export declare const scaleContain: import('typegpu').TgpuFn<(dims: d.Vec2f, vp: d.Vec2f) => d.Vec2f>; /** fill — stretch to fill the viewport (uvScale = 1,1). */ export declare const scaleFill: import('typegpu').TgpuFn<() => d.Vec2f>; /** scale-down — contain, but never scale up past the media's natural pixel size. */ export declare const scaleScaleDown: import('typegpu').TgpuFn<(dims: d.Vec2f, vp: d.Vec2f) => d.Vec2f>; /** none — display at natural pixel size (1:1). WebcamTexture's 5th mode (Image/Video retire it). */ export declare const scaleNone: import('typegpu').TgpuFn<(dims: d.Vec2f, vp: d.Vec2f) => d.Vec2f>; /** Centre the UV, divide by the fit scale, re-centre. No Y-flip (see the module note). */ export declare const sampleUV: import('typegpu').TgpuFn<(uv: d.Vec2f, uvScale: d.Vec2f) => d.Vec2f>; /** * Selfie-mode horizontal flip: mirror the sampling U when `mirror > 0`. Runtime (not compile-time) — * `mirror` is an ordinary boolean uniform, so toggling it must not recompose. `1 - u` stays within * [0,1] so the letterbox alpha-cut on the mirrored UV is unchanged (WebcamTexture's * `uvPostProcess`, the one consumer of that hook). */ export declare const applyMirror: import('typegpu').TgpuFn<(uv: d.Vec2f, mirror: d.F32) => d.Vec2f>; /** Decode the sampled sRGB colour to linear, and cut alpha to 0 outside [0,1]² (letterbox). */ export declare const alphaCutLinear: import('typegpu').TgpuFn<(color: d.Vec4f, uv: d.Vec2f) => d.Vec4f>; /** * Image / Video. `none` is RETIRED (Figma-style: the bounding box defines the extent) and coalesces * to `fill`, so an old preset keeps filling its box rather than silently re-cropping. */ export declare const OBJECT_FIT_MODES: Record; /** Webcam. `none` is a real mode (mode 4 — natural pixel size), so the feed can display 1:1. */ export declare const OBJECT_FIT_MODES_ALLOW_NONE: Record; export interface MediaSurfaceOptions { /** The media / external texture to sample. */ texture: KitTexture; /** Base UV — `uvContext ?? ctx.uv` (resize-fit aware). */ uv: Expr; /** Effective viewport — `effectiveViewportSize ?? ctx.viewportSize`. */ viewport: Expr; /** * The COMPOSITION-time `objectFit` value: `propValues.objectFit`. A number (post-transform) or a * raw string. Structural — the prop is `compileTime`, so only the selected mode's math is * emitted, and changing it recompiles. */ fit: unknown; /** Use the `none`-preserving table, with `cover` (0) rather than `fill` (2) as the fallback. */ allowNone?: boolean; /** * Transform the fitted UV before it is sampled AND before the letterbox alpha cut — the cut has * to see the same UV that was sampled. WebcamTexture's selfie mirror is the one consumer. */ uvPostProcess?: (uv: Expr) => Expr; /** * How the sample is decoded. `'srgb-linear-alpha-cut'` decodes sRGB → linear and cuts alpha to 0 * outside [0,1]² (the contain / scale-down letterbox). Required rather than defaulted so each * consumer states its choice, the way `flipY` does elsewhere (D-1). */ decode: 'srgb-linear-alpha-cut'; } /** * Assemble a full media surface: object-fit UV scale → fitted UV → sample → decode. * * This is the ~13 lines Image / Video / Webcam each transcribed verbatim. The fit branch is JS * (compile-time), so the emitted WGSL carries exactly one mode's math; `dims` comes from * `KitTexture.dimensions()` (GPU `textureDimensions`), which is why no CPU aspect uniforms exist for * any of the three. */ export declare function mediaSurface(opts: MediaSurfaceOptions): Expr; //# sourceMappingURL=media.d.ts.map