Class IDecoder#

Class Documentation#

class IDecoder#

The interface used for operating image decoder. That is the simplest possible interface at this point…

Public Functions

virtual std::shared_ptr<libCZI::IBitmapData> Decode(const void *ptrData, size_t size, const libCZI::PixelType *pixelType, const std::uint32_t *width, const std::uint32_t *height, const char *additional_arguments = nullptr) = 0#

Passing in a block of raw data, decode the image and return a bitmap object.

Remark

This method is intended to be called concurrently, implementors should make no assumption about concurrency. The parameters pixelType, width and height are used for validation purposes only. The decoder is expected to check whether the data passed in is of the expected type and size. If not, it should throw an exception. If instead nullptr is passed for any of pixelType, width or height, then this means that this parameter is not to be validated. The decoder is expected to decode the data and return a bitmap object.

Remark

In case of an error (of whatever kind) the method is expected to throw an exception.

Parameters:
  • ptrData – Pointer to a block of memory (which contains the encoded image).

  • size – The size of the memory block pointed by ptrData.

  • pixelType – If non-null, the pixel type of the expected bitmap.

  • width – If non-null, the width of the expected bitmap.

  • height – If non-null, the height of the expected bitmap.

  • additional_arguments – If non-null, additional arguments for the decoder. This is a null-terminated string, where the syntax is class-specific.

Returns:

A bitmap object with the decoded data.

virtual ~IDecoder() = default#
inline std::shared_ptr<libCZI::IBitmapData> Decode(const void *ptrData, size_t size, libCZI::PixelType pixelType, std::uint32_t width, std::uint32_t height, const char *additional_arguments = nullptr)#

Decodes the specified data and returns a bitmap object. This is a convenience method, where the parameters pixelType, width and height are passed in as references and as required parameters (as opposed to optional).

Parameters:
  • ptrData – Pointer to a block of memory (which contains the encoded image).

  • size – The size of the memory block pointed by ptrData.

  • pixelType – The pixel type which is expected.

  • width – The width which is expected.

  • height – The height which is expected.

  • additional_arguments – If non-null, additional arguments for the decoder. This is a null-terminated string, where the syntax is defined class specifically.

Returns:

A bitmap object with the decoded data.