ColorizeGray example for Delphi
procedure TForm1.Button1Click(Sender: TObject);
var
GrayColors: Array[0..5] of GRAYCOLOR;
begin
// Load the bitmap, keeping the bits per pixel of the file
LEADImage1.Load ('e:\\image1.cmp', 0, 1, 1 );
//Load the grayscale image bitmap, keeping the bits per pixel of the filesource.
LEADImage2.Load ('e:\\image2.cmp', 0, 1, 1 );
LEADImage2.GrayScale( 12 );
GrayColors[0].uThreshold:= 9999;
GrayColors[0].crColor.rgbRed:= 255;
GrayColors[0].crColor.rgbGreen:= 0;
GrayColors[0].crColor.rgbBlue:= 0;
GrayColors[1].uThreshold:= 19999;
GrayColors[1].crColor.rgbRed:= 0;
GrayColors[1].crColor.rgbGreen:= 255;
GrayColors[1].crColor.rgbBlue:= 0;
GrayColors[2].uThreshold:= 29999;
GrayColors[2].crColor.rgbRed:= 0;
GrayColors[2].crColor.rgbGreen:= 0;
GrayColors[2].crColor.rgbBlue:= 255;
GrayColors[3].uThreshold:= 39999;
GrayColors[3].crColor.rgbRed:= 0;
GrayColors[3].crColor.rgbGreen:= 255;
GrayColors[3].crColor.rgbBlue:= 255;
GrayColors[4].uThreshold:= 49999;
GrayColors[4].crColor.rgbRed:= 255;
GrayColors[4].crColor.rgbGreen:= 0;
GrayColors[4].crColor.rgbBlue:= 255;
GrayColors[5].uThreshold:= 59999; // This value will be ignored
GrayColors[5].crColor.rgbRed:= 255;
GrayColors[5].crColor.rgbGreen:= 255;
GrayColors[5].crColor.rgbBlue:= 0;
// Call the method
LEADImage1.ColorizeGray(LEADImage2.Bitmap, @GrayColors, 6 );
end;