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
Not compatible with ChangeBackground, EffectsChain, or Acquire
ImportMetafile and CaptureFromScreen always run synchronously (GDI)

Default: False

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;