Changeset 3 for trunk/Forms


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.
Location:
trunk/Forms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r2 r3  
    2323    object MenuItem1: TMenuItem
    2424      Caption = 'Soubor'
     25      object MenuItem3: TMenuItem
     26        Action = Core.AProjectNew
     27      end
    2528      object MenuItem2: TMenuItem
    26         Action = Core.AProjectNew
     29        Action = Core.AExit
     30      end
     31    end
     32    object MenuItem4: TMenuItem
     33      Caption = 'Image'
     34      object MenuItem5: TMenuItem
     35        Action = Core.AImageClear
    2736      end
    2837    end
    2938  end
     39  object Timer1: TTimer
     40    Enabled = False
     41    Interval = 50
     42    OnTimer = Timer1Timer
     43    left = 195
     44    top = 206
     45  end
    3046end
  • 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.