ImageEn, unit imageenproc

TImageEnProc.Crop

TImageEnProc.Crop


Declaration


procedure Crop(x1, y1, x2, y2 : Integer);
procedure Crop(Rect : TRect);
procedure Crop(Rectangle: TRect; Rotation: double; AntialiasMode: TIEAntialiasMode = ierFast);
procedure Crop(Quadrilater: array of TIE2DPoint); overload;


Description


Replace the current image with that within the specified rectangle (i.e. keep only the specified region).

Note: Negative or out-of-range values will enlarge the image


Examples


// Crop the image at position, Top-Left: (20, 20), Bottom-right: (100, 100). The resulting image will be 80 x 80 pixels
ImageEnView1.Proc.Crop( 20, 20, 100, 100 );

// Crop to the selected area of the image (same as ImageEnView1.Proc.CropSel)
ImageEnView1.Proc.Crop( ImageEnView1.SelectedRect.x,
                        ImageEnView1.SelectedRect.y,
                        ImageEnView1.SelectedRect.x + ImageEnView1.SelectedRect.Width,
                        ImageEnView1.SelectedRect.y + ImageEnView1.SelectedRect.Height );

// Rotate an image 20 deg. CCW and crop 100 pixels from each side
ImageEnView1.Proc.Crop( Rect( 100, 100, ImageEnView1.IEBitmap.Width - 100, ImageEnView1.IEBitmap.Height - 100 ),
                        20, ierBicubic );

// Crops to the specified quadrilateral and applies forward perspective mapping. Useful to adjust perspective distortion.
ImageEnView1.Proc.Crop([IE2DPoint(104, 85), IE2DPoint(1000, 150), IE2DPoint(181, 500), IE2DPoint(54, 400)]);


See Also


- CropSel
- Global Image Methods