Skip to main content
Version: Next

Function: computeAspectFillCrop()

computeAspectFillCrop(sourceWidth, sourceHeight, targetAspect, uv00, uv01, uv10, uv11): FrameCrop

Defined in: src/webgpu/cropUtilities.ts:86

Center-crop of a (sourceWidth × sourceHeight) frame to the target aspect ratio (width/height). A no-op full-frame crop when the source already has the target aspect. Worklet-safe.

Feed it the upright camera size from the render context: computeAspectFillCrop(context.cameraWidth, context.cameraHeight, context.outputWidth / context.outputHeight).

The optional uv00..uv11 scalars form a UV-space transform applied around the frame center (identity by default).

Parameters​

ParameterTypeDefault value
sourceWidthnumberundefined
sourceHeightnumberundefined
targetAspectnumberundefined
uv00number1
uv01number0
uv10number0
uv11number1

Returns​

FrameCrop