Skip to content

Commit

Permalink
docs: Update Skia docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Apr 22, 2024
1 parent 629e23e commit be4f7bf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions package/src/skia/useSkiaFrameProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ type SurfaceCache = Record<
* Also make sure to memoize the returned object, so that the Camera doesn't reset the Frame Processor Context each time.
*
* @worklet
* @example
* ```ts
* 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)
* ```
*/
export function createSkiaFrameProcessor(
frameProcessor: (frame: DrawableFrame) => void,
Expand Down

0 comments on commit be4f7bf

Please sign in to comment.