UserPalette and BitmapPalette example for C++ 5.0 and later
This example demonstrates the UserPalette and BitmapPalette properties.
ILEADRasterProcess *pRasterProc=NULL;
CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL,
IID_ILEADRasterProcess, (void**)&pRasterProc);
// Specify a blue and white user palette
pRasterProc->PutUserPalette(0, RGB(0, 0, 255));
pRasterProc->PutUserPalette(1, RGB(255, 255, 255));
// Implement the user palette
pRasterProc->ColorRes(m_LEADRasterView1.GetRaster(),
1, CRP_USERPALETTE,
CRD_ORDEREDDITHERING, 2);
// Display the blue and white image
m_LEADRasterView1.ForceRepaint();
MessageBox(TEXT("This is the user palette. Click OK to change the bitmap palette."));
// Change the bitmap palette to red and white
m_LEADRasterView1.GetRaster().SetBitmapPalette(0, RGB(255, 0, 0));
m_LEADRasterView1.GetRaster().SetBitmapPalette(1, RGB(255, 255, 255));
// Display the red and white image
m_LEADRasterView1.ForceRepaint();