LPlayBack::ClearUpdateRect

#include "ltwrappr.h"

virtual L_INT LPlayBack::ClearUpdateRect()

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.

Platforms

Win32, x64.

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.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LPlayBack__ClearUpdateRectExample(HWND hWnd)
{
   L_INT nRet;
   // this will call the default constructor
   LBitmap LeadBitmap;
   LPlayBack PlayBack;
   HDC hDC;
   HPALETTE hPalette;
   L_UINT uState, uIndex;
   RECT rcClientRect, rcUpdate;
   L_INT nCounter = 0;
   GetClientRect(hWnd, &rcClientRect);
   nRet = LeadBitmap.Create (500, 500,8);
   if(nRet != SUCCESS)
      return nRet;
   nRet = PlayBack.Create (&LeadBitmap);
   if(nRet != SUCCESS)
      return nRet;
   nRet = LeadBitmap.Load (MAKE_IMAGE_PATH(TEXT("image1.cmp")), 8);
   if(nRet != SUCCESS)
      return nRet;
   nRet = PlayBack.Append(&LeadBitmap);
   if(nRet != SUCCESS)
      return nRet;
   nRet = LeadBitmap.Load (MAKE_IMAGE_PATH(TEXT("image2.cmp")), 8);
   if(nRet != SUCCESS)
      return nRet;
   nRet = PlayBack.Append(&LeadBitmap);
   if(nRet != SUCCESS)
      return nRet;
   nRet = LeadBitmap.Load (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), 8);
   if(nRet != SUCCESS)
      return nRet;
   hDC = GetDC(hWnd);
   hPalette = LeadBitmap.CreatePaintPalette (hDC);
   hPalette = LeadBitmap.DupPalette();
   SelectPalette( hDC, hPalette, TRUE );
   RealizePalette(hDC);
   nRet = PlayBack.Append(&LeadBitmap);
   if(nRet != SUCCESS)
      return nRet;
   uState = PlayBack.GetState();
   while(uState != PLAYSTATE_END)
   {
      uState = PlayBack.Process();
      switch(uState)
      {
      case PLAYSTATE_WAITINPUT:
            nRet = PlayBack.CancelWait();
            if(nRet != SUCCESS)
               return nRet;
            break;
      case PLAYSTATE_POSTCLEAR:
      case PLAYSTATE_POSTRENDER:
          uIndex = PlayBack.GetIndex ();
            if(uIndex % 2)
            {
               nRet = PlayBack.ClearUpdateRect ();
               if(nRet != SUCCESS)
                  return nRet;
            }
            nRet = PlayBack.GetUpdateRect(&rcUpdate, TRUE);
            if(nRet != SUCCESS)
               return nRet;
            nRet = PlayBack.GetBitmap()->SetClipSrcRect(&rcUpdate);
            if(nRet != SUCCESS)
               return nRet;
            nRet = PlayBack.GetBitmap()->SetDstRect(&rcClientRect);
            if(nRet != SUCCESS)
               return nRet;
            nRet = PlayBack.GetBitmap()->SetClipDstRect(&rcClientRect);
            if(nRet != SUCCESS)
               return nRet;
            PlayBack.GetBitmap()->Paint()->SetDC(hDC);
            PlayBack.GetBitmap()->CreatePaintPalette (hDC);
            nRet = PlayBack.GetBitmap()->Paint()->PaintDC();
            if(nRet != SUCCESS)
               return nRet;
            break;
      }
      nCounter  = PlayBack.GetIndex();
   }
   ReleaseDC(hWnd, hDC);
   return SUCCESS;
}