layout | title | description | keywords | needAutoGenerateSidebar | needGenerateH3Content | noTitleIndex |
---|---|---|---|---|---|---|
default-layout |
class ImageSourceAdapter - Dynamsoft Core Module JS Edition API Reference |
This page shows the JS edition of the class ImageSourceAdapter in Dynamsoft Core Module. |
image source adapter, JS |
true |
true |
true |
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. |
Adds an image to the buffer of the adapter.
addImageToBuffer(image: Core.DSImageData): void;
Parameters
image
: The image to add to the buffer.
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.
Starts fetching images.
startFetching(): void;
Stops fetching images.
stopFetching(): void;
Retrieves a buffered image as a promise.
getImage(): Promise<Core.DSImageData>;
Return value
Returns the image object as a promise .
Sets how many images are allowed to be buffered.
setMaxImageCount(count: number): void;
Parameters
count
: The maximum number of images that can be buffered.
Returns how many images can be buffered.
getMaxImageCount(): number;
Return value
Returns the maximum number of images that can be buffered.
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.
Returns the current buffer overflow protection mode.
getBufferOverflowProtectionMode(): Core.EnumBufferOverflowProtectionMode;
Return value
Returns the current buffer overflow protection mode.
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.
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.
Returns the actual count of buffered images.
getImageCount(): number;
Return value
Returns the actual count of buffered images.
Determines whether the buffer is empty.
isBufferEmpty(): boolean;
Return value
Returns true if the buffer is empty, false otherwise.
Clear the image buffer.
clearBuffer(): void;
Sets the usage type of a color channel in images.
setColourChannelUsageType(type: Core.EnumColourChannelUsageType): void;
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.