ImageEn, unit iexUserInteractions

TIECropToolInteraction.SetBitmapPolygon

TIECropToolInteraction.SetBitmapPolygon


Declaration

procedure SetBitmapPolygon(Rect: TRect); overload;
procedure SetBitmapPolygon(Pts: Array of TDPoint); overload;


Description

Sets the area of the image selected for cropping. This is the programmatic equivalent of the user dragging the grips of the crop tool selection.
If you use the Pts array, you must specify 4 points in the following order: TL, TR, BR, BL

Note:
 Values are in terms of the bitmap. Use XScr2Bmp and YScr2Bmp to convert screen values to bitmap values
 You must call TImageEnView.Invalidate if you change this property when the crop selection is visible


Saving Selection Example

var
  fCropSelection: array[0..3] of TDPoint;
  fCropRotation: Double;

// Save current selection
procedure TForm1.SaveCropToolSelection();
begin
  if ImageEnView1.CropTool.Selected = False then
    raise Exception.create( 'Nothing is selected' );

  ImageEnView1.CropTool.GetBitmapPolygon( fCropSelection );
  fCropRotation  := ImageEnView1.CropTool.Rotation;
end;

// Restore a saved selection
procedure TForm1.RestoreCropToolSelection();
begin
  ImageEnView1.CropTool.SetBitmapPolygon( fCropSelection );
  ImageEnView1.CropTool.Rotation := fCropRotation;
  ImageEnView1.Update();
end;


See Also

 GetBitmapPolygon
 BitmapPolygon
 Rotation