ImageEn, unit imageenproc

TImageEnProc.CropSel

TImageEnProc.CropSel


Declaration


procedure CropSel(TransparencyOnly: Boolean = False);


Description


Removes all parts of the image outside the selected region (the image will become the size of the selection).
When TransparencyOnly is true only the alpha channel is cropped. I.e. areas outside the selection are marked as transparent in the alpha channel (the image size does not change).

Note: Use CutToClipboard to remove the area within the selection.


Demo


  Demos\ImageEditing\SelectAndCrop\ImageEn_Crop.dpr



Example


// Cut region 10, 10, 100, 100
ImageEnView1.Select(10, 10, 100, 100);
ImageEnView1.Proc.CropSel;

// Photoshop like cut
IMageEnView1.Select(10, 10, 100, 100);
ImageEnView1.Proc.CropSel(true);

// Make circular selection of entire image and crop
ImageEnView1.SelectionBase := iesbBitmap;
ImageEnView1.SelectEllipse(ImageEnView1.IEBitmap.Width div 2,
                           ImageEnView1.IEBitmap.Height div 2,
                           ImageEnView1.IEBitmap.Width,
                           ImageEnView1.IEBitmap.Height);
ImageEnView1.Proc.CropSel();