Skip to content

Pylon::IReusableImage#

Module: Image Handling Support

Extends the IImage interface to be able to reuse the image's resources to represent a different image.

#include <pylon/ReusableImage.h>

Inherits from Pylon::IImage

Inherited by Pylon::CPylonImageBase

Public Functions#

Name
virtual ~IReusableImage()
Ensure proper destruction by using a virtual destructor.
virtual bool IsSupportedPixelType(EPixelType pixelType) const
Can be used to check whether the pixel type is supported.
virtual bool IsAdditionalPaddingSupported() const
Can be used to check whether the value of PaddingX can be defined by the user.
virtual void Reset(EPixelType pixelType, uint32_t width, uint32_t height, EImageOrientation orientation =ImageOrientation_TopDown)
Resets the image properties and provides a buffer to hold the image.
virtual void Reset(EPixelType pixelType, uint32_t width, uint32_t height, size_t paddingX, EImageOrientation orientation =ImageOrientation_TopDown)
Resets the image properties including user defined PaddingX and provides a buffer to hold the image.
virtual void Release()
Releases the image buffer and resets to an invalid image.
virtual bool IsValid() const
Can be used to check whether an image is valid.
virtual EPixelType GetPixelType() const
Get the current pixel type.
virtual uint32_t GetWidth() const
Get the current number of columns in pixels.
virtual uint32_t GetHeight() const
Get the current number of rows.
virtual size_t GetPaddingX() const
Get the number of extra data bytes at the end of each row.
virtual EImageOrientation GetOrientation() const
Get the vertical orientation of the image in memory.
virtual void * GetBuffer()
Get the pointer to the buffer.
virtual const void * GetBuffer() const
Get the pointer to the buffer containing the image.
virtual size_t GetImageSize() const
Get the size of the image in bytes.
virtual bool IsUnique() const
Indicates that the referenced buffer is only referenced by this image.
virtual bool GetStride(size_t & strideBytes) const
Get the stride in bytes.

Additional inherited members#

Public Functions inherited from Pylon::IImage

Name
virtual ~IImage()
Ensure proper destruction by using a virtual destructor.

Public Functions Documentation#

~IReusableImage#

inline virtual ~IReusableImage() 

Ensure proper destruction by using a virtual destructor.

IsSupportedPixelType#

virtual bool IsSupportedPixelType(
    EPixelType pixelType
) const 

Can be used to check whether the pixel type is supported.

Return: Returns true if the pixel type is supported.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CPylonBitmapImage::IsSupportedPixelType, Pylon::CPylonImage::IsSupportedPixelType

IsAdditionalPaddingSupported#

virtual bool IsAdditionalPaddingSupported() const 

Can be used to check whether the value of PaddingX can be defined by the user.

Return: Returns true if the value of PaddingX can be defined by the user.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CPylonBitmapImage::IsAdditionalPaddingSupported, Pylon::CPylonImage::IsAdditionalPaddingSupported

Reset#

virtual void Reset(
    EPixelType pixelType,
    uint32_t width,
    uint32_t height,
    EImageOrientation orientation =ImageOrientation_TopDown
) 

Resets the image properties and provides a buffer to hold the image.

Parameters:

  • pixelType The pixel type of the new image.
  • width The number of pixels in a row in the new image.
  • height The number of rows in the new image.
  • orientation The vertical orientation of the image in the image buffer.

Precondition:

  • The IsSupportedPixelType() method returns true.
  • The width value must be >= 0 and < _I32_MAX.
  • The height value must be >= 0 and < _I32_MAX.

Postcondition:

  • The properties of the image are changed.
  • A buffer large enough to hold the image is provided.

Error Safety:

Throws an exception when the preconditions are not met. Throws an exception when no buffer with the required size can be provided, e.g. by allocation. The original representation is preserved on error.

Reimplemented by: Pylon::CPylonBitmapImage::Reset, Pylon::CPylonImage::Reset

Reset#

virtual void Reset(
    EPixelType pixelType,
    uint32_t width,
    uint32_t height,
    size_t paddingX,
    EImageOrientation orientation =ImageOrientation_TopDown
) 

Resets the image properties including user defined PaddingX and provides a buffer to hold the image.

Parameters:

  • pixelType The pixel type of the new image.
  • width The number of pixels in a row in the new image.
  • height The number of rows in the new image.
  • paddingX The number of extra data bytes at the end of each row.
  • orientation The vertical orientation of the image in the image buffer.

Precondition:

Reimplemented by: Pylon::CPylonBitmapImage::Reset, Pylon::CPylonImage::Reset

Extends the Reset(EPixelType, uint32_t, uint32_t) method with user provided padding.

Release#

virtual void Release() 

Releases the image buffer and resets to an invalid image.

Postcondition:

  • PixelType = PixelType_Undefined.
  • Width = 0.
  • Height = 0.
  • PaddingX = 0.
  • No buffer is allocated.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CPylonBitmapImage::Release, Pylon::CPylonImage::Release

IsValid#

virtual bool IsValid() const 

Can be used to check whether an image is valid.

Return: Returns false if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::IsValid, Pylon::CPylonBitmapImage::IsValid, Pylon::CPylonImage::IsValid

GetPixelType#

virtual EPixelType GetPixelType() const 

Get the current pixel type.

Return: Returns the pixel type or PixelType_Undefined if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetPixelType, Pylon::CPylonBitmapImage::GetPixelType, Pylon::CPylonImage::GetPixelType

GetWidth#

virtual uint32_t GetWidth() const 

Get the current number of columns in pixels.

Return: Returns the current number of columns in pixels or 0 if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetWidth, Pylon::CPylonBitmapImage::GetWidth, Pylon::CPylonImage::GetWidth

GetHeight#

virtual uint32_t GetHeight() const 

Get the current number of rows.

Return: Returns the current number of rows or 0 if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetHeight, Pylon::CPylonBitmapImage::GetHeight, Pylon::CPylonImage::GetHeight

GetPaddingX#

virtual size_t GetPaddingX() const 

Get the number of extra data bytes at the end of each row.

Return: Returns the number of extra data bytes at the end of each row or 0 if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetPaddingX, Pylon::CPylonBitmapImage::GetPaddingX, Pylon::CPylonImage::GetPaddingX

GetOrientation#

virtual EImageOrientation GetOrientation() const 

Get the vertical orientation of the image in memory.

Return: Returns the orientation of the image or ImageOrientation_TopDown if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetOrientation, Pylon::CPylonBitmapImage::GetOrientation, Pylon::CPylonImage::GetOrientation

GetBuffer#

virtual void * GetBuffer() 

Get the pointer to the buffer.

Return: Returns the pointer to the used buffer or NULL if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetBuffer, Pylon::CPylonBitmapImage::GetBuffer, Pylon::CPylonImage::GetBuffer

GetBuffer#

virtual const void * GetBuffer() const 

Get the pointer to the buffer containing the image.

Return: Returns the pointer to the used buffer or NULL if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetBuffer, Pylon::CPylonBitmapImage::GetBuffer, Pylon::CPylonImage::GetBuffer

The buffer is at least as large as the value returned by GetImageSize().

GetImageSize#

virtual size_t GetImageSize() const 

Get the size of the image in bytes.

Return: Returns the size of the image in bytes or 0 if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetImageSize, Pylon::CPylonBitmapImage::GetImageSize, Pylon::CPylonImage::GetImageSize

IsUnique#

virtual bool IsUnique() const 

Indicates that the referenced buffer is only referenced by this image.

Return: Returns true if the referenced buffer is only referenced by this image. Returns false if the image is invalid.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::IsUnique, Pylon::CPylonBitmapImage::IsUnique, Pylon::CPylonImage::IsUnique

GetStride#

virtual bool GetStride(
    size_t & strideBytes
) const 

Get the stride in bytes.

Parameters:

  • strideBytes The stride in byte if it can be computed.

Return: Returns true if the stride can be computed.

Error Safety:

Does not throw C++ exceptions.

Reimplemented by: Pylon::CGrabResultImageT::GetStride, Pylon::CPylonBitmapImage::GetStride, Pylon::CPylonImage::GetStride

The stride in bytes can not be computed for packed image format when the stride is not byte aligned. See also Pylon::IsPacked(). The stride in bytes can not be computed if the image is invalid.


Updated on 5 July 2022 at 15:30:01