ImageEn, unit iexBitmaps

TIEBitmap.OnProgress

TIEBitmap.OnProgress


Declaration

property OnProgress: TIEProgressEvent;


Description

Occurs when image processing or input/output operations are executed.

Note: The Sender parameter may be this bitmap or a TImageEnIO object, depending on the operation.


Example

// Code to load an image, rotate it 90 and then save it with continuous progress display
private
  fCurrentStep: Integer;
  fStepCount: Integer;
...

procedure TForm1.BmpShowProgress(Sender: TObject; per: Integer);
begin
  ProgressBar1.Position := Trunc( fCurrentStep * 100 / fStepCount + ( per / fStepCount ));
  ProgressBar1.Visible := True;
end;

procedure TForm1.BmpHideProgress();
begin
  ProgressBar1.Visible := False;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  aBmp: TIEBitmap;
begin
  fStepCount := 3; // Three progress events will occur

  aBmp := TIEBitmap.Create;
  try
    aBmp.OnProgress := BmpShowProgress;

    fCurrentStep := 0;
    aBmp.Read('D:\Image.jpg');

    fCurrentStep := 1;
    aBmp.Rotate(90);

    fCurrentStep := 2;
    aBmp.Write('D:\Image_Done.png');
  finally
    aBmp.free;
    BmpHideProgress();
  end;
end;