Class Compositors#

Nested Relationships#

Nested Types#

Class Documentation#

class Compositors#

Composition operations are found in this class: multi-tile compositor and multi-channel compositor.

Public Static Functions

static void ComposeSingleChannelTiles(const std::function<bool(int index, std::shared_ptr<libCZI::IBitmapData> &src, int &x, int &y)> &getTiles, libCZI::IBitmapData *dest, int xPos, int yPos, const ComposeSingleTileOptions *pOptions)#

Composes a set of tiles (which are retrieved by calling the getTiles-functor) in the following way: The destination bitmap is taken to be positioned at (xPos,yPos) - which specifies the top-left corner. The tiles (retrieved from the functor) are positioned at the coordinate as reported by the functor-call. Then the intersection area of source and destination is copied to the destination bitmap. If the intersection is empty, then nothing is copied.

Parameters:
  • getTiles – [in] The functor which is called in order to retrieve the tiles to compose. The second and the third parameter specify the x- and y-position of this tile. We address a tile with the parameter index. If the index is out-of-range, then this functor is expected to return false.

  • dest – [in,out] The destination bitmap.

  • xPos – The x-coordinate of the top-left of the destination bitmap.

  • yPos – The y-coordinate of the top-left of the destination bitmap.

  • pOptions – Options for controlling the operation. This argument is optional (may be nullptr).

static void ComposeMultiChannel_Bgr24(libCZI::IBitmapData *dest, int channelCount, libCZI::IBitmapData *const *srcBitmaps, const ChannelInfo *channelInfos)#

Create the multi-channel-composite - applying tinting or gradation to the specified bitmaps and write the result to the specified destination bitmap. All source bitmaps must have same width and height, and the destination bitmap also has to have this same width/height. The pixeltype of the destination bitmap must be Bgr24.

Parameters:
  • dest[in] The destination bitmap - must have same width/height as the source bitmaps and must be Bgr24.

  • channelCount – The number of channels.

  • srcBitmaps – An array of source bitmaps. The array must contain as many elements as specified by channelCount.

  • channelInfos – An array of channelInfo for the source channels. The array must contain as many elements as specified by channelCount.

static void ComposeMultiChannel_Bgra32(libCZI::IBitmapData *dest, std::uint8_t alphaVal, int channelCount, libCZI::IBitmapData *const *srcBitmaps, const ChannelInfo *channelInfos)#

Create the multi-channel-composite - applying tinting or gradation to the specified bitmaps and write the result to the specified destination bitmap. All source bitmaps must have same width and height, and the destination bitmap also has to have this same width/height. The pixeltype of the destination bitmap must be Bgra32. The value of the parameter ‘alphaVal’ is written to all alpha-pixels in the destination.

Parameters:
  • dest[in] The destination bitmap - must have same width/height as the source bitmaps and must be Bgra32.

  • alphaVal – The alpha value.

  • channelCount – The number of channels.

  • srcBitmaps – An array of source bitmaps. The array must contain as many elements as specified by channelCount.

  • channelInfos – An array of channelInfo for the source channels. The array must contain as many elements as specified by channelCount.

static std::shared_ptr<IBitmapData> ComposeMultiChannel_Bgr24(int channelCount, libCZI::IBitmapData *const *srcBitmaps, const ChannelInfo *channelInfos)#

Create the multi-channel-composite - applying tinting or gradation to the specified bitmaps and write the result to a newly allocated destination bitmap. All source bitmaps must have same width and height, and the destination bitmap will also have this same width/height. The pixeltype of the destination bitmap will be Bgr24.

Parameters:
  • channelCount – The number of channels.

  • srcBitmaps – An array of source bitmaps. The array must contain as many elements as specified by channelCount.

  • channelInfos – An array of channelInfo for the source channels. The array must contain as many elements as specified by channelCount.

Returns:

A std::shared_ptr<IBitmapData>.

static std::shared_ptr<IBitmapData> ComposeMultiChannel_Bgra32(std::uint8_t alphaVal, int channelCount, libCZI::IBitmapData *const *srcBitmaps, const ChannelInfo *channelInfos)#

Create the multi-channel-composite - applying tinting or gradation to the specified bitmaps and write the result to a newly allocated destination bitmap. All source bitmaps must have same width and height, and the destination bitmap will also have this same width/height. The pixeltype of the destination bitmap will be Bgra32, and each alpha-pixel-value will be set to ‘alphaVal’.

Parameters:
  • alphaVal – The alpha value.

  • channelCount – The number of channels.

  • srcBitmaps – An array of source bitmaps. The array must contain as many elements as specified by channelCount.

  • channelInfos – An array of channelInfo for the source channels. The array must contain as many elements as specified by channelCount.

Returns:

A std::shared_ptr<IBitmapData>.

static inline std::shared_ptr<IBitmapData> ComposeMultiChannel_Bgr24(int channelCount, std::vector<std::shared_ptr<libCZI::IBitmapData>>::iterator srcBitmapsIterator, const ChannelInfo *channelInfos)#

Create the multi-channel-composite - applying tinting or gradation to the specified bitmaps and write the result to the specified destination bitmap. All source bitmaps must have same width and height, and the destination bitmap also has to have this same width/height. The pixeltype of the destination bitmap must be Bgr24.

Parameters:
  • channelCount – Number of channels.

  • srcBitmapsIterator – Source bitmaps iterator.

  • channelInfos – An array of channelInfo for the source channels. The array must contain as many elements as specified by channelCount.

Returns:

A std::shared_ptr<IBitmapData>.

static inline std::shared_ptr<IBitmapData> ComposeMultiChannel_Bgra32(std::uint8_t alphaVal, int channelCount, std::vector<std::shared_ptr<libCZI::IBitmapData>>::iterator srcBitmapsIterator, const ChannelInfo *channelInfos)#

Create the multi-channel-composite - applying tinting or gradation to the specified bitmaps and write the result to the specified destination bitmap. All source bitmaps must have same width and height, and the destination bitmap also has to have this same width/height. The pixeltype of the destination bitmap must be Bgra32.

Parameters:
  • alphaVal – The alpha value.

  • channelCount – Number of channels.

  • srcBitmapsIterator – Source bitmaps iterator.

  • channelInfos – An array of channelInfo for the source channels. The array must contain as many elements as specified by channelCount.

Returns:

A std::shared_ptr<IBitmapData>.

struct ChannelInfo#

Information about a channel for use in the multi-channel-composition operation. The gradation to be applied can be specified in two ways: either the black-point and white-point is provided, and the gradation curve is a straight line (between black-point and white-point) or a look-up table is used. In case of a look-up table being specified, black-point/white-point is not used. The size of the look-up table must match exactly the bits in this channels, so far a Gray8/Bgr24 it must be of size 256 and for Gray16/Bgr48 is must be of size 65536.

Public Functions

inline void Clear()#

All members are set to zero.

Public Members

float weight#

The weight of the channel.

bool enableTinting#

True if tinting is enabled for this channel (in which case the tinting member is to be examined), false if no tinting is to be applied (the tinting member is then not used).

TintingColor tinting#

The tinting color (only examined if enableTinting is true).

float blackPoint#

The black point - it is a float between 0 and 1, where 0 corresponds to the lowest pixel value (of the pixeltype for the channel) and 1 to the highest pixel value (of the pixeltype of this channel). All pixel values below the black point are mapped to 0.

float whitePoint#

The white point - it is a float between 0 and 1, where 0 corresponds to the lowest pixel value (of the pixeltype for the channel) and 1 to the highest pixel value (of the pixeltype of this channel). All pixel value above the white pointer are mapped to the highest pixel value.

int lookUpTableElementCount#

Number of elements in the look-up table. If 0, then the look-up table is not used. If this channelInfo applies to a Gray8/Bgr24-channel, then the size of the look-up table must be 256. In case of a Gray16/Bgr48-channel, the size must be 65536.

Remark

If a look-up table is provided, then blackPoint and whitePoint are not used anymore .

const std::uint8_t *ptrLookUpTable#

The pointer to the look-up table. If lookUpTableElementCount is <> 0, then this pointer must be valid.

struct ComposeSingleTileOptions#

Options for the libCZI::Compositors::ComposeSingleChannelTiles function.

Public Functions

inline void Clear()#

Clears this object to its blank/initial state.

Public Members

bool drawTileBorder#

If true, then a one-pixel wide boundary will be drawn around each tile (in black color).

struct TintingColor#

This structure defines the tinting color.

Public Members

Rgb8Color color#

The tinting color to be used given as RGB24.