CImage:Affine CImage:Expand

CImage:Crop


The Crop method trims a rectangular subimage out of the image. This transformation preserves the world coordinate calibration of the image, if one exists.

Syntax

bResult = CImage:Crop( CRect )

    On success, this method returns true

    On failure, this method returns false.

Remarks

The crop region is passed as a CRect object containing the min and max x and y limits of the sub-image. These pixel coordinates are 1-based, meaning that pixel (1,) is at the origin of the image.

Example

Assume that an image is displayed in a CImageView named V. The following script fragment crops a subimage from the image cursor:

I = V:GetImage()

-- attach the displayed image to the CImage

R = V:GetCursorRect()

-- get the cursor extent as a CRect

I:Crop( R )

--crop the image to the image cursor

Related Topics

CImage , CImageView , CRect