Available in the LEADTOOLS Imaging toolkit. |
UserPalette and BitmapPalette example for Visual J++
This example demonstrates the UserPalette and BitmapPalette properties.
// Specify a blue and white user palette
LEAD1.setUserPalette( (short) 0, new Color( 0, 0, 255 ) );
LEAD1.setUserPalette( (short) 1, new Color( 255, 255, 255 ) );
// Implement the user palette
LEAD1.ColorRes( (short) 1, (short) LTOCXU.ColorResPaletteConstants.CRP_USERPALETTE, (short) LTOCXU.ColorResDitherConstants.CRD_ORDEREDDITHERING, (short) 2 );
// Display the blue and white image
LEAD1.ForceRepaint();
MessageBox.show( "This is the user palette. Click OK to change the bitmap palette." );
// Change the bitmap palette to red and white
LEAD1.setBitmapPalette( (short) 0, new Color( 255, 0, 0 ) );
LEAD1.setBitmapPalette( (short) 1, new Color( 255, 255, 255 ) );
// Display the red and white image
LEAD1.ForceRepaint();