Einzelnen Beitrag anzeigen

Alibi

Registriert seit: 15. Aug 2003
Ort: Bispingen
94 Beiträge
 
Delphi 7 Personal
 
#1

Scanline kriechend langsam

  Alt 29. Nov 2004, 20:35
Hi,
ansich recht simpel, ich will ein Bild horizontal spiegeln... Ich verwende dafür Scanline, das ist aber kriechend langsam, selbst der Zugriff über Pixels[x, y] geht schneller.
Hier mein Versuch, also der entscheidende Teil:
Delphi-Quellcode:
var
  y, x, i, bmpWidth, bmpHeight: Integer;
  rowA, rowB: PByteArray;
begin
[...]
    bmpWidth := tmpBmp.Width;
    bmpHeight := tmpBmp.Height;
    for y := 0 to bmpHeight do
    begin
      rowA := tmpBmp.ScanLine[y];
      rowB := Form2.TextImage.ScanLine[y];
      for x := 0 to bmpWidth do
        rowB[bmpWidth - x] := rowA[x];
    end;
Die Variablen bmpWidth und bmpHeight hab ich eingeführt, weil ich hoffte, dass die Performanceprobleme von dem Zugriff auf die TBitMap-Propertys kommen.
Form2.TextImage und tmpBmp sind beide vom Type TBitMap.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning.
  Mit Zitat antworten Zitat