Einzelnen Beitrag anzeigen

shmia

Registriert seit: 2. Mär 2004
5.508 Beiträge
 
Delphi 5 Professional
 
#2

Re: Bitmap Compare - Bitmaps vergleichen mit Scanline

  Alt 19. Jul 2005, 16:31
Nettes Spielprogramm.

Ich habe noch ein weiteres Verfahren namens Differenz-Image hinzu genommen.
Delphi-Quellcode:
        if RadioButton3.Checked then // Vorsicht bei zu vielen Pixeln !
        begin
          with PrevImage.Picture.Bitmap.Canvas do
            Ellipse(x - 5, y - 5, x + 1 + 5, y + 1+ 5);
        end
        else if RadioButton4.Checked then // neu
        begin
           PInteger(P3)^ := PInteger(P2)^-PInteger(P)^;
        end;
Man braucht nicht bei jedem Pixel ein Application.ProccessMessages ausführen:
Delphi-Quellcode:
       if (x and 15)=0 then
        // wegen grossen Bildern und klienen PC's :-) alle 16 Pixels
        Application.ProcessMessages;
Bei der Methode Pixel markieren 2 ergibt dies eine Geschwindigkeitssteigerung von Faktor 14 !!

Wenn man in der inneren Schleife nicht die RadioButtons prüft, sondern eine lokale Integer-Variable
gewinnt man zusätzlich an Zeit:
Delphi-Quellcode:
var
   mode : Integer;
begin
  if RadioButton1.Checked then
    mode := 0
  else if RadioButton2.Checked then
    mode := 1
  else if RadioButton3.Checked then
    mode := 2
  else if RadioButton4.Checked then
    mode := 3;

   ...
  //
  case mode of
  0:
Andreas
  Mit Zitat antworten Zitat