Click to See Complete Forum and Search --> : ColorPalette GDI+ VC++


LairdTurner
October 11th, 2005, 04:38 AM
Hello!

I've got a Indexed Bitmap with eight colors and want to change the Colors.
First I make a Palette where I can "steal" the Palette to assign it to the original Bitmap:

Bitmap* bitmap;
bitscolordepth = PixelFormat8bppIndexed;
bitmap = new Bitmap(1, 1, bitscolordepth);
ColorPalette pal;
int groesse;
bitmap->GetPalette(&pal,groesse);

But the ColorPalette.Enties[] has only one color!!!
When I'm looking in the struct he shows me Flags=4 and Count=256, but why are only one color in the Entries Array!?

I've tried another way and changed the code a little bit in the way to malloc memory for the ColorPalette:

ColorPalette* pal = (ColorPalette*)malloc(sizeof(ColorPalette) + 256*sizeof(ARGB));

But I get the same result. Only one Color!!!
Hope you can help me!
Thanks!


best regards

René