Utility/PixelFormat: Add experimental IdentifyFormat method

Only supports RGBA8 for now


Former-commit-id: 8661dc7cab767de5d66efebe5e7038807ba712f7
This commit is contained in:
Lynix
2016-04-21 13:22:31 +02:00
parent e5f5d7ed11
commit 718713dbdd
2 changed files with 47 additions and 0 deletions

View File

@@ -1268,6 +1268,22 @@ namespace Nz
}
}
PixelFormatType PixelFormat::IdentifyFormat(const PixelFormatInfo& info)
{
switch (info.bitsPerPixel)
{
case 32:
if (info.redMask == Bitset<>(0xFF000000) &&
info.greenMask == Bitset<>(0x00FF0000) &&
info.blueMask == Bitset<>(0x0000FF00) &&
info.alphaMask == Bitset<>(0x000000FF))
return PixelFormatType_RGBA8;
break;
}
return PixelFormatType_Undefined;
}
bool PixelFormat::Initialize()
{
// Réinitialisation