CImage:PtInside


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

Syntax

bResult = CImage:PtInside( x, y )

bullet.gif    x and y are image coordinates in pixel units.

bullet.gif    On success, this method returns true.

bullet.gif    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 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 class, CRect:PtInside


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.