Thanks for downloading Dynamsoft Barcode Reader Package!
Your download will start shortly. If your download does not begin, click here to retry.
DSImageSourceAdapter
The DSImageSourceAdapter
class provides an interface for fetching and buffering images. It is an abstract class that needs to be implemented by a concrete class to provide actual functionality.
Definition
Assembly: DynamsoftCore.framework
- Objective-C
- Swift
@interface DSImageSourceAdapter : NSObject
class ImageSourceAdapter : NSObject
Methods & Attributes
Attributes | Type | Description |
---|---|---|
hasNextImageToFetch |
BOOL | Determines whether there are more images left to fetch. |
maxImageCount |
NSUInteger | The property defines the maximum capability of the Video Buffer. |
bufferOverflowProtectionMode |
DSBufferOverflowProtectionMode | 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. |
imageCount |
NSUInteger | The property defines current image count in the Video Buffer. |
bufferEmpty |
BOOL | The read only property indicates whether the Video Buffer is empty. |
colourChannelUsageType |
colourChannelUsageType | The usage type of a color channel in an image. |
Method | Description |
---|---|
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. |
getImage |
Get an image from the Video Buffer. |
setNextImageToReturn |
Specify the next image that is returned by method getImage. |
hasImage |
Check the availability of the specified image. |
addImageToBuffer |
Adds an image to the buffer of the adapter. |
clearBuffer |
Clears the image buffer. |
hasNextImageToFetch
Determines whether there are more images left to fetch.
- Objective-C
- Swift
@property (nonatomic, assign) BOOL hasNextImageToFetch;
var hasNextImageToFetch: Bool { get set }
maxImageCount
The property defines the maximum capability of the Video Buffer.
- Objective-C
- Swift
@property (nonatomic, assign) NSUInteger maxImageCount;
var maxImageCount: Int { get set }
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
@property (nonatomic, assign) DSBufferOverflowProtectionMode bufferOverflowProtectionMode;
var bufferOverflowProtectionMode: DSBufferOverflowProtectionMode { get set }
imageCount
The property defines current image count in the Video Buffer.
- Objective-C
- Swift
@property (nonatomic, assign) NSUInteger imageCount;
var imageCount: Int { get set }
bufferEmpty
The read only property indicates whether the Video Buffer is empty.
- Objective-C
- Swift
@property (nonatomic, assign, readonly, getter=isBufferEmpty) BOOL bufferEmpty;
var bufferEmpty: Bool { get }
colourChannelUsageType
The usage type of a color channel in an image.
- Objective-C
- Swift
@property (nonatomic, assign) colourChannelUsageType;
var colourChannelUsageType: colourChannelUsageType { get set }
startFetching
Start fetching images from the source to the Video Buffer of ImageSourceAdapter.
- Objective-C
- Swift
- (void)startFetching;
func startFetching()
stopFetching
Stop fetching images from the source to the Video Buffer of ImageSourceAdapter.
- Objective-C
- Swift
- (void)stopFetching;
func stopFetching()
getImage
Get an image from the Video Buffer.
- Objective-C
- Swift
- (DSImageData *_Nullable)getImage;
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.
setNextImageToReturn
Specify the next image that is returned by method getImage.
- Objective-C
- Swift
- (BOOL)setNextImageToReturn:(NSInteger)imageId;
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”.
hasImage
Check the availability of the specified image.
- Objective-C
- Swift
- (BOOL)hasImage:(NSInteger)imageId;
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.
addImageToBuffer
Adds an image to the buffer of the adapter.
- Objective-C
- Swift
- (void)addImageToBuffer:(DSImageData*)image;
func addImageToBuffer(image: DSImageData)
Parameters
[in] image
: The DSImageData object to add.
clearBuffer
Clears the image buffer.
- Objective-C
- Swift
- (void)clearBuffer;
func clearBuffer()
setErrorListener
Registers a ImageSourceErrorListener
to be used as a callback when an error occurs in the ImageSourceAdapter
.
- Objective-C
- Swift
-(void)setErrorListener:(DSImageSourceErrorListener)listener;
func setErrorListener(_ listener:ImageSourceErrorListener)
Parameters
[in] listener
: A delegate object of DSImageSourceErrorListener
to receive the errors that occurs in the ImageSourceAdapter
.