# HG changeset patch # User Sebastien Jodogne # Date 1462809392 -7200 # Node ID 9161e3ef0d175d3f21f2334c88974fcd55f7a64d # Parent 361b990b2f0c07c3419fff42b98614450b1ba164 new conversions in ImageProcessing::Convert diff -r 361b990b2f0c -r 9161e3ef0d17 Core/Images/ImageProcessing.cpp --- a/Core/Images/ImageProcessing.cpp Mon May 09 15:59:53 2016 +0200 +++ b/Core/Images/ImageProcessing.cpp Mon May 09 17:56:32 2016 +0200 @@ -438,6 +438,47 @@ return; } + if (target.GetFormat() == PixelFormat_RGB24 && + source.GetFormat() == PixelFormat_Grayscale8) + { + for (unsigned int y = 0; y < source.GetHeight(); y++) + { + const uint8_t* p = reinterpret_cast(source.GetConstRow(y)); + uint8_t* q = reinterpret_cast(target.GetRow(y)); + for (unsigned int x = 0; x < source.GetWidth(); x++) + { + q[0] = *p; + q[1] = *p; + q[2] = *p; + p += 1; + q += 3; + } + } + + return; + } + + if (target.GetFormat() == PixelFormat_RGBA32 && + source.GetFormat() == PixelFormat_Grayscale8) + { + for (unsigned int y = 0; y < source.GetHeight(); y++) + { + const uint8_t* p = reinterpret_cast(source.GetConstRow(y)); + uint8_t* q = reinterpret_cast(target.GetRow(y)); + for (unsigned int x = 0; x < source.GetWidth(); x++) + { + q[0] = *p; + q[1] = *p; + q[2] = *p; + q[3] = 255; + p += 1; + q += 4; + } + } + + return; + } + throw OrthancException(ErrorCode_NotImplemented); }