#include "l_bitmap.h"

L_LTIMGEFX_API L_INT L_ResizeBitmapRgn(pBitmap, uDim, uFlags, bAsFrame)

Resizes a bitmap region by the specified number of pixels.



Pointer to the bitmap handle that references the bitmap to resize.


Number of pixels by which to resize the region.

L_UINT uFlags

Flag that indicates whether to contract or expand the bitmap region. Possible values are:

Value Meaning
RGN_EXPAND [0x0001] Expand the region.
RGN_CONTRACT [0x0002] Contract the region.

L_BOOL bAsFrame

Flag that indicates whether to create a frame associated with the resized bitmap region. Possible values are:

Value Meaning
TRUE Create a frame of thickness uDim for the resized region. If uFlags is RGN_EXPAND, the frame created will exist outside the boundaries of the resized region. If uFlags is RGN_CONTRACT, the frame will be within the boundaries of the resized region.
FALSE Resize the region only. Do not create a frame.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


This function keeps the same bitmap handle and resizes the bitmap region that it references.

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 in the Document and Medical Imaging toolkits.

This function supports 32-bit grayscale images.

Required DLLs and Libraries


Win32, x64.

See Also




For complete sample code, refer to the ImgChd.c module of the IMGFEATR example.
This example changes a bitmap region size

L_INT ResizeBitmapRgnExample() 
   L_INT nRet; 
   RECT rRgnRect;               /* Rectangle that defines the region */ 
   BITMAPHANDLE Bitmap; /* Bitmap handle to hold the loaded image. */ 
   /* Load a bitmap */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &Bitmap, sizeof(BITMAPHANDLE),0,ORDER_BGR,NULL, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Specify a rectangle to define a region , this region specify by the mouse on IMGFEATR demo*/ 
   SetRect(&rRgnRect, 80, 20, 100, 40); 
   /* Create an elliptical region */  
   nRet = L_SetBitmapRgnEllipse(&Bitmap, NULL, &rRgnRect, L_RGN_SET); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* contract the bitmap region by 20 pixels*/ 
   nRet = L_ResizeBitmapRgn(&Bitmap, 20, RGN_CONTRACT, FALSE); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Free the region */ 
   //free Bitmap 
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &Bitmap, FILE_BMP, 24, 0, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   return SUCCESS; 

Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help