UserPalette and BitmapPalette example for C++ Builder
This example demonstrates the UserPalette and BitmapPalette properties.
LEADRasterProcess* pRasterProc= NULL;
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);
//Specify a blue and white user palette
pRasterProc->set_UserPalette (0, RGB(0, 0, 255));
pRasterProc->set_UserPalette(1, RGB(255, 255, 255));
//Implement the user palette
pRasterProc->ColorRes (LEADRasterView1->Raster, 1, CRP_USERPALETTE, CRD_ORDEREDDITHERING, 2);
//Display the blue and white image
LEADRasterView1->ForceRepaint ();
ShowMessage ("This is the user palette. Click OK to change the bitmap palette.");
//Change the bitmap palette to red and white
LEADRasterView1->Raster->set_BitmapPalette (0, RGB(255, 0, 0));
LEADRasterView1->Raster->set_BitmapPalette(1, RGB(255, 255, 255));
//Display the red and white image
LEADRasterView1->ForceRepaint ();
pRasterProc-> Release( );