copyToClipboard()

Description

Copies a specified area of an image with the specified index in buffer to clipboard in DIB format (Windows version) or NSImage format (Mac version).

Syntax

ImageViewerObject.io.copyToClipboard(index, [left, top, right, bottom]);

Parameters

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

If you don't specify parameter left, top, right and bottom, copyToClipboard() makes a copy of the whole image to the clipboard.

Return value

bool

true indicates success. false indicates failure.

When false is returned, check getErrorCode() or getErrorString() for error information.

Remarks

If the value of left or top is negative, it will be treated as zero.

If the value of right is larger than the width of image, it will be treated as the width of image.

If the value of bottom is larger than the height of image, it will be treated as the height of image.

The value of left must be smaller than the value of right and the value of right must be positive.

The value of top must be smaller than the value of bottom and the value of bottom must be positive.

Example

             var imageviewer = DCSObject.getImageViewer ("ImageViewerContainer");  // Get a specified image viewer
             imageviewer.io.copyToClipboard(0); 
      

See also

.io.loadFromClipboard()