mvIMPACT Acquire SDK C++
ImageBufferDesc Class Reference

A wrapper class to handle mvIMPACT::acquire::ImageBuffer structures. More...

Public Member Functions

ImageBufferDesc clone (void) const
 Returns a deep copy of the mvIMPACT::acquire::ImageBuffer object referenced by this descriptor. More...
 
int copy (char *pDst, const int dstSize) const
 Returns a deep copy of the data buffer of the underlying mvIMPACT::acquire::ImageBuffer object referenced by this descriptor. More...
 
ImageBuffergetBuffer (void) const
 Grants access to the underlying mvIMPACT::acquire::ImageBuffer structure managed by this object. More...
 
 ImageBufferDesc (const ImageBufferDesc &source)
 Constructs a new mvIMPACT::acquire::ImageBufferDesc from an existing one. More...
 
 ImageBufferDesc (const std::string &fileName, TImageFileFormat fileFormat=iffAuto)
 Constructs a new mvIMPACT::acquire::ImageBufferDesc object from a file and allocates all memory needed. More...
 
 ImageBufferDesc (int channelCount)
 Constructs a new mvIMPACT::acquire::ImageBufferDesc object with channelCount channel specific data elements. More...
 
 ImageBufferDesc (TImageBufferPixelFormat pixelFormat, int width, int height)
 Constructs a new mvIMPACT::acquire::ImageBufferDesc object and allocates all memory needed. More...
 
ImageBufferDescoperator= (const ImageBufferDesc &rhs)
 Allows assignments of two different mvIMPACT::acquire::ImageBufferDesc. More...
 
int save (const std::string &fileName, TImageFileFormat format=iffAuto) const
 Stores the complete data of one ImageBuffer structure into a file. More...
 
 ~ImageBufferDesc ()
 De-allocates all managed memory again when this is the last object referencing the image. More...
 

Detailed Description

A wrapper class to handle mvIMPACT::acquire::ImageBuffer structures.

This class acts as a simple wrapper to handle mvIMPACT::acquire::ImageBuffer structures. When using this class the user is no longer responsible for the memory management of mvIMPACT::acquire::ImageBuffer structures.

Instances of this class are reference counted. Memory is freed once the last instance to it is destroyed. For details read the corresponding sections in the documentation of the various constructors and function belonging to this class.

Constructor & Destructor Documentation

◆ ImageBufferDesc() [1/4]

ImageBufferDesc ( const ImageBufferDesc source)
inline

Constructs a new mvIMPACT::acquire::ImageBufferDesc from an existing one.

The image buffer associated with this descriptor will not be copied! The internal data will be reference counted and changing this new object will also affect the original one. The internal data is freed when the last descriptor referencing the image is destroyed.

Parameters
[in]sourceThe source buffer descriptor.

◆ ImageBufferDesc() [2/4]

ImageBufferDesc ( int  channelCount)
inlineexplicit

Constructs a new mvIMPACT::acquire::ImageBufferDesc object with channelCount channel specific data elements.

This constructor does NOT allocate memory for the actual pixel data but only for the a structure describing an image.

When passing invalid values to this constructor (e.g. a negative value for channelCount) an exception will be thrown.

Parameters
[in]channelCountThe number of channel specific data elements to allocate memory for.

◆ ImageBufferDesc() [3/4]

ImageBufferDesc ( TImageBufferPixelFormat  pixelFormat,
int  width,
int  height 
)
inlineexplicit

Constructs a new mvIMPACT::acquire::ImageBufferDesc object and allocates all memory needed.

This constructor will allocate and handle a new and complete ImageBuffer object including memory for the pixel data for the given pixel format.

The size(in bytes) of allocated pixel memory will depend on the pixelFormat as well as on the parameters width and height. mvIMPACT::acquire::ImageBuffer::iSize will return the amount of memory allocated for the buffer.

When passing invalid values to this constructor (e.g. a negative value for height) an exception will be thrown.

Parameters
[in]pixelFormatThe desired pixel format for the new mvIMPACT::acquire::ImageBuffer object handled by this descriptor.
[in]widthThe width of the new mvIMPACT::acquire::ImageBuffer object handled by this descriptor.
[in]heightThe height of the new mvIMPACT::acquire::ImageBuffer object handled by this descriptor.

◆ ImageBufferDesc() [4/4]

ImageBufferDesc ( const std::string &  fileName,
TImageFileFormat  fileFormat = iffAuto 
)
inlineexplicit

Constructs a new mvIMPACT::acquire::ImageBufferDesc object from a file and allocates all memory needed.

This constructor will allocate and handle a new and complete ImageBuffer object including memory for the pixel data for the given pixel format. The buffer will be filled with the data from the file referenced by fileName.

Note
Internally The FreeImage library (see 'legal notice' section) is used for this operation. If the library cannot be located in version 3.16.0 on the host system calling this constructor will fail and an exception will be thrown.
Since
2.23.0
Parameters
[in]fileNameThe name of the file to load.
[in]fileFormatThe format of the file to load.

◆ ~ImageBufferDesc()

~ImageBufferDesc ( )
inline

De-allocates all managed memory again when this is the last object referencing the image.

Member Function Documentation

◆ clone()

ImageBufferDesc clone ( void  ) const
inline

Returns a deep copy of the mvIMPACT::acquire::ImageBuffer object referenced by this descriptor.

This function will create a deep copy of the mvIMPACT::acquire::ImageBuffer object referenced by this descriptor. Afterwards modifying one of the images will NOT influence the other one.

Returns
A deep copy of the mvIMPACT::acquire::ImageBuffer object referenced by this descriptor.

◆ copy()

int copy ( char *  pDst,
const int  dstSize 
) const
inline

Returns a deep copy of the data buffer of the underlying mvIMPACT::acquire::ImageBuffer object referenced by this descriptor.

This function will create a deep copy of the data buffer of the mvIMPACT::acquire::ImageBuffer object referenced by this descriptor. Afterwards modifying one of the buffers will NOT influence the other one.

Since
2.36.0
Returns
The buffer size needed for pDst if dstSize was too small or the size used if the operation was successful.
Parameters
pDstA pointer to the buffer to copy the data into. Can be 0 if just the size needed shall be queried.
dstSizeThe size of the buffer pointed to by pDst. Is 'don't care' if just the size needed shall be queried.

◆ getBuffer()

ImageBuffer* getBuffer ( void  ) const
inline

Grants access to the underlying mvIMPACT::acquire::ImageBuffer structure managed by this object.

Returns
A pointer to the mvIMPACT::acquire::ImageBuffer object referenced by this descriptor.

◆ operator=()

ImageBufferDesc& operator= ( const ImageBufferDesc rhs)
inline

Allows assignments of two different mvIMPACT::acquire::ImageBufferDesc.

The image buffer associated with this descriptor will not be copied! The internal data will be reference counted and changing this new object will also affect the original one. The internal data is freed when the last descriptor referencing the image is destroyed.

◆ save()

int save ( const std::string &  fileName,
TImageFileFormat  format = iffAuto 
) const
inline

Stores the complete data of one ImageBuffer structure into a file.

This function stores the image described by a mvIMPACT::acquire::ImageBuffer structure pointed to by the pBuffer variable into a file.

Note
Internally The FreeImage library (see 'legal notice' section) is used for this operation. If the library cannot be located in version 3.16.0 on the host system calling this function will fail.
Since
2.23.0
Returns
Parameters
[in]fileNameThe full path of the file to create.
[in]formatThe format of the file to be created. If this parameter is set to mvIMPACT::acquire::iffAuto make sure to specify a proper file extension.

The documentation for this class was generated from the following file: