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.

Platforms

Win32, x64.

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.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
// 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; 
   /* Set the background bitmap*/ 
   nRet = LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp"))); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* 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; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help