LBitmapWindow::GetBitmapVisibleRect

#include "ltwrappr.h"

L_VOID LBitmapWindow::GetBitmapVisibleRect(pRect)

LPRECT pRect;

/* pointer to the rectangle to be updated */

Gets the visible rectangle of the displayed bitmap.

Parameter

Description

pRect

Pointer to the rectangle to be updated with the visible part of the displayed bitmap.

Returns

None

Required DLLs and Libraries

LTDIS
LTDLG
LTEFX
LTFIL
LTIMG
LTSCR
LTTWN

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

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmapWindow__GetBitmapVisibleRectExample(HWND hWndParent) 
{
   L_INT nRet;
   LBitmapWindow  LeadBWnd ;
   
   nRet = LeadBWnd.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp"))) ;
   if (nRet == SUCCESS)
   {
      L_UINT         uToolType, uRgnType;
      RECT           rect ;
      if (LeadBWnd.CreateWnd( hWndParent, TRUE, 0, 0, 100, 100) == NULL)
         return 0;
      uToolType = LeadBWnd.GetToolType() ;
      if (uToolType != TOOL_REGION)
         LeadBWnd.SetToolType(TOOL_REGION) ;
      uRgnType = LeadBWnd.GetRegionType() ;
      if (uRgnType != REGION_TYPE_FREE_HAND)
         LeadBWnd.SetRegionType(REGION_TYPE_FREE_HAND) ;
      //... do some process 
      //...
      if (LeadBWnd.HasRgn() == TRUE)
         LeadBWnd.CancelRgn() ;
      LeadBWnd.ZoomIn() ;
      LeadBWnd.GetBitmapVisibleRect(&rect) ;
      rect.left -= 10 ;
      rect.top  -= 10 ;
      rect.right -= 10;
      rect.bottom-= 10;
      nRet =LeadBWnd.Move(rect);
      if(nRet !=SUCCESS)
         return nRet;
      LeadBWnd.FitToParent() ;
      
      GRADIENTDLGPARAMS GradDlgParm;  
      if(LeadBWnd. DialogEffect()->DoModalGetGradient(hWndParent)==SUCCESS)
      {
         nRet =LeadBWnd.GetGradientParameters(&GradDlgParm);
         if(nRet !=SUCCESS)
            return nRet;
         //…
         nRet =LeadBWnd.SetGradientParameters(&GradDlgParm);
         if(nRet !=SUCCESS)
            return nRet;
         if (LeadBWnd.GetGradientStyle() != EFX_GRADIENT_LINE2_C_TO_LT_AND_RB)
            LeadBWnd.SetGradientStyle(EFX_GRADIENT_LINE2_C_TO_LT_AND_RB) ;        
      }
      TRANSITIONDLGPARAMS   TransDlgParm; 
      if(LeadBWnd. DialogEffect()->DoModalGetTransition(hWndParent)==SUCCESS)
      {
         LeadBWnd.GetTransitionParameters(&TransDlgParm);
         //…
         LeadBWnd.SetTransitionParameters(&TransDlgParm);
         if (LeadBWnd.GetTransition() != EFX_TRANS_SOLID)
            LeadBWnd.SetTransition(EFX_TRANS_SOLID) ;
         if (LeadBWnd.GetTransitionEffect() != EFX_TRANS_UPWARD_DIAG)
            LeadBWnd.SetTransitionEffect(EFX_TRANS_UPWARD_DIAG) ;
         if (LeadBWnd.GetMaxTransitionPasses() == 1)
            LeadBWnd.SetMaxTransitionPasses(3) ;
      }
      EFFECTDLGPARAMS  EfxDlgParm;
      if(LeadBWnd. DialogEffect()->DoModalGetEffect(hWndParent)==SUCCESS)
      {
         LeadBWnd.DialogEffect()->GetEffectParams(&EfxDlgParm,sizeof(EfxDlgParm));
         nRet =LeadBWnd.SetEffectParameters(&EfxDlgParm);
         if(nRet !=SUCCESS)
            return nRet;
         if (LeadBWnd.GetMaxEffectPasses() == 1)
            LeadBWnd.SetMaxEffectPasses(3) ;
      }
      if (LeadBWnd.GetPaintEffect() != EFX_EFFECT_WIPE_L_TO_R)      
         LeadBWnd.SetPaintEffect(EFX_EFFECT_WIPE_L_TO_R) ;
      if (LeadBWnd.GetRgnFrameType() != RGNFRAME_STATIC)
         LeadBWnd.SetRgnFrameType(RGNFRAME_STATIC) ;
   }
   else
      return nRet;
   return SUCCESS ;
}