Resource Base
Table of contents

ImageSourceAdapter

ImageSourceAdapter is an abstract class that defines the standard structure of an image source in the Dynamsoft Capture Vision architecture.

| Name | Description | | ———————————————————————– | ——————————————————————————————————— | | addImageToBuffer() | Adds an image to the buffer of the adapter. | | hasNextImageToFetch() | Determines whether there are more images left to fetch. | | startFetching() | Starts fetching images. | | stopFetching() | Stops fetching images. | | getImage() | Returns a buffered image. | | setMaxImageCount() | Sets how many images are allowed to be buffered. | | getMaxImageCount() | Returns how many images can be buffered. | | setBufferOverflowProtectionMode() | Sets a mode that determines the action to take when there is a new incoming image and the buffer is full. | | getBufferOverflowProtectionMode() | Returns the current buffer overflow protection mode. | | hasImage() | Determines whether the image is in the buffer or not. | | setNextImageToReturn() | Sets the next image to return. | | getImageCount() | Returns the actual count of buffered images. | | isBufferEmpty() | Determines whether the buffer is empty. | | clearBuffer() | Clears the image buffer. | | setColourChannelUsageType() | Sets the usage type of a color channel in an image. | | getColourChannelUsageType() | Gets the usage type of a color channel in an image. | —

addImageToBuffer

Adds an image to the buffer of the adapter.

addImageToBuffer(image: Core.DSImageData): void;

Parameters

image: The image to add to the buffer.

hasNextImageToFetch

An abstract method that needs to be implemented by the user. It checks if there is a next image to fetch.

abstract hasNextImageToFetch(): boolean;

Return value

Returns true if there are more images left to fetch, false otherwise.

startFetching

Starts fetching images.

startFetching(): void;

stopFetching

Stops fetching images.

stopFetching(): void;

getImage

Retrieves a buffered image as a promise.

getImage(): Promise<Core.DSImageData>;

Return value

Returns the image object as a promise .

setMaxImageCount

Sets how many images are allowed to be buffered.

setMaxImageCount(count: number): void;

Parameters

count: The maximum number of images that can be buffered.

getMaxImageCount

Returns how many images can be buffered.

getMaxImageCount(): number;

Return value

Returns the maximum number of images that can be buffered.

setBufferOverflowProtectionMode

Sets a mode that determines the action to take when there is a new incoming image and the buffer is full.

setBufferOverflowProtectionMode(mode: Core.EnumBufferOverflowProtectionMode): void;

Parameters

mode: The buffer overflow protection mode to set.

getBufferOverflowProtectionMode

Returns the current buffer overflow protection mode.

getBufferOverflowProtectionMode(): Core.EnumBufferOverflowProtectionMode;

Return value

Returns the current buffer overflow protection mode.

hasImage

Determines whether the image is in the buffer or not.

hasImage(imageId: number): boolean;

Parameters

imageId: The ID of the image to check.

Return value

Returns true if the image is in the buffer, false otherwise.

setNextImageToReturn

Sets the next image to return.

setNextImageToReturn(imageId: number, keepInBuffer?: boolean): void;

Parameters

imageId: The ID of the next image to return.

keepInBuffer: Whether the image should be kept in the buffer after it is returned.

getImageCount

Returns the actual count of buffered images.

getImageCount(): number;

Return value

Returns the actual count of buffered images.

isBufferEmpty

Determines whether the buffer is empty.

isBufferEmpty(): boolean;

Return value

Returns true if the buffer is empty, false otherwise.

clearBuffer

Clear the image buffer.

clearBuffer(): void;

setColourChannelUsageType

Sets the usage type of a color channel in images.

setColourChannelUsageType(type: Core.EnumColourChannelUsageType): void;

getColourChannelUsageType

Gets the usage type of a color channel in images.

getColourChannelUsageType(): Core.EnumColourChannelUsageType;

Return value

Returns the usage type of a color channel in images.

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

version 3.0.10

  • Latest version(2.2.30)
  • Version 2.x
    • Version 2.2.10
    • Version 2.0.30
    • Version 2.0.20
    • Version 2.0.10
Change +
© 2003–2024 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support