Added formats conversion

Functor, NonCopyable, Tuple are now parts of NazaraCore (NazaraCore no
longer needs NazaraUtility)
Added loadFormat image parameter (ask loader to load image in specific
format)
Fixed utility project building
It is now possible to convert, get validity or get name of pixel formats
Changed endianness macros' name
Removed useless NazaraEndianness macro
Removed unused files
This commit is contained in:
Lynix
2012-05-24 18:55:48 +02:00
parent 570e0a8070
commit b243d15c74
40 changed files with 1609 additions and 150 deletions

View File

@@ -8,31 +8,65 @@
#define NAZARA_PIXELFORMAT_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/String.hpp>
enum nzPixelFormat
{
nzPixelFormat_Undefined,
nzPixelFormat_B8G8R8,
nzPixelFormat_B8G8R8A8,
nzPixelFormat_BGR8,
nzPixelFormat_BGRA8,
nzPixelFormat_DXT1,
nzPixelFormat_DXT3,
nzPixelFormat_DXT5,
nzPixelFormat_L8,
nzPixelFormat_L8A8,
nzPixelFormat_R4G4A4A4,
nzPixelFormat_R5G5A5A1,
nzPixelFormat_R8,
nzPixelFormat_R8G8,
nzPixelFormat_R8G8B8,
nzPixelFormat_R8G8B8A8
nzPixelFormat_LA8,
/*
nzPixelFormat_RGB16F,
nzPixelFormat_RGB16I,
nzPixelFormat_RGB32F,
nzPixelFormat_RGB32I,
*/
nzPixelFormat_RGBA16F,
nzPixelFormat_RGBA16I,
/*
nzPixelFormat_RGBA32F,
nzPixelFormat_RGBA32I,
*/
nzPixelFormat_RGBA4,
nzPixelFormat_RGB5A1,
nzPixelFormat_RGB8,
nzPixelFormat_RGBA8,
nzPixelFormat_Count
};
class NzUtility;
class NzPixelFormat
{
friend class NzUtility;
public:
typedef nzUInt8* (*ConvertFunction)(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst);
static bool Convert(nzPixelFormat srcFormat, nzPixelFormat dstFormat, const void* src, void* dst);
static bool Convert(nzPixelFormat srcFormat, nzPixelFormat dstFormat, const void* start, const void* end, void* dst);
static nzUInt8 GetBPP(nzPixelFormat format);
static bool IsCompressed(nzPixelFormat format);
static bool IsValid(nzPixelFormat format);
static void SetConvertFunction(nzPixelFormat srcFormat, nzPixelFormat dstFormat, ConvertFunction);
static NzString ToString(nzPixelFormat format);
private:
static bool Initialize();
static void Uninitialize();
static ConvertFunction s_convertFunctions[nzPixelFormat_Count][nzPixelFormat_Count];
};
#include <Nazara/Utility/PixelFormat.inl>