LPlayBack::GetIndex

#include "ltwrappr.h"

virtual L_INT LPlayBack::GetIndex()

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

Returns

The index of the current bitmap.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example uses LPlayBack::GetIndex and LPlayBack::SetIndex to skip
bitmaps during a playback.

L_INT LPlayBack__GetIndexExample(HWND hWnd, L_TCHAR *pszFileName) 
 
{ 
   L_INT nRet; 
   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) */ 
 
   nRet = BitmapList.Load (pszFileName); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Set the background bitmap*/ 
   nRet = TargetBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp"))); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* 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 */ 
   nRet = PlayBack.Create(&TargetBitmap, &BitmapList); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   do 
   { 
      uState = PlayBack.Process(); 
      switch(uState) 
      { 
      case PLAYSTATE_PRERENDER: 
         uIndex = PlayBack.GetIndex(); 
         nRet = PlayBack.SetIndex( ++uIndex); 
         if(nRet != SUCCESS) 
            return nRet; 
         break; 
 
      case PLAYSTATE_POSTRENDER: 
         nRet = PlayBack.GetUpdateRect(&rcUpdate, TRUE); 
         if(nRet != SUCCESS) 
            return nRet; 
         hdc = GetDC(hWnd); 
 
         nRet = PlayBack.GetBitmap()->SetClipSrcRect(&rcUpdate); 
         if(nRet != SUCCESS) 
            return nRet; 
 
         nRet = PlayBack.GetBitmap()->SetDstRect(&rcDisplay); 
         if(nRet != SUCCESS) 
            return nRet; 
 
         nRet = PlayBack.GetBitmap()->SetClipDstRect(&rcDisplay); 
         if(nRet != SUCCESS) 
            return nRet; 
 
         PlayBack.GetBitmap()->Paint()->SetDC(hdc); 
 
         PlayBack.GetBitmap()->CreatePaintPalette (hdc); 
 
         nRet = PlayBack.GetBitmap()->Paint()->PaintDC(); 
         if(nRet != SUCCESS) 
            return nRet; 
 
         ReleaseDC(hWnd, hdc); 
 
         break; 
      } 
 
   } while(uIndex < uCount); 
 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C++ Class Library Help

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