import { type SkCanvas, type SkImage } from '@shopify/react-native-skia'; import type { Frame } from 'react-native-vision-camera'; /** * Represents the state for rendering * a Frame. */ export interface SkiaOnFrameState { /** * The {@linkcode Frame} wrapped as a drawable * GPU-texture. * * The `frameTexture` can either be drawn to * the {@linkcode canvas} directly in which * case it will just be displayed as-is, or * drawn with a `paint`, in which case it will * be used as an input texture for sampling it * inside a Skia Shader. * * @example * ```ts * // Draw as-is: * canvas.drawImage(frameTexture, 0, 0) * // Draw with shader: * const paint = ... * const shader = ... * paint.setShader(shader) * canvas.drawImage(frameTexture, 0, 0, paint) * ``` */ frameTexture: SkImage; /** * The GPU-canvas to draw the {@linkcode frameTexture} * in. * @example * ```ts * canvas.drawImage(frameTexture, 0, 0) * ``` */ canvas: SkCanvas; } /** * Renders the given {@linkcode Frame} to a {@linkcode SkImage} * and returns it. * @param frame The {@linkcode Frame} to render. It will be converted to a Texture. * @param onDraw A provided draw function to perform the rendering. * @internal * @worklet */ export declare function renderToTexture(frame: Frame, onDraw: (state: SkiaOnFrameState) => void): SkImage;