CImageView:SetCursorPos


The SetCursorPos method sets the center position of the image cursor in the CImageView. The coordinates must be in Pixel Coordinate Definition.

Syntax

CImageView:SetCursorPos( x, y )

bullet.gif    The x and y values specify the target position in pixel coordinates, and may be numbers or strings.

Remarks

Mira defines image coordinates for each axis as having pixel 1.0 located at the center of the first pixel. Thus, specifying the cursor position with x = 2.0 centers the image cursor in the middle of column 2.

Example

Assume that a CImageView object named V exists. The following script sets the image cursor to the center of the current image:

I = V:GetImage()

-- Get a CImage for the current displayed image

x = I:Cols() / 2

-- x, y refer to the center of the image

y = I:Rows() / 2

 

V:SetCursorPos(x,y)

-- move the image cursor to the image center

Related Topics

CImageView, SetCursorPosWcs, GetCursorPos, Image Coordinate System, Pixel Coordinate Definition, Subpixel Coordinate Definition

 

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