LPlayBack::GetIndex

#include "ltwrappr.h"

virtual L_INT LPlayBack::GetIndex(L_VOID)

Gets the list index of the current bitmap during animation playback.

Returns

The index of the current bitmap.

Required DLLs and Libraries

LTDIS
LTFIL

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:

Class Members

Topics:

Raster Image Functions: Creating and Maintaining Lists of Images

 

Implementing Animation

Example

/* This example uses LPlayBack::GetIndex and LPlayBack::SetIndex to skip
bitmaps during a playback. */
void TestGetIndex(HWND hWnd, L_TCHAR L_FAR *pszFileName)
{
   L_UINT uState; /* Next state in the playback */
   RECT rcUpdate; /* Source clipping rectangle used in playback */
   RECT rcDisplay; /* Display rectangle used in playback */
   HDC hdc; /* Device context of the current window */
   L_UINT uIndex = 0; /* Current index to the bitmap list */
   L_UINT uCount = 0; /* Number of bitmaps in the list */
   LBitmapBase TargetBitmap;
   LBitmapList BitmapList;
   LPlayBack PlayBack;      /* Animation playback */

   /* Create the bitmap list from the input file (GIF or AVI) */
   BitmapList.Load (pszFileName);
   /* Get a copy of the first image's bitmap handle */
   TargetBitmap = BitmapList[0];
   /* Use the client area as the display rectangle */
   GetClientRect(hWnd,&rcDisplay);
   /* Get the number of bitmaps in the list */
   uCount = BitmapList.GetItemsCount(); 
   /* Create and run the playback */
   PlayBack.Create(&TargetBitmap, &BitmapList);
   do
   {
      uState = PlayBack.Process();
      switch(uState)
      {
      case PLAYSTATE_PRERENDER:
         uIndex = PlayBack.GetIndex();
         PlayBack.SetIndex( ++uIndex);
         break;
      case PLAYSTATE_POSTRENDER:
         PlayBack.GetUpdateRect(&rcUpdate, TRUE);
         hdc = GetDC(hWnd);
         PlayBack.GetBitmap()->SetClipSrcRect(&rcUpdate);
         PlayBack.GetBitmap()->SetDstRect(&rcDisplay);
         PlayBack.GetBitmap()->SetClipDstRect(&rcDisplay);
         PlayBack.GetBitmap()->Paint()->SetDC(hdc);
         PlayBack.GetBitmap()->CreatePaintPalette (hdc);
         PlayBack.GetBitmap()->Paint()->PaintDC();
         ReleaseDC(hWnd, hdc);
         break;
      }
   } while(uIndex < uCount);
}