This function allows you to define an area on a raster image and create a new image and mask image from that area. Use this function in Visual Basic and Visual C++. For C++Builder and Delphi, please refer to the IKSelectImageEx function.
Parameters
Name | Explanation |
---|---|
Handle | The image handle of the raster image. (can be a 1, 4, 8, 16, 24, or 32 bit image) |
SelectMode | Sets the method for selecting the area on the image that will be processed (1: Total image, 2: Polygon, 3: Ellipse) |
lpPoint | A structure defining coordinates for the points of
the polygonal area on the image. (This parameter is enabled when
SelectMode is 2)
In C++Builder and Visual C++, pass the pointer to the first element in the structure array. In Delphi, if Pt is an array of TPoint, then the arguments are returned in the first elements of the array Pt[0] In Visual Basic, if Pt is an array of IKPOINT, then the arguments are returned in the first elements of the array Pt(0) |
Points | The number of points defining the polygonal area on the image, i.e. the number of points in the lpPoint array (This parameter is enabled when SelectMode is 2). |
Rect | A structure specifying the coordinates for the rectangle bounding the elliptical area on the image (This parameter is enabled when SelectMode is 3) |
InOut | Determines whether the area inside the selected area will be processed or the area outside the selected area will be processed. Enabled for polygon and ellipse (SelectMode is 2 or 3). If False (0), the area outside the selected area is processed. If True (nonzero) the area inside the selected area is processed. |
Red | The red component of the color painted outside the area selected (from 0 to 255) |
Green | The green component of the color painted outside the area selected (from 0 to 255) |
Blue | The blue component of the color painted outside the area selected (from 0 to 255) |
UserProc | The address of the user function (If not using the user function then set to 0) |
Caption | Sets the text displayed in the title bar of the progress dialog box |
Message | Sets the message displayed in the progress dialog box |
Button | Sets the name of the button displayed in the progress dialog box |
Return Value
Returns the raster image handle and mask image handle in the structure members if successful. If unsuccessful, 0 is returned in the structure member variables.
Explanation
The IKSelectImage function allows you to define an area on a raster image and create a new image and mask image from that area. Use this function in Visual Basic and Visual C++. For C++Builder and Delphi, please refer to the IKSelectImageEx function.
Before executing this function, you must set the area on the image that will be affected. There are 3 ways to do this.
- To process the total image, set SelectMode to 1.
- To process the polygonal area on the image, set SelectMode to 2. Select the polygon by setting the appropriate coordinate values for the points of the polygon in the lpPoint structure. Then set the number of points defining the polygon in Points (must be 3 or more).
- To process an elliptical area on the image, set SelectMode to 3. Select the ellipse by setting the appropriate values for the bounding rectangle in the Rect structure.
For the lpPoint and Rect structure members, coordinate points are in pixel units. When SelectMode is set to a value other than 2, set a dummy array in lpPoint and set Points to 0. When SelectMode is set to a value other than 3, then set a dummy array in Rect.
The IKSelectImage function generates the smallest rectangle that can include the selected area and sets the image handles of this area into the members of the IKSELECT_IMAGE structure. The color defined by the Red, Green, and Blue parameters wil be painted in the resulting image in the area that is outside the selected area. The resulting mask image will be a black and white, 1 bit color image where the selected area is white and the area outside of the select area is black. For more information about the images and mask images, please refer to the section in the help file entitled, "Using Effect Methods and Functions".
Note: the image handles passed to this function are NOT automatically freed after executing this function.
If the user function is set or if the Caption, Message, and Button parameters are blank then the Progress dialog box is not displayed. If the Progress dialog box is displayed, it indicates the percentage of the current process completed. For more information about the user function please refer to the Definition of User Function in the Ik9Effect.dll, Ik9EffectA.dll, Ik9Effect64.dll, Ik9Effect64A.dlll section.
If you would like to select a rectangular area on an image and do not require a mask image, please use the IKCutRectImage function as it is much faster than the IKSelectImage function.