ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Fast Repaint
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

wesleybobato

Brazil
367 Posts

Posted - Feb 17 2015 :  09:09:12  Show Profile  Reply
Hello Nigel.
Graphics32 has a property to Repaint Bitmap optimized and the result is very fast.

You can add a Method to Improve the Speed Repainting?

ImageEnView1.UpdateReason: = ieurChangeBitmap is possible?

I I have attached a Sample Image and Code.

Thank you for your attention.


unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ieview, imageenview, imageenio;

type
 TLoadPicture = class(TThread)
  _List: array [0..10] of string;
  _IE: TImageEnView;

  protected
   procedure Execute; override;

  public
   constructor Create(IE: TImageEnView);

 end;

type
  TForm2 = class(TForm)
    ImageEnView1: TImageEnView;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
   FLoadPicture: TLoadPicture;
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
 if Assigned(FLoadPicture) then
  begin
   if not FLoadPicture.Terminated then
    FLoadPicture.Terminate;

   FLoadPicture := nil;
  end;

 FLoadPicture := TLoadPicture.Create(ImageEnView1);
 FLoadPicture.Start;
end;

{ TLoadPicture }

constructor TLoadPicture.Create(IE: TImageEnView);
begin
 inherited Create(True);
 FreeOnTerminate := True;
 _IE             := IE;

 _List[0]  := 'C:\img\0.jpg';
 _List[1]  := 'C:\img\1.jpg';
 _List[2]  := 'C:\img\2.jpg';
 _List[3]  := 'C:\img\3.jpg';
 _List[4]  := 'C:\img\4.jpg';
 _List[5]  := 'C:\img\5.jpg';
 _List[6]  := 'C:\img\6.jpg';
 _List[7]  := 'C:\img\7.jpg';
 _List  := 'C:\img\8.jpg';
 _List[9]  := 'C:\img\9.jpg';
 _List[10] := 'C:\img\10.jpg';
end;

procedure TLoadPicture.Execute;
var
 _BMP: TImageEnIO;
  I: Integer;
begin
 if not Terminated then
  begin
   _BMP := TImageEnIO.Create(nil);
   try
    for I := Low(_List) to High(_List) do
     begin
      if Terminated then
       Break;

       begin
        _BMP.LoadFromFile(_List[I]);

        Synchronize(procedure ()
        begin
         _IE.IEBitmap.Assign(_BMP.IEBitmap);
         //_IE.UpdateReason := ieurChangeBitmap; Add This Option Please Nigel for Update Repaint Fast...
         _IE.Update; // Slow Because Process Very Information...
         Sleep(1000);
        end);

      end;
     end;

   finally
    FreeAndNil(_BMP);
   end;
  end;

 Terminate;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
 FLoadPicture := nil;
end;

end.

xequte

38613 Posts

Posted - Feb 17 2015 :  19:33:42  Show Profile  Reply
Hi Wesley

When the entire bitmap has been replaced, there is not much of the Update function that could be skipped, so I don't see there would be much speed improvement.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: