LPlayBack::ClearUpdateRect

Summary

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

Syntax

#include "ltwrappr.h"

virtual L_INT LPlayBack::ClearUpdateRect()

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example uses ClearUpdateRect to avoid painting odd numbered bitmaps.

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; 
} 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.