![]() |
Scanline kriechend langsam
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:
Die Variablen bmpWidth und bmpHeight hab ich eingeführt, weil ich hoffte, dass die Performanceprobleme von dem Zugriff auf die TBitMap-Propertys kommen.
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; Form2.TextImage und tmpBmp sind beide vom Type TBitMap. |
Re: Scanline kriechend langsam
Moin!
Beide Schleifen laufen um eins zu weit, beide nur bis bmpHeight-1 bzw. bmpWidth-1. Sind beide Bitmaps gleich gross, haben beide Bitmaps 256 Farben, also 8 Bit ?? MfG Muetze1 |
Re: Scanline kriechend langsam
Hi,
die sind beide gleich groß und 256 Farben verwende ich nicht. Glaube ich. :) An dem Farbmodus/Palette habe ich nach dem TBitMap.Create nichts geändert. Ich will auch hier keine Limitierung auf 256 Farben haben, was müsste ich dann statt PByteArray verwenden? |
Re: Scanline kriechend langsam
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:
Ist das schneller?
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; MfG Muetze1 |
Re: Scanline kriechend langsam
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:38 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz