L_GetBitmapRgnHandle

Summary

Creates a Windows region that is a snapshot of the bitmap region and assigns the handle to a variable that you supply.

Syntax

#include "l_bitmap.h"

L_LTDIS_API L_INT L_GetBitmapRgnHandle(pBitmap, pXForm, phRgn)

Parameters

pBITMAPHANDLE pBitmap

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

pRGNXFORM 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.

L_HRGN* phRgn

Pointer to the Windows region handle. You do not have to create the region. You just declare the HRGN variable and pass its address.

Returns

Value Meaning
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.

If you want to assign a region from one bitmap to another, you must use the L_GetBitmapRgnHandle function to get region from the first bitmap; then use the L_SetBitmapRgnHandle function to assign the region to the second bitmap.

Because this function updates some members of the BITMAPHANDLE structure, it is not safe to call it from multiple threads using the same pBitmap.

You are responsible for deleting the Windows region to free memory when the region is no longer needed. To do so, use the Windows DeleteObject function. The following is a list of Windows functions that relate to Windows regions:

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

For an example, refer to L_SetBitmapRgnHandle.
For a complete sample code, refer to the DRAW example.

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.