The LTGRAYCOLOR structure contains information about gray color intensities (uThreshold) and the associated colors (crColor) used in coloration function LBitmap::ColorizeGray.
Size of the structure. Use sizeof(LTGRAYCOLOR).
The RGB color used for coloring the specified range of intensities set in uThreshold. crColor.rgbReserved is ignored.
The maximum value of the pixels which will be colored with this color. The pixels with a value smaller than this will have the color crColor. If the LTGRAYCOLOR structure is the last in the pLTGRAYCOLORs array, then this value is ignored and the maximum possible value will be used instead.
The maximum value depends on the image bits per pixel. For 8, 12 and 16-bit images the maximum value is 255, 4095 and 65535 respectively. However if you enter a value higher than the maximum, the value will be clipped at the maximum value.
LBitmap::ColorizeGray uses an array of these structures with its length being a user-defined number. If the array has N entries, then:
Intensity Range | Color |
---|---|
0 ~ uThreshold[0] | crColor[0] |
uThreshold[0] + 1 ~ uThreshold[1] | crColor[1] |
uThreshold[1] + 1 ~ uThreshold[2] | crColor[2] |
uThreshold[N-3] + 1 ~ uThreshold[N-2] | crColor[N-2] |
uThreshold[N-2] + 1 ~ uThreshold[N-1] | crColor[N-1] |
Notice that the uThreshold[N-1] value will be ignored and instead will be treated as a value equal to 255, 4095 and 65535 for 8, 12 and 16-bit images respectively.
Although it is not a requirement, it is recommended that uThreshold[0] < uThreshold[1] < uThreshold[2] < < uThreshold[N-2] < uThreshold[N-1]. Consider the following example with a LTGRAYCOLOR structure of 4 entries for a 12-Bit gray bitmap, where this recommendation is not followed:
uThreshold[0] = 1000; //crColor is Red.
uThreshold[1] = 3000; //crColor is Green.
uThreshold[2] = 2000; //crColor is Blue. - Notice the threshold here.
uThreshold[3] = 4000; //crColor is Yellow.
In this case, pixel intensities from 0 to 1000 will be colored as Red, pixels 1001 to 3000 will be colored as Green, pixels 3001 to 4000 will be colored as Yellow, pixels from 4001 till the last possible intensity will be colored as Yellow too.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document