Resource Base
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

DSImageSourceAdapter

The ImageSourceAdapter class is an abstract class representing an adapter for image sources, providing a framework for fetching, buffering, and managing images from various sources. Implementations must provide specific mechanisms for image retrieval and handling.

Definition

Assembly: DynamsoftCore.framework

  • Objective-C
  • Swift
  1. @interface DSImageSourceAdapter : NSObject
    
  2. class ImageSourceAdapter : NSObject
    

Attribute Summaries

Attributes Type Description
bufferEmpty BOOL The read only property determines whether the buffer is currently empty.
bufferOverflowProtectionMode DSBufferOverflowProtectionMode Sets the behavior for handling new incoming images when the buffer is full.
colourChannelUsageType colourChannelUsageType Sets the usage type for color channels in images.
hasNextImageToFetch BOOL Determines whether there are more images available to fetch.
imageCount NSUInteger The property defines the current number of images in the buffer.
maxImageCount NSUInteger The property defines the maximum number of images that can be buffered.

Method Summaries

Method Description
addImageToBuffer Adds an image to the internal buffer.
clearBuffer Clears all images from the buffer, resetting the state for new image fetching.
getImage Get a buffered image. Implementing classes should return a Promise that resolves with an instance of DSImageData.
hasImage Checks if an image with the specified ID is present in the buffer.
setErrorListener Sets an error listener to receive notifications about errors that occur during image source operations.
setNextImageToReturn Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage.
startFetching Start fetching images from the source to the Video Buffer of ImageSourceAdapter.
stopFetching Stop fetching images from the source to the Video Buffer of ImageSourceAdapter.

Attribute Details

bufferEmpty

The read only property indicates whether the Video Buffer is empty.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign, readonly, getter=isBufferEmpty) BOOL bufferEmpty;
    
  2. var bufferEmpty: Bool { get }
    

bufferOverflowProtectionMode

Sets a mode that determines the action to take when there is a new incoming image and the buffer is full. You can either block the Video Buffer or push out the oldest image and append a new one.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) DSBufferOverflowProtectionMode bufferOverflowProtectionMode;
    
  2. var bufferOverflowProtectionMode: DSBufferOverflowProtectionMode { get set }
    

colourChannelUsageType

The usage type of a color channel in an image.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) colourChannelUsageType;
    
  2. var colourChannelUsageType: colourChannelUsageType { get set }
    

hasNextImageToFetch

Determines whether there are more images left to fetch.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) BOOL hasNextImageToFetch;
    
  2. var hasNextImageToFetch: Bool { get set }
    

imageCount

The property defines current image count in the Video Buffer.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) NSUInteger imageCount;
    
  2. var imageCount: Int { get set }
    

maxImageCount

The property defines the maximum capability of the Video Buffer.

  • Objective-C
  • Swift
  1. @property (nonatomic, assign) NSUInteger maxImageCount;
    
  2. var maxImageCount: Int { get set }
    

Method Details

addImageToBuffer

Adds an image to the internal buffer.

  • Objective-C
  • Swift
  1. - (void)addImageToBuffer:(DSImageData*)image;
    
  2. func addImageToBuffer(image: DSImageData)
    

Parameters

[in] image: The DSImageData object to add.

clearBuffer

Clears all images from the buffer, resetting the state for new image fetching.

  • Objective-C
  • Swift
  1. - (void)clearBuffer;
    
  2. func clearBuffer()
    

getImage

Get a buffered image. Implementing classes should return a Promise that resolves with an instance of DSImageData.

  • Objective-C
  • Swift
  1. - (DSImageData *_Nullable)getImage;
    
  2. func getImage() -> DSImageData?
    

Return Value

An object of DSImageData.

  • If an image is set as the “next image” by method setNextImageToReturn, return that image.
  • If no image is set as the “next image”, return the latest image.

hasImage

Checks if an image with the specified ID is present in the buffer.

  • Objective-C
  • Swift
  1. - (BOOL)hasImage:(NSInteger)imageId;
    
  2. func hasImage(imageId: Int) -> Bool
    

Parameters

[in] imageId: The imageId of image you want to check the availability.

Return Value

A BOOL value that indicates whether the specified image is found in the video buffer.

setErrorListener

Sets an error listener to receive notifications about errors that occur during image source operations.

  • Objective-C
  • Swift
  1. -(void)setErrorListener:(DSImageSourceErrorListener)listener;
    
  2. func setErrorListener(_ listener:ImageSourceErrorListener)
    

Parameters

[in] listener: A delegate object of DSImageSourceErrorListener to receive the errors that occurs in the ImageSourceAdapter.

setNextImageToReturn

Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage.

  • Objective-C
  • Swift
  1. - (BOOL)setNextImageToReturn:(NSInteger)imageId;
    
  2. func setNextImageToReturn(imageId: Int) -> Bool
    

Parameters

[in] imageId: The imageId of image you want to set as the “next image”.
[in] keepInBuffer: Set this value to true so that the “next image” is protected from being pushed out before is it returned by method getImage.

Return Value

A BOOL value that indicates whether the specified image is successfully set as the “next image”.

startFetching

Start fetching images from the source to the Video Buffer of ImageSourceAdapter.

  • Objective-C
  • Swift
  1. - (void)startFetching;
    
  2. func startFetching()
    

stopFetching

Stop fetching images from the source to the Video Buffer of ImageSourceAdapter.

  • Objective-C
  • Swift
  1. - (void)stopFetching;
    
  2. func stopFetching()
    

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 2.x
    • Version 2.2.10
    • Version 2.0.21
    • Version 2.0.20
    • Version 2.0.10
    • Version 2.2.10
    • Version 2.0.21
    • Version 2.0.20
    • Version 2.0.10
  • Version 1.x
    • Version 1.2.1
    • Version 1.2.0
    • Version 1.1.0
    • Version 1.0.0
    • Version 1.0.4
    • Version 1.0.3
    • Version 1.0.2
    • Version 1.0.1
    • Version 1.0.0
    • Version 1.1.11
    • Version 1.1.9
    • Version 1.1.8
    • Version 1.1.7
    • Version 1.1.6
    • Version 1.1.5
    • Version 1.1.4
    • Version 1.1.3
    • Version 1.1.2
    • Version 1.1.1
    • Version 1.1.0
    • Version 1.0.0
    • Version 1.0.4
    • Version 1.0.3
    • Version 1.0.2
    • Version 1.0.1
    • Version 1.0.0
Change +
© 2003–2024 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support