comparison Orthanc/Core/Images/ImageProcessing.cpp @ 162:f17ecfffdc75

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Jul 2017 11:51:20 +0200
parents 5dc54316d68b
children 330ecfd96aec
comparison
equal deleted inserted replaced
161:4ac039ed55bd 162:f17ecfffdc75
456 } 456 }
457 457
458 return; 458 return;
459 } 459 }
460 460
461 if (target.GetFormat() == PixelFormat_RGB24 &&
462 source.GetFormat() == PixelFormat_BGRA32)
463 {
464 for (unsigned int y = 0; y < source.GetHeight(); y++)
465 {
466 const uint8_t* p = reinterpret_cast<const uint8_t*>(source.GetConstRow(y));
467 uint8_t* q = reinterpret_cast<uint8_t*>(target.GetRow(y));
468 for (unsigned int x = 0; x < source.GetWidth(); x++)
469 {
470 q[0] = p[2];
471 q[1] = p[1];
472 q[2] = p[0];
473 p += 4;
474 q += 3;
475 }
476 }
477
478 return;
479 }
480
461 if (target.GetFormat() == PixelFormat_RGBA32 && 481 if (target.GetFormat() == PixelFormat_RGBA32 &&
462 source.GetFormat() == PixelFormat_RGB24) 482 source.GetFormat() == PixelFormat_RGB24)
463 { 483 {
464 for (unsigned int y = 0; y < source.GetHeight(); y++) 484 for (unsigned int y = 0; y < source.GetHeight(); y++)
465 { 485 {
750 770
751 default: 771 default:
752 throw OrthancException(ErrorCode_NotImplemented); 772 throw OrthancException(ErrorCode_NotImplemented);
753 } 773 }
754 } 774 }
775
776
777 void ImageProcessing::Invert(ImageAccessor& image)
778 {
779 switch (image.GetFormat())
780 {
781 case PixelFormat_Grayscale8:
782 {
783 for (unsigned int y = 0; y < image.GetHeight(); y++)
784 {
785 uint8_t* p = reinterpret_cast<uint8_t*>(image.GetRow(y));
786
787 for (unsigned int x = 0; x < image.GetWidth(); x++, p++)
788 {
789 *p = 255 - (*p);
790 }
791 }
792
793 return;
794 }
795
796 default:
797 throw OrthancException(ErrorCode_NotImplemented);
798 }
799 }
755 } 800 }