Utility/PixelFormat: Add experimental IdentifyFormat method
Only supports RGBA8 for now Former-commit-id: 8661dc7cab767de5d66efebe5e7038807ba712f7
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_PIXELFORMAT_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Bitset.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
@@ -20,6 +21,34 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct PixelFormatInfo
|
||||
{
|
||||
PixelFormatInfo() :
|
||||
bitsPerPixel(0)
|
||||
{
|
||||
}
|
||||
|
||||
PixelFormatInfo(UInt8 bpp, PixelFormatSubType subType) :
|
||||
bitsPerPixel(bpp),
|
||||
redType(subType),
|
||||
greenType(subType),
|
||||
blueType(subType),
|
||||
alphaType(subType)
|
||||
{
|
||||
}
|
||||
|
||||
// Warning: Bit Endian
|
||||
Bitset<> redMask;
|
||||
Bitset<> greenMask;
|
||||
Bitset<> blueMask;
|
||||
Bitset<> alphaMask;
|
||||
PixelFormatSubType redType;
|
||||
PixelFormatSubType greenType;
|
||||
PixelFormatSubType blueType;
|
||||
PixelFormatSubType alphaType;
|
||||
UInt8 bitsPerPixel;
|
||||
};
|
||||
|
||||
class PixelFormat
|
||||
{
|
||||
friend class Utility;
|
||||
@@ -41,6 +70,8 @@ namespace Nz
|
||||
|
||||
static bool HasAlpha(PixelFormatType format);
|
||||
|
||||
static PixelFormatType IdentifyFormat(const PixelFormatInfo& info);
|
||||
|
||||
static bool IsCompressed(PixelFormatType format);
|
||||
static bool IsConversionSupported(PixelFormatType srcFormat, PixelFormatType dstFormat);
|
||||
static bool IsValid(PixelFormatType format);
|
||||
|
||||
Reference in New Issue
Block a user