Mercurial > hg > orthanc
diff Core/ImageFormats/ImageProcessing.cpp @ 1610:2dff2bdffdb8
font support within Orthanc
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 04 Sep 2015 13:44:21 +0200 |
parents | adc6a5704cdb |
children |
line wrap: on
line diff
--- a/Core/ImageFormats/ImageProcessing.cpp Wed Sep 02 15:07:47 2015 +0200 +++ b/Core/ImageFormats/ImageProcessing.cpp Fri Sep 04 13:44:21 2015 +0200 @@ -378,6 +378,25 @@ return; } + if (target.GetFormat() == PixelFormat_Grayscale8 && + source.GetFormat() == PixelFormat_RGBA32) + { + 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++) + { + *q = static_cast<uint8_t>((2126 * static_cast<uint32_t>(p[0]) + + 7152 * static_cast<uint32_t>(p[1]) + + 0722 * static_cast<uint32_t>(p[2])) / 10000); + p += 4; + } + } + + return; + } + if (target.GetFormat() == PixelFormat_RGB24 && source.GetFormat() == PixelFormat_RGBA32) {