GetColorCount Example for Delphi
This example displays a message box showing the number of unique colors in the control's current bitmap.
var
RasterProc: LEADRasterProcess;
szMessage: String; //Buffer for the MessageBox string
NumberOfColors: Longint; //Number of colors in the bitmap
begin
RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;
//Get the number of colors in the bitmap.
NumberOfColors:= RasterProc.GetColorCount (LEADRasterView1.Raster);
//Display the result in a message.
szMessage:= 'The bitmap has ' + IntToStr(NumberOfColors) + ' colors';
MessageBox (Handle, Pchar(szMessage), 'Notice', MB_OK ) ;
end;