Function: createSkiaFrameProcessor()
createSkiaFrameProcessor(
frameProcessor,surfaceHolder,offscreenTextures,previewOrientation):DrawableFrameProcessor
Create a new Frame Processor function which you can pass to the <Camera>.
(See "Frame Processors")
Make sure to add the 'worklet' directive to the top of the Frame Processor function, otherwise it will not get compiled into a worklet.
Also make sure to memoize the returned object, so that the Camera doesn't reset the Frame Processor Context each time.
Parameters​
• frameProcessor
• surfaceHolder: ISharedValue<SurfaceCache>
• offscreenTextures: ISharedValue<SkImage[]>
• previewOrientation: ISharedValue<Orientation>
Returns​
Worklet​
Example​
const surfaceHolder = Worklets.createSharedValue<SurfaceCache>({})
const offscreenTextures = Worklets.createSharedValue<SkImage[]>([])
const frameProcessor = createSkiaFrameProcessor((frame) => {
  'worklet'
  const faces = scanFaces(frame)
  frame.render()
  for (const face of faces) {
    const rect = Skia.XYWHRect(face.x, face.y, face.width, face.height)
    frame.drawRect(rect)
  }
}, surfaceHolder, offscreenTextures)
Defined in​
skia/useSkiaFrameProcessor.ts:169