diff --git a/src/Nazara/Utility/PixelFormat.cpp b/src/Nazara/Utility/PixelFormat.cpp index 07fc36431..e72e503ba 100644 --- a/src/Nazara/Utility/PixelFormat.cpp +++ b/src/Nazara/Utility/PixelFormat.cpp @@ -258,6 +258,19 @@ namespace } /**********************************BGRA8**********************************/ + template<> + nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) + { + while (start < end) + { + *dst++ = start[3]; + + start += 4; + } + + return dst; + } + template<> nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) { @@ -501,6 +514,19 @@ namespace } /***********************************LA8***********************************/ + template<> + nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) + { + while (start < end) + { + *dst++ = start[1]; + + start += 2; + } + + return dst; + } + template<> nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) { @@ -619,6 +645,25 @@ namespace } /*********************************RGBA4***********************************/ + template<> + nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) + { + while (start < end) + { + nzUInt16 pixel = *reinterpret_cast(start); + + #ifdef NAZARA_BIG_ENDIAN + NzByteSwap(&pixel, sizeof(nzUInt16)); + #endif + + *dst++ = c4to8(pixel & 0x000F); + + start += 2; + } + + return dst; + } + template<> nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) { @@ -783,6 +828,25 @@ namespace } /*********************************RGB5A1**********************************/ + template<> + nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) + { + while (start < end) + { + nzUInt16 pixel = *reinterpret_cast(start); + + #ifdef NAZARA_BIG_ENDIAN + NzByteSwap(&pixel, sizeof(nzUInt16)); + #endif + + *dst++ = static_cast((pixel & 0x1)*0xFF); + + start += 2; + } + + return dst; + } + template<> nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) { @@ -1065,6 +1129,19 @@ namespace } /**********************************RGBA8**********************************/ + template<> + nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) + { + while (start < end) + { + *dst++ = start[3]; + + start += 4; + } + + return dst; + } + template<> nzUInt8* ConvertPixels(const nzUInt8* start, const nzUInt8* end, nzUInt8* dst) { @@ -1219,6 +1296,7 @@ bool NzPixelFormat::Initialize() RegisterConverter(); /**********************************BGRA8**********************************/ + RegisterConverter(); RegisterConverter(); RegisterConverter(); RegisterConverter();/* @@ -1322,6 +1400,7 @@ bool NzPixelFormat::Initialize() RegisterConverter(); /***********************************LA8***********************************/ + RegisterConverter(); RegisterConverter(); RegisterConverter(); RegisterConverter();/* @@ -1339,6 +1418,7 @@ bool NzPixelFormat::Initialize() RegisterConverter(); /**********************************RGBA4**********************************/ + RegisterConverter(); RegisterConverter(); RegisterConverter(); RegisterConverter(); @@ -1356,6 +1436,7 @@ bool NzPixelFormat::Initialize() RegisterConverter(); /*********************************RGB5A1**********************************/ + RegisterConverter(); RegisterConverter(); RegisterConverter(); RegisterConverter(); @@ -1390,6 +1471,7 @@ bool NzPixelFormat::Initialize() RegisterConverter(); /**********************************RGBA8**********************************/ + RegisterConverter(); RegisterConverter(); RegisterConverter(); RegisterConverter();