LPlayBack::ClearUpdateRect

#include "ltwrappr.h"

virtual L_INT LPlayBack::ClearUpdateRect(L_VOID)

Clears the update rectangle used for the class object's animation playback, leaving an empty rectangle.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

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 uses ClearUpdateRect to avoid painting odd numbered bitmaps. */
L_VOID PlayBackSamples(HWND hWnd)
{
   // this will call the default constructor
   LBitmap LeadBitmap;
   LPlayBack PlayBack;
   HDC hDC;
   HPALETTE hPalette;
   L_UINT uState, uIndex;
   RECT rcClientRect, rcUpdate;
   int nCounter = 0;

   GetClientRect(hWnd, &rcClientRect);
   LeadBitmap.Create (500, 500,8);
   
   PlayBack.Create (&LeadBitmap);
   LeadBitmap.Load (TEXT("image1.cmp"), 8);
   PlayBack.Append(&LeadBitmap);
   LeadBitmap.Load (TEXT("image2.cmp"), 8);
   PlayBack.Append(&LeadBitmap);
   LeadBitmap.Load (TEXT("image3.cmp"), 8);

   hDC = GetDC(hWnd);
   hPalette = LeadBitmap.CreatePaintPalette (hDC);
   hPalette = LeadBitmap.DupPalette();
   SelectPalette( hDC, hPalette, TRUE );
   RealizePalette(hDC);

   PlayBack.Append(&LeadBitmap);

   uState = PlayBack.GetState();
   while(uState != PLAYSTATE_END)
   {
      uState = PlayBack.Process();
      switch(uState)
      {
      case PLAYSTATE_WAITINPUT:
            PlayBack.CancelWait();
                     
            break;
      case PLAYSTATE_POSTCLEAR:
      case PLAYSTATE_POSTRENDER:
          uIndex = PlayBack.GetIndex ();
            if(uIndex % 2)
               PlayBack.ClearUpdateRect ();
            PlayBack.GetUpdateRect(&rcUpdate, TRUE);
            PlayBack.GetBitmap()->SetClipSrcRect(&rcUpdate);
            PlayBack.GetBitmap()->SetDstRect(&rcClientRect);
            PlayBack.GetBitmap()->SetClipDstRect(&rcClientRect);
            PlayBack.GetBitmap()->Paint()->SetDC(hDC);
            PlayBack.GetBitmap()->CreatePaintPalette (hDC);
            PlayBack.GetBitmap()->Paint()->PaintDC();
            break;
      }
      nCounter  = PlayBack.GetIndex();
   }

   ReleaseDC(hWnd, hDC);
   
}