Mercurial > hg > orthanc-wsi
diff Resources/Orthanc/Core/Images/ImageProcessing.cpp @ 107:a3e8ac8b7256
support for OpenBSD
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Aug 2017 11:10:48 +0200 |
parents | 16b8e1cc9bbf |
children | a18bfe1fdd62 |
line wrap: on
line diff
--- a/Resources/Orthanc/Core/Images/ImageProcessing.cpp Wed Mar 22 15:53:48 2017 +0100 +++ b/Resources/Orthanc/Core/Images/ImageProcessing.cpp Wed Aug 23 11:10:48 2017 +0200 @@ -772,4 +772,29 @@ throw OrthancException(ErrorCode_NotImplemented); } } + + + void ImageProcessing::Invert(ImageAccessor& image) + { + switch (image.GetFormat()) + { + case PixelFormat_Grayscale8: + { + for (unsigned int y = 0; y < image.GetHeight(); y++) + { + uint8_t* p = reinterpret_cast<uint8_t*>(image.GetRow(y)); + + for (unsigned int x = 0; x < image.GetWidth(); x++, p++) + { + *p = 255 - (*p); + } + } + + return; + } + + default: + throw OrthancException(ErrorCode_NotImplemented); + } + } }