L_GetPlaybackIndex

#include "l_bitmap.h"

L_LTDIS_API L_INT L_GetPlaybackIndex(hPlayback, pnIndex)

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

Parameters

HPLAYBACK hPlayback

Handle that references the animation playback.

L_INT *pnIndex

Address of the variable to be updated with the index of the current bitmap.

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 uses L_GetPlaybackIndex and L_SetPlaybackIndex to skip
bitmaps during a playback.

L_INT GetPlaybackIndexExample(L_HWND             hWnd, 
                               pBITMAPHANDLE    pTargetBitmap, 
                               HBITMAPLIST      hList) 
{ 
   L_INT nRet; 
   HPLAYBACK   hPlayback;       /* Animation playback */ 
   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 */ 
   HPALETTE    hPalette = NULL; /* Temporary copy of the current system palette */ 
   L_INT       nIndex = 0;      /* Current index to the bitmap list */ 
   L_UINT      uCount = 0;      /* Number of bitmaps in the list */ 
   HPALETTE    hpalPaint = NULL; 
 
   /* Use the client area as the display rectangle */ 
   GetClientRect(hWnd,&rcDisplay); 
   /* Get the number of bitmaps in the list */ 
   nRet = L_GetBitmapListCount(hList, &uCount); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Create and run the playback */ 
   nRet = L_CreatePlayback(&hPlayback, pTargetBitmap, hList); 
   if(nRet != SUCCESS) 
      return nRet; 
   do 
   { 
      nRet = L_ProcessPlayback(hPlayback, &uState); 
      if(nRet != SUCCESS) 
         return nRet; 
      switch(uState) 
      { 
      case PLAYSTATE_PRERENDER: 
         nRet = L_GetPlaybackIndex(hPlayback, &nIndex); 
         if(nRet != SUCCESS) 
            return nRet; 
         nRet = L_SetPlaybackIndex(hPlayback, ++nIndex); 
         if(nRet != SUCCESS) 
            return nRet; 
         break; 
      case PLAYSTATE_POSTRENDER: 
         nRet = L_GetPlaybackUpdateRect(hPlayback, &rcUpdate, TRUE); 
         if(nRet != SUCCESS) 
            return nRet; 
         hdc = GetDC(hWnd); 
         if (hpalPaint) 
         { 
            hPalette = SelectPalette (hdc, hpalPaint, TRUE); 
            RealizePalette(hdc); 
         } 
         nRet = L_PaintDC(hdc, pTargetBitmap, NULL, &rcUpdate, &rcDisplay, &rcDisplay, SRCCOPY); 
         if(nRet != SUCCESS) 
            return nRet; 
         if (hpalPaint) 
            SelectPalette (hdc, hPalette, TRUE); 
         ReleaseDC(hWnd, hdc); 
         break; 
      } 
   } while(nIndex < (L_INT) uCount); 
   /* Clean up */ 
   nRet = L_DestroyPlayback(hPlayback, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C API Help

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