L_CopyBitmapListItems

#include "l_bitmap.h"

L_LTKRN_API L_INT L_CopyBitmapListItems(phList, hList, uIndex, uCount)

Creates a new bitmap list by copying the specified bitmaps from an existing list. Bitmap handles and image data are copied.

Parameters

pHBITMAPLIST phList

Address of the variable to be updated with the new list of bitmaps.

HBITMAPLIST hList

Handle to the list of bitmaps to copy from.

L_UINT uIndex

Index of the first bitmap to copy.

L_UINT uCount

Number of bitmaps to copy. You can specify (L_UINT) -1 to copy to the end of the existing list.

Returns

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

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example copies all but the first two bitmaps in a list of bitmaps; then calls another function to save the copied list.

L_INT SaveBitmapList(pBITMAPHANDLE   pBitmap,/* Bitmap handle for the playback target */ 
                     HBITMAPLIST    hList) 
{ 
   L_INT nRet; 
   BITMAPHANDLE   TmpBitmap; /* Temporary bitmap handle  */ 
   SAVEFILEOPTION SaveFileOption; /* File options when saving */ 
 
   /* Get a copy of the first image's bitmap handle */ 
   nRet = L_GetBitmapListItem(hList, 0, &TmpBitmap, sizeof(BITMAPHANDLE)); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Get the default SAVEFILEOPTION values */ 
   nRet = L_GetDefaultSaveFileOption(&SaveFileOption, sizeof(SAVEFILEOPTION)); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Use the target bitmap's palette as the global palette */ 
   nRet = L_GetBitmapColors(pBitmap, 0, 256, SaveFileOption.GlobalPalette); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Assign the other SAVEFILEOPTION fields */ 
   SaveFileOption.Flags             = ESO_GLOBALBACKGROUND|ESO_GLOBALPALETTE; 
   SaveFileOption.GlobalWidth       = TmpBitmap.Width; 
   SaveFileOption.GlobalHeight      = TmpBitmap.Height; 
   SaveFileOption.GlobalLoop        = 0; 
   SaveFileOption.GlobalBackground  = pBitmap->Background; 
 
   /* Save the bitmap list as an animated GIF file */ 
   nRet = L_SaveBitmapList(MAKE_IMAGE_PATH(TEXT("testan.gif")), hList, FILE_GIF, 8, 0, &SaveFileOption); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   return SUCCESS; 
} 
 
L_INT CopyBitmapListItemsExample(HBITMAPLIST hList) 
{ 
   L_INT nRet; 
   HBITMAPLIST    hNewList; 
   BITMAPHANDLE   LeadBitmap; 
   L_CreateBitmap(&LeadBitmap, sizeof(BITMAPHANDLE), TYPE_CONV, 300, 300, 8, ORDER_RGB, NULL, TOP_LEFT, NULL, 0); 
   /* Copy all but the first two bitmaps of the incoming list */ 
   nRet = L_CopyBitmapListItems(&hNewList, hList, 2, (L_UINT) -1); 
   if(nRet != SUCCESS) 
   { 
      L_FreeBitmap(&LeadBitmap); 
      return nRet; 
   } 
   /* Call a local function to save the new list */ 
   nRet = SaveBitmapList(&LeadBitmap, hNewList); /* Refer to the nRet = L_SaveBitmapList example */ 
   L_FreeBitmap(&LeadBitmap); 
   L_DestroyBitmapList(hNewList); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C API Help