This function uses a specified color (RGB value), compares this value to pixels in the image and selects areas of the image that have that color. From this selection, this function creates a new image and mask image.

[C++Builder]   BOOL IKAutoSelectImageEx(HANDLE Handle, PTR_IKSELECT_IMAGE DstHandle, BYTE SelectMode, LPPOINT lpPoint, int Points, LPRECT Rect, BOOL InOut, BYTE Red, BYTE Green, BYTE Blue, BYTE Mode, BYTE Level, IKPROCESSPROC UserProc, LPCTSTR Caption, LPCTSTR Message, LPCTSTR Button);
[Delphi]   function IKAutoSelectImageEx(Handle: THandle; var DstHandle: IKSELECT_IMAGE; SelectMode: Byte; var lpPoint: TPoint; Points: Integer; var Rect : TRect; InOut: LongBool; Red, Green, Blue, Mode, Level: Byte; UserProc: LONG_PTR; Caption, Message, Button: PChar): LongBool;

Parameters

Name Explanation
Handle The image handle of the raster image (1, 4, 8, 16, 24, or 32 bit image)
DstHandle A structure whose member variables contain the created image handle and mask image handle (if unsuccessful the members of the structure return 0) Note: DstHandle is used by the IKAutoSelectImageEx function only
SelectMode Sets the method for selecting the area on the image that will be processed (0: Mask handle, 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, 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]

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 Specifies the red value of the color that will be selected (From 0 to 255)
Green Specifies the green value of the color that will be selected (From 0 to 255)
Blue Specifies the blue value of the color that will be selected (From 0 to 255)
Mode Comparison mode (0:RGB, 1:CrCb, 2:Y)
Level Level of Allowance (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

If successful, True (nonzero) is returned, otherwise 0 is returned.

Explanation

The IKAutoSelectImageEx function uses a specified color (RGB value), compare this value to pixels in the image and select areas of the image that have that color. From this selection, this function creates a new image and mask image. This function is for use with Delphi and C++Builder.

Before executing this function, you must set the area on the image that will be affected. There are 3 ways to do this.

  1. To process the total image, set SelectMode to 1.
  2. 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).
  3. 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 Mode parameter sets the type of color comparison used to select portions of the image. When the Mode parameter is other than 0 (i.e. CrCb or Y) then all RGB values are converted to YCrCb values and compared. The Level parameter controls the range of RGB values that will be selected. If the Level value is 0, then only those pixels that have the save RGB value as that specified in the Red, Green, and Blue parameters will be selected. As the Level parameter increases, the range of RGB values that will be selected increases. For example, if Level = 10 and Red, Green, and Blue = 100 respectively, then all pixels with an RGB value between (90,90,90) and (110,110,110) will be selected.


Note: the image handle passed to IKSELECT_IMAGE 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 Ik10Effect.dll, Ik10EffectA.dll, Ik10Effect64.dll, Ik10Effect64A.dll section.

 

The ImageKit10 VCL is a product created by Newtone Corporation