pixelformat: added convenience function for whether a format is float or not
This commit is contained in:
@@ -48,6 +48,27 @@ bool PixelFormat::FormatHasAlphaChannel(const PixelFormat::Format &format)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PixelFormat::FormatIsFloat(const PixelFormat::Format &format)
|
||||
{
|
||||
switch (format) {
|
||||
case PixelFormat::PIX_FMT_RGB16F:
|
||||
case PixelFormat::PIX_FMT_RGBA16F:
|
||||
case PixelFormat::PIX_FMT_RGB32F:
|
||||
case PixelFormat::PIX_FMT_RGBA32F:
|
||||
return true;
|
||||
|
||||
case PixelFormat::PIX_FMT_RGB8:
|
||||
case PixelFormat::PIX_FMT_RGBA8:
|
||||
case PixelFormat::PIX_FMT_RGB16U:
|
||||
case PixelFormat::PIX_FMT_RGBA16U:
|
||||
case PixelFormat::PIX_FMT_INVALID:
|
||||
case PixelFormat::PIX_FMT_COUNT:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
OIIO::TypeDesc::BASETYPE PixelFormat::GetOIIOTypeDesc(const PixelFormat::Format &format)
|
||||
{
|
||||
switch (format) {
|
||||
|
||||
@@ -114,6 +114,11 @@ public:
|
||||
*/
|
||||
static bool FormatHasAlphaChannel(const Format& format);
|
||||
|
||||
/**
|
||||
* @brief Simple convenience function returning whether a pixel format is float-based or integer-based
|
||||
*/
|
||||
static bool FormatIsFloat(const Format& format);
|
||||
|
||||
/**
|
||||
* @brief Get corresponding OpenImageIO TypeDesc for a given pixel format
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user