Resource Base
Table of contents

CImageSourceAdapter

The CImageSourceAdapter 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

Namespace: dynamsoft::basic_structures

Assembly: DynamsoftCore

class CImageSourceAdapter 

Methods Summary

Method 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.
SetErrorListener Sets the error listener for the image source.

AddImageToBuffer

Adds an image to the buffer of the adapter.

void AddImageToBuffer(const CImageData* img, bool bClone = true);

Parameters

[in] img The image to add to the buffer.

[in] bClone Whether the image should be cloned before being added to the buffer.

See Also

CImageData

HasNextImageToFetch

Determines whether there are more images left to fetch.

virtual bool HasNextImageToFetch() const;

Return value

Returns true if there are more images left to fetch, false otherwise. This function must be implemented in the subclass.

StartFetching

Starts fetching images.

virtual void StartFetching();

StopFetching

Stops fetching images.

virtual void StopFetching();

GetImage

Returns a buffered image.

virtual CImageData* GetImage();

Return value

Returns a pointer to the image if it exists in the buffer, NULL otherwise.

See Also

CImageData

SetMaxImageCount

Sets how many images are allowed to be buffered.

void SetMaxImageCount(int count);

Parameters

[in] count The maximum number of images that can be buffered.

GetMaxImageCount

Returns how many images can be buffered.

int GetMaxImageCount() const;

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.

void SetBufferOverflowProtectionMode(BufferOverflowProtectionMode mode);

Parameters

[in] mode The buffer overflow protection mode to set.

See Also

BufferOverflowProtectionMode

GetBufferOverflowProtectionMode

Returns the current buffer overflow protection mode.

BufferOverflowProtectionMode GetBufferOverflowProtectionMode() const;

Return value

Returns the current buffer overflow protection mode.

See Also

BufferOverflowProtectionMode

HasImage

Determines whether the image is in the buffer or not.

bool HasImage(int imageId) const;

Parameters

[in] 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.

bool SetNextImageToReturn(int imageId, bool keepInBuffer = true);

Parameters

[in] imageId The ID of the next image to return.

[in] keepInBuffer Whether the image should be retained in the buffer, even if the buffer is full and the image needs to be updated based on the BufferOverflowProtectionMode parameter.

Return value

Returns true if the image is in the buffer and is set as the next image to return, false otherwise.

GetImageCount

Returns the actual count of buffered images.

int GetImageCount() const;

Return value

Returns the actual count of buffered images.

IsBufferEmpty

Determines whether the buffer is empty.

bool IsBufferEmpty() const;

Return value

Returns true if the buffer is empty, false otherwise.

ClearBuffer

Clear the image buffer.

void ClearBuffer();

SetColourChannelUsageType

Sets the usage type of a color channel in images.

void SetColourChannelUsageType(ColourChannelUsageType type);

See Also

ColourChannelUsageType

GetColourChannelUsageType

Gets the usage type of a color channel in images.

ColourChannelUsageType GetColourChannelUsageType() const;

Return value

Returns the usage type of a color channel in images.

See Also

ColourChannelUsageType

SetErrorListener

Gets the usage type of a color channel in images. This function allows you to set an error listener object that will receive notifications when errors occur during image source operations. If an error occurs, the error infomation will be passed to the listener’s OnErrorReceived method.

void SetErrorListener(CImageSourceErrorListener* listener);

Parameters

[in] listener A pointer to an instance of CImageSourceErrorListener or its derived class, which will handle error notifications.

See Also

CImageSourceErrorListener

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

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