Article | 60001039 |
Type | Wish |
Product | Engine |
Version | 6016 |
Date Added | 12/17/2009 |
Fixed | Yes [12/18/2009] |
Submitted by | Dominique PREMILLIEU |
Keywords |
In 6017 new methods was added for vdImageDef object:
///
/// Returns the Palette of the selected Bitmap or null if the bitmap is not ColorIndexed.
///
///
Color[] GetPalette()
///
/// Select a new palette for the selected image.
///
/// An array of colors that defines the palette.
///
///
/// The number of colors in the input palette must be the same length with the palette that used from the selected bitmap.
///
bool SelectPalette(Color[] colorPalette)
Example:
//Supose that we have add an 1bpp Bitmap in the Images colllection with Black and White palette
//Following code will make the image embeded in the drawing and it will change the palette to Blue and Red background
if (doc.Images.Count == 0) return;
vdImageDef imagedef = doc.Images[0];
imagedef.InternalSetBytes(new VectorDraw.Geometry.ByteArray(imagedef.Image.GetImageBytes(true)));
Color[] palette = imagedef.GetPalette();
if (palette != null && palette.Length == 2)
{
palette[0] = Color.Blue;
palette[1] = Color.Red;
bool test = imagedef.SelectPalette(palette);
}
imagedef.Update();
doc.Redraw(true);