Hi,
Try not using layers in the interactive form and it will work a lot better. I got it working by doing some small changes to your source code.
Have a look at this and compare it with yours:
procedure TForm1.Button2Click(Sender: TObject);
var
CropForm: TfrmCropPhoto;
CropX, CropY, CropW, CropH: Integer;
CRect: TRect;
TotalLayers, CurrLayer: Integer;
begin
if ImageEnVect1.IsEmpty then
Exit;
if ImageEnVect1.CurrentLayer.IsMask then
Exit;
CurrLayer := ImageEnVect1.LayersCurrent;
CropX := 1400;
CropY := 2390;
CropW := 878;
CropH := 800;
CRect := Rect(CropX, CropY, CropW, CropH);
CropForm := TfrmCropPhoto.Create(Application);
CropForm.ienViewCrop.IEBitmap.Assign(ImageEnVect1.CurrentLayer.Bitmap);
CropForm.ienViewCrop.Proc.ClearAllUndo;
CropForm.ienViewCrop.Proc.ClearAllRedo;
CropForm.ienViewCrop.Proc.UndoLimit := 20;
CropForm.ienViewCrop.CropToolInteraction.SetBitmapPolygon(Rect(0, 0, CropForm.ienViewCrop.IEBitmap.Width, CropForm.ienViewCrop.IEBitmap.Height));
CropForm.ienViewCrop.CropToolInteraction.DrawGuides := False;
CropForm.ienViewCrop.CropToolInteraction.AntialiasMode := ierBicubic;
CropForm.ienViewCrop.CropToolInteraction.GripSize := 12;
CropForm.ienViewCrop.CropToolInteraction.Mode := iectmRECTANGLE;
CropForm.ienViewCrop.MouseInteract := [miCropTool];
CropForm.ienViewCrop.Cursor := crIECrossSight;
CropForm.ienViewCrop.Fit();
if CropForm.ShowModal = mrOk then
begin
CropForm.ienViewCrop.CropToolInteraction.Crop;
ImageEnVect1.CurrentLayer.Bitmap.Assign(CropForm.ienViewCrop.IEBitmap);
end; // if CropForm.ShowModal = mrOk then
CropForm.Free;
ImageEnVect1.Refresh;
end;
Some code is needed to make the layer fit the new size (cropped image)...
Roy M Klever
Klever on Delphi - www.rmklever.com