Thema: Delphi laufende sinus-Kurve

Einzelnen Beitrag anzeigen

Benutzerbild von toms
toms
(CodeLib-Manager)

Registriert seit: 10. Jun 2002
4.648 Beiträge
 
Delphi XE Professional
 
#2

Re: laufende sinus-Kurve

  Alt 20. Mai 2004, 10:36
Zitat:
1. Das Bild flimmert/ruckelt ein wenig. Ich glaube das liegt an meinem Quelltext. Wie kann ich das ändern?
Stichwort: Hier im Forum suchenBitBlt.

Nachtrag: Zusätzlich noch die Form auf DoubleBuffered := True; setzen


Nachtrag2:

Ok, hier dann mal ein Beispiel:

Delphi-Quellcode:
procedure TForm1.Timer1Timer(Sender: TObject);
const
  b = 53;
  a: Integer = 40;
var
  i: Integer;
  bmp: TBitmap;
begin
    bmp := TBitmap.Create;
    try
      bmp.Canvas.Font.Assign(Canvas.Font);
      bmp.Width := Width;
      bmp.Height := Height;

      bmp.Canvas.MoveTo(Width, Height);
      for i := Width downto -100 do
        if a <> 0 then
          bmp.Canvas.Pixels[i + a - 1, Round((sin(i * 0.12)) * 16) + 16] := Color
      else
        bmp.Canvas.Pixels[i + b - 1, Round((sin(i * 0.12)) * 16) + 16] := Color;
      bmp.Canvas.MoveTo(Width, Height);
      for i := Width downto -100 do
        bmp.Canvas.Pixels[i + a, Round((sin(i * 0.12)) * 16) + 16] := clBlack;

      BitBlt(Canvas.Handle,
        0, 0,
        bmp.Width,
        bmp.Height,
        bmp.Canvas.Handle,
        0, 0,
        SRCCOPY
        );

    finally
      bmp.Free;
    end;
  a := a + 1;
  if a = b then
    a := 0;
end;
Thomas
  Mit Zitat antworten Zitat