Leadtools Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.3.5
AddMagicWandToRegion Method
See Also 
Leadtools Namespace > RasterImage Class : AddMagicWandToRegion Method




left
X coordinate of a point. The color of the specified point will be used to set the region.
top
Y coordinate of a point. The color of the specified point will be used to set the region.
lowerToleranceColor
Lower tolerance values that set the lower stopping point for the region.
upperToleranceColor
Upper tolerance values that set the upper stopping point for the region.
combineMode
The action to take regarding the existing image region, if one is defined.
Sets a region based on the color found at point x, y in the image.

Syntax

Visual Basic (Declaration) 
Public Sub AddMagicWandToRegion( _
   ByVal left As Integer, _
   ByVal top As Integer, _
   ByVal lowerToleranceColor As RasterColor, _
   ByVal upperToleranceColor As RasterColor, _
   ByVal combineMode As RasterRegionCombineMode _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterImage
Dim left As Integer
Dim top As Integer
Dim lowerToleranceColor As RasterColor
Dim upperToleranceColor As RasterColor
Dim combineMode As RasterRegionCombineMode
 
instance.AddMagicWandToRegion(left, top, lowerToleranceColor, upperToleranceColor, combineMode)
C# 
public void AddMagicWandToRegion( 
   int left,
   int top,
   RasterColor lowerToleranceColor,
   RasterColor upperToleranceColor,
   RasterRegionCombineMode combineMode
)
Managed Extensions for C++ 
public: void AddMagicWandToRegion( 
   int left,
   int top,
   RasterColor lowerToleranceColor,
   RasterColor upperToleranceColor,
   RasterRegionCombineMode combineMode
) 
C++/CLI 
public:
void AddMagicWandToRegion( 
   int left,
   int top,
   RasterColor lowerToleranceColor,
   RasterColor upperToleranceColor,
   RasterRegionCombineMode combineMode
) 

Parameters

left
X coordinate of a point. The color of the specified point will be used to set the region.
top
Y coordinate of a point. The color of the specified point will be used to set the region.
lowerToleranceColor
Lower tolerance values that set the lower stopping point for the region.
upperToleranceColor
Upper tolerance values that set the upper stopping point for the region.
combineMode
The action to take regarding the existing image region, if one is defined.

Example

This example will load an image, sets a magic wand region to it, fills the region with blue before saving the image back to disk

Remarks

For gray scale bitmaps:

The minimum channel tolerance value of lowerToleranceColor will be used to set the lower stopping point, and the value of upperToleranceColor will be used to set the upper stopping point. For example, if the value of the pixel at (x, y) is (125, 125, 125) and lowerToleranceColor is (20,30,15), the smallest value of the triplet (15) will be used to create the lower stopping point of (110,110,110). If upperToleranceColor is (10,25,20), the smallest value of that triplet (10) will be used to create the upper stopping point of (135,135,135).

To update an existing region, you specify how the new region is to be combined with the existing one using the combineMode parameter. For more information, refer to RasterRegionCombineMode.

For more information, refer to Creating a Region.

For more information, refer to Saving A Region.

For more information, refer to Working with the Existing Region.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also