CImage:GetImageScaleXy CImage:Reorient

CImage:PtInside


The PtInside method tests whether a point specified in pixel coordinates is interior to the image.

Syntax

bResult = CImage:PtInside( x, y )

    x and y are image coordinates in pixel units.

    On success, this method returns true.

    On failure, this method returns false.

Remarks

This method is useful for the non-trivial cases of when a coordinate is calculated or is expressed in world coordinates. In the latter case, call WcsToXy to convert to pixel coordinates before calling this method.

Example

Assume a displayed image is attached to a CImageView namedI. The following script fragment converts a coordinate (a,d) into pixel coordinates and then tests whether the point (x,y) is inside the image:

I = V:GetImage()

-- create a CRect object

x, y = I:XytoWcs(a,d)

-- convert to pixel coordinates

test = I:PtInside(x,y)

 -- returns true if x,y is inside the image

Printf( "Inside=%d\n",test)

-- result: Inside = 1

Related Topics

CImage, CRect:PtInside