typedef struct _GRAYCOLOR 
   L_UINT uStructSize; 
   RGBQUAD crColor; 
   L_UINT uThreshold; 

The LTGRAYCOLOR structure contains information about gray color intensities (uThreshold) and the associated colors (crColor) used in coloration function L_ColorizeGrayBitmap.


L_ColorizeGrayBitmap uses an array of these structures with its length being a user-defined number. If the array has N entries, then:

Intensity Range


0 ~ uThreshold[0]


uThreshold[0] + 1 ~ uThreshold[1]


uThreshold[1] + 1 ~ uThreshold[2]




uThreshold[N-3] + 1 ~ uThreshold[N-2]


uThreshold[N-2] + 1 ~ uThreshold[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 an 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.

This structure is used by L_ColorizeGrayBitmap function.

Help Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help