UserPalette and BitmapPalette example for Delphi
This example demonstrates the UserPalette and BitmapPalette properties.
var
sRet: Smallint;
RasterProc: LEADRasterProcess;
begin
RasterProc:= CreateComObject (CLASS_LEADRasterProcess) as LEADRasterProcess;
//Specify a blue and white user palette
RasterProc.UserPalette [0] := RGB(0, 0, 255);
RasterProc.UserPalette[1] := RGB(255, 255, 255);
//Implement the user palette
RasterProc.ColorRes (LEADRasterView1.Raster, 1, CRP_USERPALETTE, CRD_ORDEREDDITHERING, 2);
//Display the blue and white image
LEADRasterView1.ForceRepaint (sRet);
ShowMessage ('This is the user palette. Click OK to change the bitmap palette.');
//Change the bitmap palette to red and white
LEADRasterView1.Raster.BitmapPalette [0] := RGB(255, 0, 0);
LEADRasterView1.Raster.BitmapPalette[1] := RGB(255, 255, 255);
//Display the red and white image
LEADRasterView1.ForceRepaint (sRet);
end;