L_GetPlaybackIndex

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_GetPlaybackIndex(hPlayback, pnIndex)

HPLAYBACK hPlayback;

/* playback handle */

L_INT L_FAR * pnIndex;

/* address of the variable to be updated */

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

Parameter

Description

hPlayback

Handle that references the animation playback.

pnIndex

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Required DLLs and Libraries

LTDIS

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

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.

See Also

Functions:

L_CreatePlayback, L_DestroyPlayback, L_GetPlaybackDelay, L_CancelPlaybackWait, L_ProcessPlayback, L_ClearPlaybackUpdateRect, L_GetPlaybackState, L_GetPlaybackUpdateRect, L_SetPlaybackIndex, L_AppendPlayback, L_ValidatePlaybackLines

Topics:

Raster Image Functions: Creating and Maintaining Lists of Images

 

Implementing Animation

Example

/* This example uses L_GetPlaybackIndex and L_SetPlaybackIndex to skip
bitmaps during a playback. */
void TestPlayback(HWND hWnd, pBITMAPHANDLE pTargetBitmap, HBITMAPLIST hList)
{
   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_UINT uIndex = 0;         /* Current index to the bitmap list */
   L_UINT uCount = 0;         /* Number of bitmaps in the list */
   HPALETTE hpalPaint;

   /* Use the client area as the display rectangle */
   GetClientRect(hWnd,&rcDisplay);
   /* Get the number of bitmaps in the list */
   L_GetBitmapListCount(hList, &uCount);
   /* Create and run the playback */
   L_CreatePlayback(&hPlayback, pTargetBitmap, hList);
   do
   {
      L_ProcessPlayback(hPlayback, &uState);
      switch(uState)
      {
      case PLAYSTATE_PRERENDER:
         L_GetPlaybackIndex(hPlayback, &uIndex);
         L_SetPlaybackIndex(hPlayback, ++uIndex);
         break;
      case PLAYSTATE_POSTRENDER:
         L_GetPlaybackUpdateRect(hPlayback, &rcUpdate, TRUE);
         hdc = GetDC(hWnd);
         if (hpalPaint)
         {
            hPalette = SelectPalette (hdc, hpalPaint, TRUE);
            RealizePalette(hdc);
         }
         L_PaintDC(hdc, pTargetBitmap, NULL, &rcUpdate, &rcDisplay, &rcDisplay, SRCCOPY);
         if (hpalPaint)
            SelectPalette (hdc, hPalette, TRUE);
         ReleaseDC(hWnd, hdc);
         break;
      }
   } while(uIndex < uCount);
   /* Clean up */
   L_DestroyPlayback(hPlayback, NULL);
}