setSelect
Top  Previous  Next

setSelect (integer Image, integer Shape, integer Mode, integer X1, integer Y1,
integer X2, integer Y2 [, integer X3, integer Y3, ... ] )  

Use this function to create a selection (region of interest) on an image. A selection is a temporarily isolated part of an image that restricts image processing to the enclosed region.

Parameters

Image  
 
An integer between 1 and 116 specifying the frame number of the image. Values in the range of 100-116 correspond to hidden frames.  
 
Shape  
 
An enumerated integer that describes the shape of the selection. Must be one of the following values:  
 
SH_RECT – creates a rectangular selection. Parameters X1, Y1, X2, Y2 indicate the left, top, right and bottom coordinate of the rectangle respectively. Equivalent to using the Rectangular Selection tool.  
SH_ELLIPSE – create an elliptical selection. Parameters X1, Y1, X2, Y2 indicate the left, top, right and bottom coordinate of the circumscribed rectangle respectively. Equivalent to using the Elliptical Selection tool.  
SH_FREE – creates a freehand selection. Parameters X1,Y1, X2,Y2, X3,Y3 ... indicate the coordinates of each vertex in the shape. Equivalent to using the Freehand Selection or Magic Wand tools.  
 
Mode  
 
An enumerated integer that describes how the selection will be created. Must be one of the following values:  
 
SEL_NEW – creates a new selection area. If the image already contains a selection, it will be automatically deleted.  
SEL_ADD – adds the created selection area to an existing one.  
SEL_SUBTRACT – subtract the created selection area from an existing one.  
SEL_ERASE – erases an existing selection from the image. Equivalent to calling resetSelect.  
 
X1, Y1, X2, Y2, ....  
 
A list of integer coordinate pairs specifying the position of the selection in the image. In case of a rectangular or elliptical selection the function uses four coordinates corresponding to the left, top, right and bottom of the rectangle (or circumscribed rectangle). For a freehand selection the coordinate pairs specify the position of each vertex in the selection boundary.  
 
Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  
 
Example

The following set of statements creates a rectangular selection with an elliptical "hole" in the middle:  
   
setCurDir("samples")  
loadIm (1,"sample14.iwd")  
setSelect (1, SH_RECT, SEL_NEW, 21, 26, 367, 284)  
setSelect (1, SH_ELLIPSE, SEL_SUBTRACT, 99, 89, 305, 227)