source/Graphics/Image/IcoFormat.cpp: use new PixelFormat. source/Graphics/Image.cpp: update to confirm with new PixelFormat Spectre/Graphics/PixelFormat: add PF_getNumChannels() Spectre/Graphics/PixelFormat: Rework the enum with proper naming convention and documentation.
26 lines
498 B
C++
26 lines
498 B
C++
|
|
#include <Spectre/Graphics/PixelFormat.h>
|
|
|
|
namespace sp {
|
|
|
|
uint8_t PF_getNumChannels(enum PixelFormat format)
|
|
{
|
|
switch(format) {
|
|
case PixelFormat::PF_RGBA :
|
|
case PixelFormat::PF_RGBA32 :
|
|
case PixelFormat::PF_BGRA :
|
|
case PixelFormat::PF_BGRA32 :
|
|
return 4;
|
|
case PixelFormat::PF_RGB :
|
|
case PixelFormat::PF_RGBX :
|
|
case PixelFormat::PF_RGBX32 :
|
|
case PixelFormat::PF_BGR :
|
|
case PixelFormat::PF_BGRX :
|
|
case PixelFormat::PF_BGRX32 :
|
|
return 3;
|
|
default :
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
} // namespace sp
|