LAnimationWindow::SetBitmapList

#include "ltwrappr.h"

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

LBitmapList L_FAR * pBitmapList;

/* pointer to an LBitmapList object */

LBitmapList L_FAR * 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

#include <ltlck.h> //Unlock support

L_VOID TestFunction(HWND hWndParent)
{
   
LBase::LoadLibraries(LT_ALL_LEADLIB); //make sure all libraries are loaded
   
WRPUNLOCKSUPPORT();//unlock GIF support

   
LBitmapList MyBitmapList; //Create a bitmaplist

   
if (MyBitmapList.Load (TEXT("eye.gif"))==SUCCESS)
   
{
      
LAnimationWindow MyAnimation;

      
MyAnimation.SetBitmapList(&MyBitmapList);
      
MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,300,300);
      
MyAnimation.PlayAnimation();
      
while (MyAnimation.IsPlaying())
      
{
         
if (MyAnimation.DoEvents())
            
break;
      
}
   
}
   
else
      
MessageBox(hWndParent, TEXT("Failed to load file"),TEXT("Error!"),MB_OK | MB_ICONSTOP);
}

Example2:

#include <ltlck.h> //Unlock support

L_VOID TestFunction(HWND hWndParent)
{
   
LBase::LoadLibraries
(LT_ALL_LEADLIB); //make sure all libraries are loaded
   
WRPUNLOCKSUPPORT(); //unlock GIF support

   
L_INT nRetCode;
   
LBitmap Bitmap;
   
LBitmapList MyBitmapList;
   
LAnimationWindow MyAnimation;
   
L_TCHAR L_FAR * pszFiles[] =
      
{TEXT("image1.cmp"),
      
TEXT("image2.cmp"),
      
TEXT("image3.cmp")};
   
MyBitmapList.Create();

   
for (int i = 0 ; i<3; i++)
   
{
      
nRetCode = Bitmap.Load(pszFiles[i]);
      
if (nRetCode !=SUCCESS)
      
{
         
MessageBox(hWndParent, TEXT("Failed to load file"),TEXT("Error!"),MB_OK | MB_ICONSTOP);
         
return;
      
}
      
MyBitmapList.InsertItem(&Bitmap);
   
}
   
MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,800,600);
   
MyAnimation.SetBitmapList(&MyBitmapList);
   
MyAnimation.SetDelay(1000);
   
MyAnimation.SetDisposalMethod(DISPOSAL_RESTOREBACKGROUND);
   
MyAnimation.SetBackgroundColor(RGB(255,255,255));
   
MyAnimation.PlayAnimation();
   
while (MyAnimation.IsPlaying())
   
{
      
if (MyAnimation.DoEvents())
         
break;
   
}
   
MessageBox(hWndParent, TEXT("Press Ok to terminate"),TEXT("Error!"),MB_OK | MB_ICONSTOP);
}