Einzelnen Beitrag anzeigen

Muetze1
(Gast)

n/a Beiträge
 
#4

Re: Scanline kriechend langsam

  Alt 30. Nov 2004, 07:38
Moin!

PixelFormat muss bei beiden Bitmaps schon gleich sein und es darf kein DDB Bitmap sein, weil sonst gibt es keine ScanLine.

Und was du anstatt von PByteArray nutzen kannst hängt direkt von der Farbtiefe zusammen - daher nicht so einfach zu sagen.

Delphi-Quellcode:
var
  y, x : Integer;
  rowA,
  rowB : PRGBQuad;
begin
  If ( tmpBmp.Height <> Form2.TextImage.Height ) Or
     ( tmpBmp.Width <> Form2.TextImage.Width ) Then
    Exit;

  tmpBmp.HandleType := bmDIB;
  Form2.TextImage.HandleType := bmDIB;

  tmpBmp.PixelFormat := pf32bit;
  Form2.TextImage.PixelFormat := pf32bit;

  for y := 0 to tmpBmp.Height-1 do
  begin
    rowA := tmpBmp.ScanLine[y];
    rowB := Form2.TextImage.ScanLine[y];
    Inc(rowB, tmpBmp.Width-1);

    for x := 0 to tmpBmp.Width-1 do
    Begin
      rowB^ := rowA^;
      Inc(rowA);
      Dec(rowB);
    End;
  end;
End;
Ist das schneller?

MfG
Muetze1
  Mit Zitat antworten Zitat