Available in the LEADTOOLS Imaging toolkit. |
UserPalette and BitmapPalette example for C++ 4.0 and later
This example demonstrates the UserPalette and BitmapPalette properties.
// Specify a blue and white user palette
m_Lead1.SetUserPalette(0, RGB(0, 0, 255));
m_Lead1.SetUserPalette(1, RGB(255, 255, 255));
// Implement the user palette
m_Lead1.ColorRes(1, CRP_USERPALETTE, CRD_ORDEREDDITHERING, 2);
// Display the blue and white image
m_Lead1.ForceRepaint();
MessageBox("This is the user palette. Click OK to change the bitmap palette.");
// Change the bitmap palette to red and white
m_Lead1.SetBitmapPalette(0, RGB(255, 0, 0));
m_Lead1.SetBitmapPalette(1, RGB(255, 255, 255));
// Display the red and white image
m_Lead1.ForceRepaint();