This has got me stumped, and I cannot google anything to help me. I`m trying to set the palette of a TDirectDrawSurface.
Code:
DXFont8: TDirectDrawSurface;
FlickPal: TDirectDrawPalette;
FlickPalEntries: Array[0..255] of TPaletteEntry;
Code:
procedure TForm1.DXDraw1Initialize(Sender: TObject);
begin
DXFont8:=TDirectDrawSurface.Create(DXDraw1.DDraw);
DXFont8.LoadFromGraphic(DxImageList1.Items.Find('robotron_font8').Picture.Graphic);
FlickPal:=TDirectDrawPalette.Create(DXFont8.DDraw);
FlickPal.CreatePalette(DDPCAPS_8BIT or DDPCAPS_INITIALIZE or DDPCAPS_ALLOW256,FlickPalEntries);
...
Then I try to draw the surface to the backbuffer (16 bit)
Code:
// try this?
FlickPal.Entries[0]:=RGBQuadToPaletteEntry(RGBQuad(255, 255, 255));
FlickPal.Entries[1]:=RGBQuadToPaletteEntry(RGBQuad(0, 0, 0));
// or try this?
FlickPalEntries[0]:=RGBQuadToPaletteEntry(RGBQuad(255, 0, 0));
FlickPalEntries[1]:=RGBQuadToPaletteEntry(RGBQuad(0, 0, 0));
FlickPal.SetEntries(0, 256, FlickPalEntries);
DXFont8.Palette:=FlickPal;
DXDraw1.Surface.Draw(px+(x*8), py, rect(lChar,0,lChar+8,7), DXFont8, False);
But the same (original) palette is effective.
No errors are returned from the palette creation or setting, but just doesn't take effect.
Bookmarks