LAnimationWindow::SetBitmapList

#include "ltwrappr.h"

L_VOID LAnimationWindow::SetBitmapList(pBitmapList, pBitmapListPrev=NULL, nBitsPerPixel=0, nColorOrder=ORDER_BGRORGRAY)

LBitmapList * pBitmapList;

/* pointer to an LBitmapList object */

LBitmapList * pBitmapListPrev;

/* pointer to an LBitmapList object */

L_INT nBitsPerPixel;

/* the number of bits per pixel for the playback bitmap */

L_INT nColorOrder;

/* color order of the playback bitmap */

Provides a way to overwrite the internal bitmap list of an LAnimationWindow object.

Parameter

Description

pBitmapList

Pointer to an LBitmapList object. This is the new bitmap to attach to the LAnimationWindow object.

pBitmapListPrev

Pointer to an LBitmapList object to hold the previous bitmaplist used by the LAnimationWindow object.

nBitsPerPixel

Number of bits per pixel for the playback bitmap.

nColorOrder

Color order of the playback bitmap. Possible values are:

 

Value

Meaning

 

ORDER_RGB

[0] The input colors are in red-green-blue order.

 

ORDER_BGR

[1] The input colors are in blue-green-red order.

 

ORDER_GRAY

[2] 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are only supported in the Document/Medical toolkits.

Returns

None

Comments

The pBitmapList must point to a valid LBitmapList object. If you want to get the previous bitmap list used by the LAnimationWindow object, pass a valid pointer to an LBitmapList object in the pBitmapListPrev parameter. If you do this, you must destroy the LBitmapList object yourself when it is no longer needed. Passing NULL for pBitmapListPrev will cause the previous LBitmapList object to be destroyed by the LAnimationWindow object.

Required DLLs and Libraries

LTDIS
LTDLG
LTEFX
LTFIL
LTIMG
LTISI
LTSCR
LTTWN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LAnimationWindow::LAnimationWindow, LAnimationWindow::IsPlaying, LAnimationWindow::PlayAnimation, LAnimationWindow::Load,Class Members

Topics:

Raster Image Functions: Playing Animated Images

 

Implementing Animation

Example

L_INT LAnimationWindow_SetBitmapListFirstExample(HWND hWndParent)
{
   L_INT nRet;
   LBase::LoadLibraries(LT_ALL_LEADLIB); //make sure all libraries are loaded
   WRPUNLOCKSUPPORT();//unlock GIF support
   LBitmapList MyBitmapList; //Create a bitmaplist
   nRet = MyBitmapList.Load (TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\eye.gif"));
   if (nRet==SUCCESS)
   {
      LAnimationWindow MyAnimation;
      MyAnimation.SetBitmapList(&MyBitmapList);
   
      MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,300,300);
      nRet = MyAnimation.PlayAnimation(); 
      if(nRet != SUCCESS)
         return nRet;
 
      while (MyAnimation.IsPlaying())
      {
         if (MyAnimation.DoEvents())
            break; 
      }
   }
   else
   {
      MessageBox(hWndParent, TEXT("Failed to load file"),TEXT("Error!"),MB_OK | MB_ICONSTOP);
      return nRet;   
   }
   return SUCCESS;
}
//Example2:
L_INT LAnimationWindow_SetBitmapListSecondExample(HWND hWndParent)
{
   LBase::LoadLibraries(LT_ALL_LEADLIB); //make sure all libraries are loaded
   WRPUNLOCKSUPPORT(); //unlock GIF support
   L_INT nRet;
   LBitmap Bitmap;
   LBitmapList MyBitmapList;
   LAnimationWindow MyAnimation;
   L_TCHAR  * pszFiles[] = {TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image1.cmp"),
                            TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image2.cmp"),
                            TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image3.cmp")}; 
 
   MyBitmapList.Create();
   for (int i = 0 ; i<3; i++)
   {
      nRet = Bitmap.Load(pszFiles[i]);
      if (nRet !=SUCCESS)
      {
         MessageBox(hWndParent, TEXT("Failed to load file"),TEXT("Error!"),MB_OK | MB_ICONSTOP);
         return nRet;
      }
      nRet = MyBitmapList.InsertItem(&Bitmap);
      if(nRet != SUCCESS)
         return nRet;
   }
   MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,800,600);
   MyAnimation.SetBitmapList(&MyBitmapList);
   
   nRet = MyAnimation.SetDelay(1000);
   if(nRet != SUCCESS)
      return nRet;
   nRet = MyAnimation.SetDisposalMethod(DISPOSAL_RESTOREBACKGROUND);
   if(nRet != SUCCESS)
      return nRet;
   MyAnimation.SetBackgroundColor(RGB(255,255,255));
   
   nRet = MyAnimation.PlayAnimation();
   if(nRet != SUCCESS)
      return nRet;
   while (MyAnimation.IsPlaying())
   {
      if (MyAnimation.DoEvents())
         break; 
   }
   MessageBox(hWndParent, TEXT("Press Ok to nRet = terminate"),TEXT("Error!"),MB_OK | MB_ICONSTOP);
   return SUCCESS;
}