Entwickler-Ecke

Multimedia / Grafik - Color in Byte umwandeln:wie?


FatalError - Do 18.03.04 18:48
Titel: Color in Byte umwandeln:wie?
Hi,

dieser Code gibt mir den Fehler "[Error] Unit1.pas(54): Incompatible types: 'TColor' and 'PByte'" aus


Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var pixel, pixel2: PByteArray;
      b1, b2: TBitmap;  
      c1, c2: PByte;
begin
  b1 := Image1.Picture.Bitmap;  
  b2 := Image2.Picture.Bitmap;
    c1 := b1.Scanline[1];
    image2.canvas.Pixels[1,1]:= c1;


Wie kann ich hier Tcolor in Byte umandeln?

Grüße
Andy

p.s.: das oben soll nur ein kurzes Fallbeispiel sin, die eigentliche Anwendung ist etwas komplizierter und hat nix mit images kopieren zutun;-)


Delete - Fr 19.03.04 19:57

Erstmal liegt nicht 'Byte' vor sondern 'PByte' also eine Speicheradresse eines Bytes.
Warum hier PByte verwendet wird und nicht PColor ist mir zwar auch nicht ganz klar, aber versuch mal das:

Delphi-Quelltext
1:
image2.canvas.Pixels[1,1]:= PColor(c1)^;