comparison OrthancFramework/Sources/Images/ImageProcessing.cpp @ 4446:19e8540064d8

ImageProcessing::Set(image, r, g, b, a) applicable to grayscale images
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 13 Jan 2021 17:13:42 +0100
parents fd958175c5b9
children 8421b3fc02d7
comparison
equal deleted inserted replaced
4445:5e6b5fef92f8 4446:19e8540064d8
1078 uint8_t p[4]; 1078 uint8_t p[4];
1079 unsigned int size; 1079 unsigned int size;
1080 1080
1081 switch (image.GetFormat()) 1081 switch (image.GetFormat())
1082 { 1082 {
1083 case PixelFormat_Grayscale8:
1084 {
1085 // New in Orthanc 1.9.0
1086 uint8_t grayscale = (2126 * static_cast<uint16_t>(red) +
1087 7152 * static_cast<uint16_t>(green) +
1088 0722 * static_cast<uint16_t>(blue)) / 10000;
1089 Orthanc::ImageProcessing::Set(image, grayscale);
1090 break;
1091 }
1092
1083 case PixelFormat_RGBA32: 1093 case PixelFormat_RGBA32:
1084 p[0] = red; 1094 p[0] = red;
1085 p[1] = green; 1095 p[1] = green;
1086 p[2] = blue; 1096 p[2] = blue;
1087 p[3] = alpha; 1097 p[3] = alpha;