Ver Mensaje Individual
  #2  
Antiguo 16-11-2008
[coso] coso is offline
Miembro Premium
 
Registrado: may 2008
Ubicación: Girona
Posts: 1.678
Reputación: 0
coso Va por buen camino
Hola, te dejo un ejemplo :

Código Delphi [-]
var
     bt : TBitmap;
     t  : double;

procedure TForm1.FormCreate(Sender: TObject);
begin
     bt := TBitmap.Create;
     doublebuffered := true;
     Timer1.Interval := 1;
     Timer1.Enabled := true;
end;

function Func(x : double) : double;
begin
     result := 100*sin(x*5)+ 100*cos(x*8);
end;

procedure TForm1.FormPaint(Sender: TObject);
var
     i,
     c : integer;
begin
     c := bt.Height div 2;

     bt.Width  := Width;
     bt.Height := Height;

     bt.Canvas.Brush.Color := $770000;
     bt.Canvas.FillRect(Rect(0,0,bt.Width,bt.Height));

     bt.Canvas.Pen.Color   := clWhite;
     bt.Canvas.MoveTo(0,c);
     bt.Canvas.LineTo(bt.Width,c);

     bt.Canvas.Pen.Color := $0080FF;
     bt.Canvas.Pen.Width := 2;
     for i := bt.Width downto 0 do
     begin
          bt.Canvas.MoveTo(i,Round(Func(t+0.0025*i)) + c);
          bt.Canvas.LineTo(i,Round(Func(t+0.0025*(i-1))) + c);
     end;

     BitBlt(Canvas.Handle, 0, 0, ClientWidth, ClientHeight, bt.Canvas.Handle, 0, 0, SRCCOPY);
end;

procedure TForm1.TimerTimer(Sender: TObject);
begin
     t := t + 0.0025;
     Paint;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
     bt.Destroy;
end;

busca por el foro sobre bitblt y bitmap.lock, para optimizar el 'flickering'. Saludos.
Responder Con Cita