react-native-vision-camera-skiaInterfaces
SkiaCameraRef
interface SkiaCameraRef extends PickA reference to a SkiaCamera.
You can obtain a SkiaCameraRef via useRef(...):
Example
function App() {
const camera = useRef<SkiaCameraRef>(null)
const onPress = async () => {
const snapshot = await camera.current.takeSnapshot()
console.log('Captured Skia snapshot!', snapshot.getImageInfo())
}
return (
<SkiaCamera
ref={camera}
device="back"
isActive={true}
onFrame={(frame, render) => {
'worklet'
render(({ canvas, frameTexture }) => {
canvas.drawImage(frameTexture, 0, 0)
})
frame.dispose()
}}
/>
)
}Methods
convertViewPointToNormalizedPoint()
Converts the given viewPoint to
a normalized Point with values ranging from 0...1.
focusTo()
focusTo(viewPoint: Point, options?: FocusOptions): Promise<void>Focuses the Camera pipeline to the specified viewPoint
relative to the Camera Skia view's coordiante system,
using the specified MeteringModes.
Parameters
viewPoint
The point in the view coordinate system to focus to.
options
Options for the focus operation.
Example
// Focus center
await camera.current.focusTo({ x: width / 2, y: height / 2 })resetFocus()
resetFocus(): Promise<void>Cancels any current focus operations from focusTo(...),
resets back all 3A focus modes to continuously auto-focus, and
resets the focus point of interest to be in the center.
Throws
If the device does not support metering (see CameraDevice.supportsFocusMetering)
Example
await controller.resetFocus()Inherited from
Pick.resetFocustakeSnapshot()
takeSnapshot():
| SkImage
| undefinedTakes a snapshot of the currently rendered
content, or undefined if none are available.
Example
const snapshot = await camera.current.takeSnapshot()
console.log('Captured Skia snapshot!', snapshot.getImageInfo())