ImageFrameSource

Defined under the namespace Scandit.Datacapture.Core

ImageFrameSource
class ImageFrameSource : FrameSource

Added in version 6.20.0

To emit the frame set this object as the frame source for the DataCaptureContext and turn it on by changing the desired state to FrameSourceState.On. This frame source will turn off automatically after the frame is emitted.

fromFile(file)
static fromFile(file: File): Promise<ImageFrameSource>

Added in version 6.20.0

Constructs a new ImageFrameSource from the file. If the file cannot be converted as an image, a DataCaptureError is thrown with the name “InvalidImageError”.

fromImage(image)
static fromImage(image: HTMLImageElement): Promise<ImageFrameSource>

Added in version 6.20.0

Constructs a new ImageFrameSource from the given Image. If the image cannot be loaded, a DataCaptureError is thrown with the name “InvalidImageError”.

fromImageData(imageData)
static fromImageData(imageData: ImageData): Promise<ImageFrameSource>

Added in version 6.20.0

Constructs a new ImageFrameSource from the given ImageData instance. If the data cannot be loaded by a canvas element (putImageData), a DataCaptureError is thrown with the name “InvalidImageError”.

desiredState
get desiredState(): FrameSourceState

Added in version 6.20.0

Implemented from FrameSource. See FrameSource.desiredState.

getCurrentState()
getCurrentState(): FrameSourceState

Added in version 6.20.0

Implemented from FrameSource. See FrameSource.getCurrentState.

addListener(listener)
addListener(listener: FrameSourceListener | null): void

Added in version 6.20.0

Implemented from FrameSource. See FrameSource.addListener().

removeListener(listener)
removeListener(listener: FrameSourceListener | null): void

Added in version 6.20.0

Implemented from FrameSource. See FrameSource.removeListener().

switchToDesiredState(state)
switchToDesiredState(state: FrameSourceState): Promise<void>

Added in version 6.20.0

Convenience method for FrameSource.switchToDesiredState(): it is same as calling FrameSource.switchToDesiredState() with the second argument set to null.