Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_FrameBitmapRgn
#include "l_bitmap.h"
L_LTDIS_API L_INT L_FrameBitmapRgn(hDC, pBitmap, pXForm, uType)
L_HDC hDC; |
/* handle to a device context where the image is displayed */ |
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
pRGNXFORM pXForm; |
/* pointer to a structure for coordinate translation */ |
L_UINT uType; |
/* type of frame to display */ |
Displays an outline of the bitmap region. If the region includes noncontiguous shapes, each shape is outlined. The outline, itself, is inside the region.
Parameter |
Description |
hDC |
Handle to a device context where the image is displayed and where the frame is to appear. |
pBitmap |
Pointer to the bitmap handle referencing the bitmap that has the region. |
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 bitmap's view perspective. |
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. |
|
L_FRAME_MOVING0 [0] |
|
L_FRAME_MOVING1 [1] |
|
L_FRAME_MOVING2 [2] |
|
L_FRAME_MOVING3 [3] |
|
L_FRAME_MOVING4 [4] |
|
L_FRAME_MOVING5 [5] |
|
L_FRAME_MOVING6 [6] |
|
L_FRAME_MOVING7 [7] |
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.
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
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
Windows 2000 / XP/Vista.
See Also
Functions: |
|
Topics: |
|
|
|
|
|
|
Example
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); }