#include "l_bitmap.h"
L_LTDIS_API L_INT L_CreateMaskFromBitmapRgn(pBitmap, pMask, uStructSize)
Creates a 1-bit mask image from the region that is defined in the source bitmap.
Pointer to the bitmap handle referencing the source bitmap, where the region is defined.
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.
Size in bytes, of the structure pointed to by pBitmap
, for versioning. Use sizeof(BITMAPHANDLE).
Value | Meaning |
---|---|
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
Win32, x64, Linux.
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 (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;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document