LTGRAYCOLOR

Summary

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

Syntax

typedef struct _LTGRAYCOLOR 
{ 
   L_UINT uStructSize; 
   RGBQUAD crColor; 
   L_UINT uThreshold; 
} 
LTGRAYCOLOR, * pLTGRAYCOLOR; 

Members

uStructSize

Size of the structure. Use sizeof(LTGRAYCOLOR).

crColor

The RGB color used for coloring the specified range of intensities set in uThreshold. crColor.rgbReserved is ignored.

uThreshold

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.

Comments

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.

Usage

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.