PreviewViewMethods

interface PreviewViewMethods extends HybridViewMethods

Extended by

Methods

convertCameraPointToViewPoint()

convertCameraPointToViewPoint(cameraPoint: Point): Point

Converts the given cameraPoint in camera sensor coordinates into a Point in view coordinates, relative to this PreviewView.

Note

Camera sensor coordinates are not necessarily normalized from 0.0 to 1.0. Some implementations may have a different opaque coordinate system.

Throws

If the PreviewView isn't ready yet.

Example

const cameraPoint = { x: 0.5, y: 0.5 }
const viewPoint = previewView.convertCameraPointToViewPoint(cameraPoint)
console.log(viewPoint) // { x: 196, y: 379.5 }

convertScannedObjectCoordinatesToViewCoordinates()

iOS
convertScannedObjectCoordinatesToViewCoordinates(scannedObject: ScannedObject): ScannedObject

Returns a new ScannedObject where all coordinates in the given scannedObject are converted into view coordinates.

Parameters

scannedObject

The scanned object in its original coordinates.


convertViewPointToCameraPoint()

convertViewPointToCameraPoint(viewPoint: Point): Point

Converts the given viewPoint in view coordinates relative to this PreviewView into a Point in camera sensor coordinates.

Note

Camera sensor coordinates are not necessarily normalized from 0.0 to 1.0. Some implementations may have a different opaque coordinate system.

Throws

If the PreviewView isn't ready yet.

Example

const viewPoint = { x: 196, y: 379.5 }
const cameraPoint = previewView.convertViewPointToCameraPoint(viewPoint)
console.log(cameraPoint) // { x: 0.5, y: 0.5 }

createMeteringPoint()

createMeteringPoint(
   viewX: number, 
   viewY: number, 
   size?: number): MeteringPoint

Creates a MeteringPoint that can be used for focusing AE/AF/AWB on the Camera via focusTo(...).

The coordinates (viewX, viewY) are relative to this PreviewView, and take orientation, scaling and cropping into account.

Parameters

viewX

The X coordinate within the View's coordinate system. This can be the x value of a tap event on the PreviewView.

viewY

The Y coordinate within the View's coordinate system. This can be the y value of a tap event on the PreviewView.

size

(Optional) The size of the MeteringPoint within the View's coordinate system.

Throws

If the PreviewView isn't ready yet.


takeSnapshot()

Android
takeSnapshot(): Promise<Image>

Take a snapshot of the current PreviewView's contents, and return it as an Image.

Throws

If the PreviewView isn't ready yet.

Throws

If the PreviewView doesn't have snapshottable contents.

Throws

If the PreviewView doesn't support snapshots.