Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#1

[FillRect] Geht das schneller ?

  Alt 3. Jan 2014, 22:35
Delphi-Quellcode:
procedure TForm1.btnCaptureClick(Sender: TObject);
var
  Background: TBitmap;
  ARect: TRect;
  i: Integer;
  Left, Top: Integer;
begin

  Background := TBitmap.Create;
  Left := 0;
  Top := 0;
  try
    Background.Height := 48;
    Background.Width := 64;
    Background.Canvas.Brush.Style := bsSolid;
    Background.Canvas.Brush.Color := clfuchsia;
    ARect := Background.Canvas.ClipRect;
    Background.Canvas.FillRect(ARect);

    for i := 1 to 64 do
    begin
      ARect.Left := Left;
      ARect.Top := 0;
      ARect.Right := 1 + Left;
      ARect.Bottom := 1;

      Background.Canvas.Brush.Color := CaptureX.pTop[I].Color;
      Background.Canvas.FillRect(ARect);

      ARect.Left := Left;
      ARect.Top := 47;
      ARect.Right := 1 + Left;
      ARect.Bottom := 48;

      Background.Canvas.Brush.Color := CaptureX.pBottom[I].Color;
      Background.Canvas.FillRect(ARect);

      inc(Left);
    end;

    for i := 1 to 48 do
    begin
      ARect.Left := 0;
      ARect.Top := Top;
      ARect.Right := 1;
      ARect.Bottom := 1 + Top;

      Background.Canvas.Brush.Color := CaptureX.pLeft[I].Color;
      Background.Canvas.FillRect(ARect);

      ARect.Left := 64;
      ARect.Top := Top;
      ARect.Right := 63;
      ARect.Bottom := 1 + Top;

      Background.Canvas.Brush.Color := CaptureX.pRight[I].Color;
      Background.Canvas.FillRect(ARect);

      inc(Top);
    end;

  finally
    Background.SaveToFile('D:\Test.bmp');
    Background.Free;
  end;

end;
gibt es da eine schnellere Methode?

gruss
  Mit Zitat antworten Zitat