L_SetBitmapRgnFromMask

#include "l_bitmap.h"

L_LTDIS_API L_INT L_SetBitmapRgnFromMask(pBitmap, pXForm, pMask, uCombineMode)

pBITMAPHANDLE pBitmap;

pointer to the target bitmap handle

pRGNXFORM pXForm;

pointer to a coordinate-translation structure

pBITMAPHANDLE pMask;

pointer to the mask bitmap handle

L_UINT uCombineMode;

action to take regarding the existing region

Creates or updates the bitmap region by adding a region that consists of all the white pixels in a 1-bit mask image.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap where the region is to be created or updated.

pXForm

Pointer to an RGNXFORM structure that LEADTOOLS uses to translate between display coordinates and bitmap coordinates.

 

If you specify NULL in this parameter, the scalar fields default to 1, the offsets default to 0, and the view perspective defaults to the target bitmap's view perspective.

pMask

The 1-bit black-and-white image used as a mask.

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

Before calling this function, you must declare an RGNXFORM structure and set its values, which LEADTOOLS uses to translate between device context coordinates and bitmap coordinates. For details about how the structure works refer to the RGNXFORM structure description. For a description of common usage, refer to Translating Coordinates for a Bitmap Region.

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.

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

Win32, x64, Linux.

See Also

Functions:

L_GetBitmapAlpha, L_SetBitmapAlpha, L_CreateMaskFromBitmapRgn

Topics:

Defining and Using a Bitmap Region

 

Saving a Region

Example

This example sets a region into a bitmap using a 1-bit black-and-white mask image.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT SetBitmapRgnFromMaskExample(pBITMAPHANDLE pBitmap) 
{ 
   L_INT nRet; 
   BITMAPHANDLE MaskBitmap; /* Bitmap handle that holds the mask bitmap */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("clean.tif")), &MaskBitmap, sizeof(BITMAPHANDLE), 1, ORDER_BGR, NULL, NULL ); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_SetBitmapRgnFromMask ( pBitmap, NULL, &MaskBitmap, L_RGN_SET ); 
   if(nRet != SUCCESS) 
   { 
      if(MaskBitmap.Flags.Allocated) 
         L_FreeBitmap(&MaskBitmap); 
      return nRet; 
   } 
   if(MaskBitmap.Flags.Allocated) 
      L_FreeBitmap(&MaskBitmap); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help