Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: laguna on May 09, 2018, 08:50:45 am

Title: Capture Screen area - Repaint low
Post by: laguna on May 09, 2018, 08:50:45 am
Hi, help me,

In this program, capture area screen, with mouse, refresh low e repaint  is bad.

without the repaint, capture area screen is correct, but not display rectangle area, with mouse.

Code: Pascal  [Select][+][-]
  1. procedure TfrmScreenShot.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  2. begin
  3.   if FMakingSelection then begin
  4.     FSelectionRect.Right:=X;
  5.     FSelectionRect.Bottom:=Y;
  6.     Repaint;        //  <---------------------------
  7.   end;
  8. end;
  9.  
  10. procedure TfrmScreenShot.FormMouseUp(Sender: TObject; Button: TMouseButton;
  11.   Shift: TShiftState; X, Y: Integer);
  12. begin
  13.   if FMakingSelection then begin
  14.     FMakingSelection:=False;
  15.     FSelectionMade:=True;
  16.     Repaint;  //  <---------------------------
  17.     SaveSelectedRegion;
  18.     Close;
  19.   end;
  20. end;  
  21.  

Help me for optimize this.

Thanks.
Vincenzo

Title: Re: Capture Screen area - Repaint low
Post by: Thaddy on May 09, 2018, 08:57:16 am
form.beginupdate/endupdate would help.
Title: Re: Capture Screen area - Repaint low
Post by: laguna on May 09, 2018, 09:10:35 am
I do not understand how to use it, can you help me?

Thank you
Vincenzo

Title: Re: Capture Screen area - Repaint low
Post by: balazsszekely on May 09, 2018, 11:41:01 am
You should really switch to something more performant like BGRABitmap or something similar. Until then try the attached project(tested only on windows).
Title: Re: Capture Screen area - Repaint low
Post by: laguna on May 09, 2018, 01:36:31 pm
Run very well.


 Thanks.
TinyPortal © 2005-2018