SetRgnBorder method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

L_INT SetRgnBorder (L_INT x, L_INT y, COLORREF crBorderColor, COLORREF crLowerTolerance, COLORREF crUpperTolerance, L_UINT uCombineMode);

Delphi Syntax

Function SetRgnBorder (x: L_INT; y: L_INT; crBorderColor: COLORREF; crLowerTolerance: COLORREF; crUpperTolerance: COLORREF; uCombineMode: L_UINT ): L_INT;

Overview

Refer to Creating and Using a Bitmap Region.

Remarks

Creates a region of pixels with values that fall within a range defined by the value of a specific pixel and a lower and upper tolerance value but are not equal to crBorderColor.

For color bitmaps:

If the value of the pixel at (x, y) is (125, 125, 125) and crLowerTolerance is (20,30,15), then the lower stopping point is (105, 95, 110). If crUpperTolerance is (20,30,15), then the upper stopping point is (145,155,140). In this case, the pixels with values between (105,95,110) and (145,155,140) are non-border pixels and will be included in the region. Any pixel with a value outside this range or equal to crBorderColor is considered a border pixel.

 

For gray scale bitmaps:

The minimum channel tolerance value of crLowerTolerance will be used to set the lower stopping point, and the minimum channel tolerance value of crUpperTolerance 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 crLowerTolerance 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 crUpperTolerance is (10,25,20), the smallest value of that triplet (10) will be used to create the upper stopping point of (135,135,135). In this case, the pixels with values between (110, 110, 110) and (135,135,135) are non-border pixels and will be included in the region. Any pixel with a value outside this range or equal to crBorderColor is considered a border pixel.

To update an existing region, you specify how the new region is to be combined with the

existing one. For possible values, refer to Flags for Setting a Region.

This method does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this method.

See Also

Elements:

SetRgnColor method, SetRgnMagicWand method.

Topics:

Raster Images: Creating and Using a Region

 

Using Color Values in LEADTOOLS