L_SetBitmapRgnMagicWand
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_SetBitmapRgnMagicWand(pBitmap, x, y, crLowerTolerance, crUpperTolerance, uCombineMode)
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
L_INT x; |
/* x coordinate */ |
L_INT y; |
/* y coordinate */ |
COLORREF crLowerTolerance; |
/* upper tolerance values */ |
COLORREF crUpperTolerance; |
/* upper tolerance values */ |
L_UINT uCombineMode; |
/* action to take regarding the existing region */ |
Sets a region based on the color found at point x, y in the bitmap.
Parameter |
Description |
pBitmap |
Pointer to the bitmap handle referencing the bitmap. |
x |
X coordinate of a point. The color of the specified point will be used to set the region. |
y |
Y coordinate of a point. The color of the specified point will be used to set the region. |
crLowerTolerance |
Lower tolerance values that set the lower stopping point for the region. |
crUpperTolerance |
Upper tolerance values that set the upper stopping point for the region. |
uCombineMode |
The action to take regarding the existing bitmap region, if one is defined. For descriptions of the possible values, refer to Creating a Bitmap Region. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
To update an existing region, you specify how the new region is to be combined with the existing one. For descriptions of the possibilities, refer to Creating a Bitmap Region.
For gray scale bitmaps:
The minimum channel tolerance value of crLowerTolerance will be used to set the lower stopping point, and the 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).
This function 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 function.
This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.
Required DLLs and Libraries
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 95 / 98 / Me, Windows 2000 / XP.
See Also
Functions: |
L_SetBitmapRgnColor, L_HolesRemovalBitmapRgn, L_SetBitmapRgnBorder |
Topics: |
|
|
|
|
|
|
Example
L_VOID SetRgn(pBITMAPHANDLE pBitmap, HWND hWnd, L_INT x, L_INT y)
{
L_INT nRet;
RGNXFORM XForm;
L_PointToBitmap(pBitmap, TOP_LEFT, &x, &y);
if(L_BitmapHasRgn(pBitmap))
nRet = L_SetBitmapRgnMagicWand(pBitmap, x, y, (20,30,15),(15,30,10), L_RGN_OR);
else
nRet = L_SetBitmapRgnMagicWand(pBitmap, x, y, (20,30,15),(15,30,10), L_RGN_SET);
if(nRet == SUCCESS)
{
if(L_BitmapHasRgn(pBitmap))
{
HDC hDC=GetDC(hWnd);
XForm.uViewPerspective=TOP_LEFT;
XForm.nXScalarNum=1;
XForm.nXScalarDen=1;
XForm.nYScalarNum=1;
XForm.nYScalarDen=1;
XForm.nXOffset=0;
XForm.nYOffset=0;
L_FrameBitmapRgn(hDC, pBitmap, &XForm, 3);
ReleaseDC(hWnd, hDC);
}
else
MessageBox(hWnd, TEXT("no rgn"), TEXT("error"), MB_OK);
}
return;
}