# HG changeset patch # User Sebastien Jodogne # Date 1476107756 -7200 # Node ID 1554fc153a93d930ed600ae51aca9224c48f94ef # Parent 7d184e11043eec48f6e067400516e4808cad823f conversion RGB24 to BGRA32 diff -r 7d184e11043e -r 1554fc153a93 Core/Images/ImageProcessing.cpp --- a/Core/Images/ImageProcessing.cpp Thu Oct 06 17:28:43 2016 +0200 +++ b/Core/Images/ImageProcessing.cpp Mon Oct 10 15:55:56 2016 +0200 @@ -519,6 +519,27 @@ return; } + if (target.GetFormat() == PixelFormat_BGRA32 && + source.GetFormat() == PixelFormat_RGB24) + { + 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[2]; + q[1] = p[1]; + q[2] = p[0]; + q[3] = 255; + p += 3; + q += 4; + } + } + + return; + } + throw OrthancException(ErrorCode_NotImplemented); }