#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). |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
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
For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64, Linux.
Functions: |
|
|
|
Topics: |
|
|
|
|
This example loads an image, sets a color region using black, and then creates a 1-bit mask image from that bitmap.
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
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 (MAKE_IMAGE_PATH(TEXT("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(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &MaskBitmap, FILE_BMP, 24, 0, NULL);
if(nRet != SUCCESS)
return nRet;
L_FreeBitmap(&LeadBitmap);
L_FreeBitmap(&MaskBitmap);
return SUCCESS;
}
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET