Converting 16-bit Grayscale Values

If you want to use a 16-bit grayscale value in a non LEADTOOLS procedure, you need to convert the value as follows:

COLORREF color;
unsigned char gray;

color = Pixel(x,y);
if (color & COLORREF_GRAY16)
{ /*non standard colorref value, convert it to a windows COLORREF
get an 8 bit gray value corresponding to the 16 bit gray value */
gray = (color & 0xFFFF) >> 8;
/* use the standard windows RGB macro to get a windows COLORREF */
color = RGB(gray, gray, gray);
}

Please note that this is pseudocode and will have to be modified to suit the compiler you are using.