L_CopyBitmapHandle

#include "l_bitmap.h"

L_LTKRN_API L_INT L_CopyBitmapHandle(pBitmapDst, pBitmapSrc, uStructSize)

pBITMAPHANDLE pBitmapDst;

/* pointer to the destination bitmap handle */

pBITMAPHANDLE pBitmapSrc;

/* pointer to the source bitmap handle */

L_UINT uStructSize;

/* size in bytes, of the structure pointed to by pBitmapDst */

Copies one bitmap handle to another. This function copies only the bitmap handle; it does not copy the actual image data.

Parameter

Description

pBitmapDst

Pointer to the bitmap handle referencing the destination bitmap.

pBitmapSrc

Pointer to the bitmap handle referencing the source bitmap to copy.

uStructSize

Size in bytes, of the structure pointed to by pBitmapDst, for versioning. Use sizeof(BITMAPHANDLE).

Returns

None.

Comments

The palette referenced by the hPalette field is not duplicated; the hPalette field is copied the same way as other fields in the bitmap handle.

Note that the destination bitmap does not have to be allocated for this function to work. Use L_CopyBitmapData to copy the contents of the image data from one bitmap to another.

Required DLLs and Libraries

LTKRN

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, Windows CE.

See Also

Functions:

L_CopyBitmap, L_CopyBitmapData,

 

L_CopyBitmapRect

Topics:

Raster Image Functions: Copying Images

 

Raster Image Functions: Palettes

 

Raster Image Functions: Using the Clipboard

Example

For complete sample code, refer to the FEATURE1 example. This example loads a temporary bitmap and copies its handle to the new bitmap. Notice that TmpBitmap is not freed, because the new bitmap handle references the original image data.

 L_INT CopyBitmapHandleExample(pBITMAPHANDLE pBitmap)
{
   L_INT nRet;
   BITMAPHANDLE TmpBitmap;    /* Bitmap handle for the initial image */
   /* Load a bitmap at its own bits per pixel */
   nRet = L_LoadBitmap (TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\image3.cmp"), &TmpBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;
   /* Copy bitmap handle to the new bitmap */
   if(pBitmap->Flags.Allocated)
      L_FreeBitmap(pBitmap);
   nRet = L_CopyBitmapHandle(pBitmap, &TmpBitmap, sizeof(BITMAPHANDLE));
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}