IDS peak genericC++ v1.13.0
Loading...
Searching...
No Matches
peak::common::PixelFormatInfo Class Reference

Provides information and utility functions for pixel formats. More...

#include <peak_common/types/peak_common_pixel_format.hpp>

Public Member Functions

 PixelFormatInfo (peak::common::PixelFormat pixelFormat)
 Constructs a PixelFormatInfo object for the specified pixel format.
 PixelFormatInfo (const std::string &name)
 Constructs a PixelFormatInfo object from the name of a pixel format.
template<typename T = size_t>
PEAK_COMMON_NO_DISCARD T GetMinimumValuePerChannel () const
 Returns the minimum possible value per channel for the pixel format.
template<typename T = size_t>
PEAK_COMMON_NO_DISCARD T GetMaximumValuePerChannel () const
 Returns the maximum possible value per channel for the pixel format.
PEAK_COMMON_NO_DISCARD size_t GetStorageBitsPerPixel () const
 Returns the total number of bits used per pixel for storage.
PEAK_COMMON_NO_DISCARD size_t GetStorageBitsPerChannel () const
 Returns the number of bits used per channel for storage.
PEAK_COMMON_NO_DISCARD std::string GetName () const
 Returns the human-readable name of the pixel format.
PEAK_COMMON_NO_DISCARD std::vector< Channel > GetChannels () const
 Returns the list of channels in the pixel format.
PEAK_COMMON_NO_DISCARD size_t GetAllocatedBitsPerPixel () const
 Returns the number of allocated bits per pixel.
PEAK_COMMON_NO_DISCARD bool HasIntensityChannel () const
 Checks whether the pixel format includes an intensity channel.
PEAK_COMMON_NO_DISCARD size_t GetChannelIndex (Channel channel) const
 Returns the index of a specific channel within the pixel format.
PEAK_COMMON_NO_DISCARD size_t GetNumberOfChannels () const
 Returns the total number of channels in the pixel format.
PEAK_COMMON_NO_DISCARD bool IsSingleChannel () const
 Checks whether the pixel format contains only a single channel.
PEAK_COMMON_NO_DISCARD bool HasChannel (Channel channel) const
 Checks whether a specific channel is present in the pixel format.
PEAK_COMMON_NO_DISCARD peak::common::PixelFormat GetPixelFormat () const
 Returns the underlying pixel format enumeration value.
PEAK_COMMON_NO_DISCARD size_t GetSizeInBytes (const Size &size) const
 Calculates the memory size in bytes for a given image size.
PEAK_COMMON_NO_DISCARD bool IsPacked () const
 Returns whether the pixel format is packed.
PEAK_COMMON_NO_DISCARD bool IsFloat () const
 Returns whether the pixel format uses floating points.
PEAK_COMMON_NO_DISCARD PixelFormat GetUnpackedPixelFormat () const
 Returns the unpacked pixel format for a packed pixel format.
template<>
float GetMaximumValuePerChannel () const
 Returns the maximum representable value per channel for floating-point pixel formats.
template<>
size_t GetMaximumValuePerChannel () const
 Returns the maximum representable value per channel for integer pixel formats.
template<>
float GetMinimumValuePerChannel () const
 Returns the minimum representable value per channel for floating-point pixel formats.
template<>
size_t GetMinimumValuePerChannel () const
 Returns the minimum representable value per channel for integer pixel formats.

Detailed Description

Provides information and utility functions for pixel formats.

The PixelFormatInfo class offers methods to query characteristics of specific pixel formats, such as value ranges, storage sizes, and channel configurations.

Since
ids_peak_common 1.0

Constructor & Destructor Documentation

◆ PixelFormatInfo() [1/2]

peak::common::PixelFormatInfo::PixelFormatInfo ( peak::common::PixelFormat pixelFormat)
inlineexplicit

Constructs a PixelFormatInfo object for the specified pixel format.

Parameters
pixelFormatThe pixel format to describe.
Since
ids_peak_common 1.0

◆ PixelFormatInfo() [2/2]

peak::common::PixelFormatInfo::PixelFormatInfo ( const std::string & name)
inlineexplicit

Constructs a PixelFormatInfo object from the name of a pixel format.

Parameters
nameThe name of the pixel format.
Since
ids_peak_common 1.0

Member Function Documentation

◆ GetAllocatedBitsPerPixel()

size_t peak::common::PixelFormatInfo::GetAllocatedBitsPerPixel ( ) const
inline

Returns the number of allocated bits per pixel.

Returns
Number of allocated bits per pixel.
Since
ids_peak_common 1.0

◆ GetChannelIndex()

size_t peak::common::PixelFormatInfo::GetChannelIndex ( Channel channel) const
inline

Returns the index of a specific channel within the pixel format.

Parameters
channelThe channel to locate.
Returns
The zero-based index of the channel.
Since
ids_peak_common 1.0

◆ GetChannels()

std::vector< Channel > peak::common::PixelFormatInfo::GetChannels ( ) const
inline

Returns the list of channels in the pixel format.

Returns
A vector containing the channels present in the pixel format.
Since
ids_peak_common 1.0

◆ GetMaximumValuePerChannel() [1/3]

template<typename T = size_t>
PEAK_COMMON_NO_DISCARD T peak::common::PixelFormatInfo::GetMaximumValuePerChannel ( ) const

Returns the maximum possible value per channel for the pixel format.

Template Parameters
TThe value type (default is size_t).
Returns
The maximum value per channel.
Since
ids_peak_common 1.0

◆ GetMaximumValuePerChannel() [2/3]

template<>
float peak::common::PixelFormatInfo::GetMaximumValuePerChannel ( ) const
inline

Returns the maximum representable value per channel for floating-point pixel formats.

This specialization of GetMaximumValuePerChannel for float retrieves the predefined maximum value per channel for supported 32-bit floating-point pixel formats.

Returns
The maximum channel value as a float.
Exceptions
InvalidParameterExceptionif the current pixel format is not a 32-bit float type. In such cases, use size_t as the template argument instead.
Since
ids_peak_common 1.0

◆ GetMaximumValuePerChannel() [3/3]

template<>
size_t peak::common::PixelFormatInfo::GetMaximumValuePerChannel ( ) const
inline

Returns the maximum representable value per channel for integer pixel formats.

This specialization of GetMaximumValuePerChannel for size_t retrieves the predefined maximum value per channel for supported integer-based pixel formats.

Returns
The maximum channel value as a size_t.
Exceptions
InvalidParameterExceptionif the current pixel format is not an integer type.
Since
ids_peak_common 1.0

◆ GetMinimumValuePerChannel() [1/3]

template<typename T = size_t>
PEAK_COMMON_NO_DISCARD T peak::common::PixelFormatInfo::GetMinimumValuePerChannel ( ) const

Returns the minimum possible value per channel for the pixel format.

Template Parameters
TThe value type (default is size_t).
Returns
The minimum value per channel.
Since
ids_peak_common 1.0

◆ GetMinimumValuePerChannel() [2/3]

template<>
float peak::common::PixelFormatInfo::GetMinimumValuePerChannel ( ) const
inline

Returns the minimum representable value per channel for floating-point pixel formats.

This specialization of GetMinimumValuePerChannel for float retrieves the predefined minimum value per channel for supported 32-bit floating-point pixel formats.

Returns
The minimum channel value as a float.
Exceptions
InvalidParameterExceptionif the current pixel format is not a 32-bit float type. In such cases, use size_t as the template argument instead.
Since
ids_peak_common 1.0

◆ GetMinimumValuePerChannel() [3/3]

template<>
size_t peak::common::PixelFormatInfo::GetMinimumValuePerChannel ( ) const
inline

Returns the minimum representable value per channel for integer pixel formats.

This specialization of GetMinimumValuePerChannel for size_t retrieves the predefined minimum value per channel for supported integer-based pixel formats.

Returns
The minimum channel value as a size_t.
Exceptions
InvalidParameterExceptionif the current pixel format is not an integer type.
Since
ids_peak_common 1.0

◆ GetName()

std::string peak::common::PixelFormatInfo::GetName ( ) const
inline

Returns the human-readable name of the pixel format.

Returns
Name of the pixel format.
Since
ids_peak_common 1.0

◆ GetNumberOfChannels()

size_t peak::common::PixelFormatInfo::GetNumberOfChannels ( ) const
inline

Returns the total number of channels in the pixel format.

Returns
Number of channels.
Since
ids_peak_common 1.0

◆ GetPixelFormat()

peak::common::PixelFormat peak::common::PixelFormatInfo::GetPixelFormat ( ) const
inline

Returns the underlying pixel format enumeration value.

Returns
The pixel format.
Since
ids_peak_common 1.0

◆ GetSizeInBytes()

size_t peak::common::PixelFormatInfo::GetSizeInBytes ( const Size & size) const
inline

Calculates the memory size in bytes for a given image size.

Parameters
sizeThe size of the image.
Returns
The total memory size in bytes.
Since
ids_peak_common 1.0

◆ GetStorageBitsPerChannel()

size_t peak::common::PixelFormatInfo::GetStorageBitsPerChannel ( ) const
inline

Returns the number of bits used per channel for storage.

Returns
Bits per channel used for storage.
Since
ids_peak_common 1.0

◆ GetStorageBitsPerPixel()

size_t peak::common::PixelFormatInfo::GetStorageBitsPerPixel ( ) const
inline

Returns the total number of bits used per pixel for storage.

Returns
Bits per pixel used for storage.
Since
ids_peak_common 1.0

◆ GetUnpackedPixelFormat()

PixelFormat peak::common::PixelFormatInfo::GetUnpackedPixelFormat ( ) const
inline

Returns the unpacked pixel format for a packed pixel format.

If the pixel format is already unpacked, the same format is returned.

Returns
An unpacked pixel format
Since
ids_peak_common 1.1

◆ HasChannel()

bool peak::common::PixelFormatInfo::HasChannel ( Channel channel) const
inline

Checks whether a specific channel is present in the pixel format.

Parameters
channelThe channel to check for.
Returns
True if the channel exists in the pixel format, false otherwise.
Since
ids_peak_common 1.0

◆ HasIntensityChannel()

bool peak::common::PixelFormatInfo::HasIntensityChannel ( ) const
inline

Checks whether the pixel format includes an intensity channel.

Returns
True if an intensity channel is present, false otherwise.
Since
ids_peak_common 1.0

◆ IsFloat()

bool peak::common::PixelFormatInfo::IsFloat ( ) const
inline

Returns whether the pixel format uses floating points.

Returns
Bool whether format uses floating points
Since
ids_peak_common 1.1

◆ IsPacked()

bool peak::common::PixelFormatInfo::IsPacked ( ) const
inline

Returns whether the pixel format is packed.

Returns
Bool whether format is packed
Since
ids_peak_common 1.1

◆ IsSingleChannel()

bool peak::common::PixelFormatInfo::IsSingleChannel ( ) const
inline

Checks whether the pixel format contains only a single channel.

Returns
True if the pixel format is single-channel, false otherwise.
Since
ids_peak_common 1.0

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