L_CopyBitmap2

#include "l_bitmap.h"

L_LTKRN_API L_INT L_CopyBitmap2(pBitmapDst, pBitmapSrc, uStructSize, uMemory)

Copies an entire image of a source bitmap and places it into a destination bitmap. This also copies all fields in the bitmap handle.

Parameters

pBITMAPHANDLE pBitmapDst

Points to the destination bitmap handle to hold the copied image.

pBITMAPHANDLE pBitmapSrc

Points to the source bitmap handle. You must have a valid image loaded into the bitmap for this function to work.

L_UINT uStructSize

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

L_UINT uMemory

Flag to request the type of memory to allocate. Possible Values are:

Value Meaning
TYPE_CONV [0x0001] Use conventional memory if the image will fit, otherwise swap to disk.
TYPE_USER [0x0002] Create a bitmap where the user maintains the data pointer.
TYPE_TILED [0x0004] Create tiled bitmaps.
TYPE_NOTILED [0x0008] Do not create tiled bitmaps, even if the conventional memory has failed.
TYPE_DISK [0x0080] Do not use conventional memory. Swap to disk only.
TYPE_NODISK [0x0100] Do not swap to disk using LEAD's virtual memory. Windows virtual memory is not affected.
TYPE_COMPRESSED [0x0200] (Document and Medical Imaging toolkits) Allocate an RLE-compressed bitmap. You can use this flag with TYPE_CONV or TYPE_NODISK. For more information, refer to Speeding Up 1-Bit Documents.
TYPE_SUPERCOMPRESSED [0x0400] (Document and Medical Imaging toolkits) Keep images compressed in memory. This option causes slow access, but very low memory usage. This option is available for 1-bit, 8-bit grayscale, and 24-bit images only.

Returns

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

Comments

The destination bitmap must not be allocated before this function is called. If the bitmap is already allocated, you must free it.

If a region is defined for the bitmap, the region is also copied.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example loads TmpBitmap and copies it to pBitmap, specifying TYPE_DISK for the memory allocation.

L_INT CopyBitmap2Example(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 (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &TmpBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Copy the temporary bitmap to the new bitmap and allocate the memory on disk */ 
   if(pBitmap->Flags.Allocated) 
      L_FreeBitmap(pBitmap); 
   nRet = L_CopyBitmap2(pBitmap, &TmpBitmap, sizeof(BITMAPHANDLE), TYPE_DISK); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Clean up */ 
   if(TmpBitmap.Flags.Allocated)   
      L_FreeBitmap(&TmpBitmap); 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.