L_ClearPlaybackUpdateRect

#include "l_bitmap.h"

L_LTDIS_API L_INT L_ClearPlaybackUpdateRect(hPlayback)

HPLAYBACK hPlayback;

/* playback handle */

Clears the update rectangle used for an animation playback, leaving an empty rectangle.

Parameter

Description

hPlayback

Handle that references the animation playback.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Regions are not supported on the Windows CE platform.

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 2000 / XP/Vista, Windows CE.

See Also

Functions:

L_CreatePlayback, L_DestroyPlayback,

 

L_GetPlaybackDelay, L_CancelPlaybackWait,

 

L_ProcessPlayback, L_GetPlaybackIndex,

 

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_ClearPlaybackUpdateRect to avoid painting odd numbered bitmaps.

 L_INT ClearPlaybackUpdateRectExample(L_HWND  hWnd,pBITMAPHANDLE   pTargetBitmap, HBITMAPLIST   hList)
{
   L_INT nRet;
   HPALETTE    hpalPaint = NULL;  /* Paint palette handle */
   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 */

   /* Use the client area as the display rectangle */
   GetClientRect(hWnd,&rcDisplay);
   /* 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_POSTRENDER:
         nRet = L_GetPlaybackIndex(hPlayback, (L_INT*)&uIndex);
         if(nRet != SUCCESS)
            return nRet;
         if(uIndex % 2)
         {
            nRet = L_ClearPlaybackUpdateRect(hPlayback);
            if(nRet != SUCCESS)
               return nRet;
         }
         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(uState != PLAYSTATE_END);
   /* Clean up */
   nRet = L_DestroyPlayback(hPlayback, NULL);
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}