Board index » cppbuilder » 256 colour palettes, I'm BEGGING for some help

256 colour palettes, I'm BEGGING for some help

I've spent the last 3 days trying to set the colours of an 8 bit palette
so I can have a lovely gradient.

I've tried getting a pointer to the Bitmap->Palette and making an array
to loop for then pointing the Bitmap->Palette to my array.

I've tried all manner of these CreatePalette(), SelectPalette(),
RealizePalette(), creating LOGPALLETE's arrays of PALET{*word*249}TRY's

I've spent hours surfing websites DLing sources and tutorials looking
for help, I'm dreading my next phone bill. :(

NOTHING has worked, I've witnessed some of the most spectacular crashes
and system lockups I've ever seen.

Can someone PLEASE help me?????????

Surely someone somewhere must have a small project that just sets the
colours of a 256 palette, right??

--
David Jenkins

 

Re:256 colour palettes, I'm BEGGING for some help


I've found out how to alter the palette, sort of. :)

 int I;

 PALET{*word*249}TRY MyPal[256];
 HPALETTE APal;
 APal = Buffer->ReleasePalette();
 GetPalet{*word*249}tries(APal, 0, 256, MyPal);
 ResizePalette(APal, 256);

 Byte R, G, B;
 R = 0;
 G = 0;
 B = 0;
 for(I = 0; I < 255; I++)
 {
    R++;
    G++;
    B++;
    MyPal[I].peRed = R;
    MyPal[I].peGreen = G;
    MyPal[I].peBlue = B;
    MyPal[I].peFlags = NULL;
 }
 SetPalet{*word*249}tries(APal, 0, 256, MyPal);
 Buffer->Palette = APal;

Using the above I can create a lovely gradient from black to white.
But if I try changing it to something like this,

 Byte R, G, B;
 R = 0;
 G = 0;
 B = 255;
 for(I = 0; I < 255; I++)
 {
    R++;
    G++;
    B--;
    MyPal[I].peRed = R;
    MyPal[I].peGreen = G;
    MyPal[I].peBlue = B;
    MyPal[I].peFlags = NULL; // PC_EXPLICIT;
 }

I should get a gradient with different colours, the blue components
being the opposite intensity to the R and G components.
But it doesn't, all I get are 7 different colours, repeating across my
palette,
light blue
dark blue
yellowy blue
more yellowy than blue
dull yellow
dark yellow
yellow
and bright yellow.

Anyone know what's going on??

--
David Jenkins

Re:256 colour palettes, I'm BEGGING for some help


Ignore my last post on this subject, I've sorted it now.
I was using an 8 bit display, switching to 16 bit display fixed
everything.

--
David Jenkins

Other Threads