Autor Beitrag
MKehrer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114

NT, 2000
D6
BeitragVerfasst: Mi 24.09.03 17:14 
Hi Delphianer,

Da häng ich jetzt schon ein Stunde
hat da jemand vielleicht ein Beispiel für mich?

Die Zuweisung von TLogPalette.palPalEnrtry schluckt mir der Compiler einfach nicht.

Danke für die Mühe

_________________
Manfred
Was Du siehst ist in Dir (Smile)
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: So 28.09.03 19:48 
Hallo,

schau mal in DELPHIDIR\Help\Examples\Bitmap.

Außerdem: eine selbergecodete Methode, um einem Bitmap eine 8Bit-Palette zuzuweisen:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
procedure CreatePalette256(Bitmap: TBitmap; Colors: array of TColor);
var
  I: Integer;
  H: HPalette;
  P: PLogPalette;
begin
  Bitmap.PixelFormat := pf8Bit;

  GetMem(P, SizeOf(TLogPalette) + (SizeOf(TPaletteEntry) * 254));

  P.palVersion := $300;
  P.palNumEntries := 256;

  for I := 0 To 255 do
  begin
    if I <= High(Colors) then
    begin
      P.palPalEntry[I].peRed   := Byte(Colors[I] and $FF);
      P.palPalEntry[I].peGreen := Byte(Colors[I] and $FF00 shr 8);
      P.palPalEntry[I].peBlue  := Byte(Colors[I] and $FF0000 shr 16);
      P.palPalEntry[I].peFlags := 0;
    end
    else
    begin
      P.palPalEntry[I].peRed   := 0;
      P.palPalEntry[I].peGreen := 0;
      P.palPalEntry[I].peBlue  := 0;
      P.palPalEntry[I].peFlags := 0;
    end;
  end;

  H := CreatePalette(P^);
  if H <> 0 then
    Bitmap.Palette := H;

  FreeMem(P);
end;

_________________
Life is a bad adventure, but the graphic is really good!
MKehrer Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114

NT, 2000
D6
BeitragVerfasst: Mo 29.09.03 07:35 
Danke

_________________
Manfred
Was Du siehst ist in Dir (Smile)