Mercurial > hg > orthanc
changeset 2252:002b94046c69
colorspace conversion from BGRA32 to RGB24
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 20 Jan 2017 13:14:30 +0100 |
parents | d623bff7edab |
children | 441352e7a9d1 |
files | Core/Images/ImageProcessing.cpp |
diffstat | 1 files changed, 20 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/Images/ImageProcessing.cpp Fri Jan 20 10:43:50 2017 +0100 +++ b/Core/Images/ImageProcessing.cpp Fri Jan 20 13:14:30 2017 +0100 @@ -458,6 +458,26 @@ return; } + if (target.GetFormat() == PixelFormat_RGB24 && + source.GetFormat() == PixelFormat_BGRA32) + { + for (unsigned int y = 0; y < source.GetHeight(); y++) + { + const uint8_t* p = reinterpret_cast<const uint8_t*>(source.GetConstRow(y)); + uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y)); + for (unsigned int x = 0; x < source.GetWidth(); x++) + { + q[0] = p[2]; + q[1] = p[1]; + q[2] = p[0]; + p += 4; + q += 3; + } + } + + return; + } + if (target.GetFormat() == PixelFormat_RGBA32 && source.GetFormat() == PixelFormat_RGB24) {