Displays an outline of the bitmap region. If the region includes noncontiguous shapes, each shape is outlined. The outline, itself, is inside the region.


#include "l_bitmap.h"

L_LTDIS_API L_INT L_FrameBitmapRgn(hDC, pBitmap, pXForm, uType)



Handle to a device context where the image is displayed and where the frame is to appear.


Pointer to the bitmap handle referencing the bitmap that has the region.


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 bitmap's view perspective.

L_UINT uType

The type of frame to display. The following are valid values. To animate the frame, you must cycle through the values using a timer event.


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


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.

This function is designed to produce an animated frame, which you can implement by calling the function with a timer event that cycles through the possible frame types.

Required DLLs and Libraries


Win32, x64.

See Also




For a complete sample code, refer to the CHILD.C module of the DEMO example.
This example, which displays an animated frame around a bitmap region, includes sections from a programs message-processing function.

static BITMAPHANDLE   LeadBitmap;                  /* Bitmap handle to hold the loaded image. */ 
static L_INT          DisplayWidth, DisplayHeight; /* Dimensions of the displayed image */ 
extern "C" L_INT TestFunction(L_HWND hWnd) 
   return SUCCESS; 
extern "C" L_INT32 WINAPI MainWndProc(L_HWND hWnd, L_UINT Message, WPARAM wParam, LPARAM lParam) 
   HDC            hdc;             /* Device context used with the palette functions */ 
   RGNXFORM       XFormFromBitmap; /* Structure for transforming bitmap coordinates */ 
   RECT           rClientSize; 
   static L_UINT  FrameType; 
   L_INT          nRet; 
   GetClientRect(hWnd, &rClientSize); 
   switch (Message) 
   case WM_CREATE: 
      /* Load the bitmap and create the region */ 
      /* Set the timer for the region frame */ 
      SetTimer(hWnd, 1, 400, NULL); 
   case WM_TIMER: 
      /* Do nothing if there is no region */ 
      if (!L_BitmapHasRgn(&LeadBitmap)) 
         return SUCCESS; 
      /* Set the frame type */ 
      FrameType = (FrameType + 1) % 8; 
      /* Get the device context */ 
      hdc = GetDC(hWnd); 
      /* Set XFormFromBitmap fields, assuming that the display rectangle is the same 
      as the client area of the current window */ 
      XFormFromBitmap.uViewPerspective = TOP_LEFT; 
      XFormFromBitmap.nXScalarNum = rClientSize.right - rClientSize.left; 
      XFormFromBitmap.nXScalarDen = DisplayWidth; 
      XFormFromBitmap.nYScalarNum = rClientSize.bottom - rClientSize.top; 
      XFormFromBitmap.nYScalarDen = DisplayHeight; 
      XFormFromBitmap.nXOffset = 0; 
      XFormFromBitmap.nYOffset = 0; 
      /* Display the frame */ 
      nRet = L_FrameBitmapRgn(hdc, &LeadBitmap, &XFormFromBitmap, FrameType); 
      if (nRet != SUCCESS) 
         return nRet; 
   return (0); 

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

LEADTOOLS Raster Imaging C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.