ImageEn, unit imageenproc

TImageEnProc.ApplyPreviews

TImageEnProc.ApplyPreviews


Declaration

function ApplyPreviews(Dest: TObject = nil; SourceParams: TIEImageEffect = nil): string; overload;
function ApplyPreviews(Dest: TObject; SourceParamsList: TIEImageEffectsList): string; overload;


Description

Apply image effects specified in the Image Processing dialog (using DoPreviews) to another image.
Dest can be a TIEBitmap or a TImageEnView. If it is nil, the effects are applied to the current image.
You can optionally apply effects specified by a custom TIEImageEffect object specified by SourceParams (such as another TImageEnProc.IPDialogParams), or multiple effects specified by SourceParamsList
Result is a string description of the operation, e.g. "Resize 50%" or '' if no operation occured.

Notes:
- ApplyPreviews() only applies the values specified on the active page of the Image Processing dialog, so you are best to specify a single Preview Effect for DoPreviews() or add prppSingleEffectOnly to PreviewsParams
- Only properties supported by IPDialogParams will be applied


Example 1

// Prompt user to specify color curve settings (using our "Editing" TImageEnView)
btnApplyCurve.Enabled := ImageEnView1.Proc.DoPreviews( [peColorCurve] );

// Apply specified color curve to current image (in our "Viewing" TImageEnView)
procedure TForm1.btnApplyCurveClick(Sender: TObject);
begin
  ImageEnView1.Proc.ApplyPreviews( ImageEnView2 );
end;


Example 2

// Allow user to specify a resampling value and apply it to all images in a folder
ssFiles := TStringList.Create;
GetFilesInFolder( ssFiles, 'D:\test\' ); // This is an example method only. It does not exist
if ImageEnView1.Proc.DoPreviews( [peResize] ) then
begin
  for i := 0 to ssFiles.Count - 1 do
  begin
    bmp := TIEBitmap.Create;
    bmp.Read( ssFiles[i] );
    ImageEnView1.Proc.ApplyPreviews( bmp );
    bmp.Write( ssFiles[i] );
    bmp.Free;
  end;
end;
ssFiles.Free;


Example 3

// Allow the user to specify any effect from the Previews dialog
ImageEnView1.Proc.PreviewsParams := ImageEnView1.Proc.PreviewsParams + [ prppSingleEffectOnly ];
ImageEnView1.Proc.DoPreviews();
ImageEnView1.Proc.IPDialogParams.SaveToFile( ChangeFileExt( Application.ExeName, '.effect' ));

// Apply same effect to the current image
ImageEnView1.Proc.IPDialogParams.LoadFromFile( ChangeFileExt( Application.ExeName, '.effect' ));
ImageEnView1.Proc.ApplyPreviews();


See Also

Published Property  DoPreviews
Public Property  IPDialogParams