Ignore:
Timestamp:
Sep 15, 2014, 11:13:21 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Specific TGColor implementation moved to ColorFormats directory.
  • Added: Function to clear image with background color.
  • Modified: Drawing project image to off screen bitmap to speed up drawing.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r2 r3  
    1717    MenuItem1: TMenuItem;
    1818    MenuItem2: TMenuItem;
     19    MenuItem3: TMenuItem;
     20    MenuItem4: TMenuItem;
     21    MenuItem5: TMenuItem;
    1922    PaintBox1: TPaintBox;
     23    Timer1: TTimer;
    2024    procedure PaintBox1Paint(Sender: TObject);
    2125    procedure PaintBox1Resize(Sender: TObject);
     26    procedure Timer1Timer(Sender: TObject);
    2227  private
    2328    { private declarations }
    2429  public
    25     { public declarations }
     30    procedure Redraw;
    2631  end;
    2732
     
    4348end;
    4449
     50procedure TFormMain.Timer1Timer(Sender: TObject);
     51var
     52  Bitmap: TBitmap;
     53begin
     54  Timer1.Enabled := False;
     55  try
     56    Bitmap := TBitmap.Create;
     57    Bitmap.SetSize(Core.Project.Bitmap.Size.X, Core.Project.Bitmap.Size.Y);
     58    Bitmap.BeginUpdate(True);
     59    Core.Project.Bitmap.PaintToCanvas(Bitmap.Canvas);
     60    Bitmap.EndUpdate(False);
     61    PaintBox1.Canvas.Draw(0, 0, Bitmap);
     62  finally
     63    Bitmap.Free;
     64  end;
     65end;
     66
     67procedure TFormMain.Redraw;
     68begin
     69  Timer1.Enabled := True;
     70end;
     71
    4572procedure TFormMain.PaintBox1Paint(Sender: TObject);
    4673begin
    47   Core.Project.Bitmap.PaintToCanvas(PaintBox1.Canvas);
     74  Redraw;
    4875end;
    4976
Note: See TracChangeset for help on using the changeset viewer.