#include "l_bitmap.h"
L_LTDIS_API L_INT L_FrameBitmapRgn(hDC, pBitmap, pXForm, uType)
Displays an outline of the bitmap region. If the region includes noncontiguous shapes, each shape is outlined. The outline, itself, is inside the region.
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.
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.
For 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 */
L_INT TestFunction(L_HWND hWnd)
{
UNREFERENCED_PARAMETER(hWnd);
return SUCCESS;
}
/****************************************************************************************/
L_INT32 WINAPI MainWndProc (L_HWND hWnd,
L_UINT Message,
WPARAM wParam,
LPARAM lParam)
{
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(lParam);
HDC hdc; /* Device context used with the palette functions */
RGNXFORM XFormFromBitmap; /* Structure for transforming bitmap coordinates */
RECT rClientSize;
static L_UINT FrameType;
GetClientRect (hWnd, &rClientSize);
switch (Message)
{
case WM_CREATE:
/* Load the bitmap and create the region */
TestFunction(hWnd);
/* 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(0);
/* 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 */
L_FrameBitmapRgn(hdc, &LeadBitmap, &XFormFromBitmap, FrameType);
}
return (0);
}
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