getImageSelectedAreaInfo()

Description

Gets the index and coordinates of the selected area on the image in an image viewer.

Syntax

ImageViewerObject.ui.getImageSelectedAreaInfo();

Parameters

None

Return value

<ImageSelectedAreaInfo>
<int> ImageSelectedAreaInfo.index: specifies the index of image in buffer. The index is 0-based.
<int> ImageSelectedAreaInfo.left: specifies the x-coordinate of the upper-left corner of the rectangle. The unit is pixel.
<int> ImageSelectedAreaInfo.top: specifies the y-coordinate of the upper-left corner of the rectangle. The unit is pixel.
<int> ImageSelectedAreaInfo.right: specifies the x-coordinate of the lower-right corner of the rectangle. The unit is pixel.
<int> ImageSelectedAreaInfo.bottom: specifies the y-coordinate of the lower-right corner of the rectangle. The unit is pixel.

If it fails to get the selected area info, it returns null.

Remarks

If no area is selected on any images in an image viewer, null is returned.

When an error occurs, check getErrorCode() or getErrorString() for error information.

Example

if (DCSObject)
{
    var imageviewer = DCSObject.getImageViewer("ImageViewerContainer");  // Get a specified image viewer
    var imageInfo = imageviewer.ui.getImageSelectedAreaInfo();  // Gets the selected area info in the image viewer
    console.log("index: " + imageInfo.index + " left: " + imageInfo.left + " top: " + imageInfo.top + " right: " + imageInfo.right + " bottom: " + imageInfo.bottom);
}

See also

image.crop()