ImageEn, unit imageenio

TImageEnIO.AsyncMode

TImageEnIO.AsyncMode


Declaration

property AsyncMode: Boolean;


Description

Set to True to enable asynchronous input/output operations.

When asynchronous mode is enabled, each input/output method creates a new thread to executes the task then returns without waiting for the task to complete.

Note:
Applicable only when TImageEnIO is attached to a TIEBitmap object.
OnFinishWork will fire when an operation completes
To use just for loading images into TImageEnView, using AsyncLoading


Demo

Demo  Demos\InputOutput\Preload\Preload.dpr


Example

// Multi-threaded saving
Var
  bmp: TIEBitmap;
  io: TImageEnIO;
Begin
  bmp := TIEBitmap.Create;
  io  := TImageEnIO.CreateFromBitmap(bmp);
  try
    io.LoadFromFile('C:\input.bmp');
    io.AsyncMode := True;  // So it will create a thread for each input/output task
    io.SaveToFile('D:\i1.jpg');  // thread 1
    io.SaveToFile('D:\i2.jpg');  // thread 2
    io.SaveToFile('D:\i3.jpg');  // thread 3
  finally
    io.Free;  // Free method will wait for all tasks to end!
    bmp.Free;
  end;
End;