LPlayBack::Process

#include "ltwrappr.h"

virtual L_UINT LPlayBack::Process()

Processes the next state during an animation playback.

Returns

A constant that describes the new state of the animation playback engine. For possible values, refer to Animation Playback States.

Comments

This function is called in a loop, to continually process the class object's animation playback.

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 loads a bitmap list from an animated GIF or AVI file.

It then plays the animation, using the current bitmap as the target.

// Process Example
L_INT LPlayBack__ProcessExample(L_TCHAR * pszFilename, HWND hWnd)
{
   L_INT nRet;
   LBitmapList BitmapList; /* Bitmap list */
   LBitmapBase LeadBitmap; /* Bitmap handle for the loaded image. */
   LPlayBack Playback; /* 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 */
   /* Create the bitmap list from the input file (GIF or AVI) */
   nRet = BitmapList.Load (pszFilename);
   if(nRet != SUCCESS)
      return nRet;
   /* Get a copy of the first image's bitmap handle */
   LeadBitmap = BitmapList[0];
   /* Use the client area as the display rectangle, 
   assuming that the window is properly sized */
   GetClientRect(hWnd,&rcDisplay);
   /* Create the target bitmap that is used for playback */
   /* Create and run the playback */
   nRet = Playback.Create (&LeadBitmap, &BitmapList);
   if(nRet != SUCCESS)
      return nRet;
   if(Playback.IsCreated() == FALSE)
      return FAILURE;
   do
   {
      uState = Playback.Process ();
      switch(uState)
      {
      case PLAYSTATE_WAITINPUT:
            //Playback.caL_CancelPlaybackWait(hPlayback);
            break;
      case PLAYSTATE_POSTCLEAR:
      case PLAYSTATE_POSTRENDER:
         nRet = Playback.GetUpdateRect (&rcUpdate, TRUE);
         if(nRet != SUCCESS)
            return nRet;
         hdc = GetDC(hWnd);
         Playback.GetBitmap()->Paint()->SetDC(hdc);
         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;
         nRet = Playback.GetBitmap()->Paint()->PaintDC();
         if(nRet != SUCCESS)
            return nRet;
         ReleaseDC(hWnd, hdc);
         break;
      }
   } while(uState != PLAYSTATE_END);
   /* Clean up */
   // No need to call destroy it is only for sample purposes
   // the destructor will call destroy if it was not called here
   nRet = Playback.Destroy (NULL);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}