|
Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_CreateMaskFromBitmapRgn
#include "l_bitmap.h"
L_LTDIS_API L_INT L_CreateMaskFromBitmapRgn(pBitmap, pMask, uStructSize)
|
pBITMAPHANDLE pBitmap; |
/* pointer to the source bitmap handle */ |
|
pBITMAPHANDLE pMask; |
/* pointer to the destination bitmap handle */ |
|
L_UINT uStructSize; |
/* size in bytes, of the structure pointed to by pBitmap */ |
Creates a 1-bit mask image from the region that is defined in the source bitmap.
|
Parameter |
Description |
|
pBitmap |
Pointer to the bitmap handle referencing the source bitmap, where the region is defined. |
|
pMask |
Pointer to the bitmap handle referencing the destination bitmap, which will be updated with a 1-bit, black-and-white image, where pixels from the region are white, and all others are black. |
|
uStructSize |
Size in bytes, of the structure pointed to by pBitmap, for versioning. Use sizeof(BITMAPHANDLE). |
Returns
|
SUCCESS |
The function was successful. |
|
< 1 |
An error occurred. Refer to Return Codes. |
Comments
A bitmap region is an area of interest within a bitmap. A bitmap can have only one region at a time, but the region can be complex, including, for example, multiple noncontiguous shapes. For more information, refer to Creating a Bitmap Region.
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 2000 / XP/Vista.
See Also
|
Functions: |
|
|
|
|
|
Topics: |
|
|
|
|
|
|
Example
This example loads an image, sets a color region using black, and then creates a 1-bit mask image from that bitmap.
L_INT CreateMaskFromBitmapRgnExample(L_VOID)
{
L_INT nRet;
BITMAPHANDLE LeadBitmap; /* Bitmap handle that holds the loaded bitmap */
BITMAPHANDLE MaskBitmap; /* Bitmap handle that holds the mask bitmap */
nRet = L_LoadBitmap (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL );
if(nRet != SUCCESS)
return nRet;
nRet = L_SetBitmapRgnColor (&LeadBitmap, RGB( 0,0,0 ), L_RGN_SET );
if(nRet != SUCCESS)
return nRet;
nRet = L_CreateMaskFromBitmapRgn(&LeadBitmap, &MaskBitmap, sizeof(BITMAPHANDLE));
if(nRet != SUCCESS)
return nRet;
nRet = L_SaveBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Result.BMP"), &MaskBitmap, FILE_BMP, 24, 0, NULL);
if(nRet != SUCCESS)
return nRet;
L_FreeBitmap(&LeadBitmap);
L_FreeBitmap(&MaskBitmap);
return SUCCESS;
}