LBitmapBase::GetRects

Summary

Retrieves the rectangles used when painting the class objects bitmap.

Syntax

#include "ltwrappr.h"

virtual L_VOID LBitmapBase::GetRects(prcSrc, prcClipSrc, prcDst, prcClipDst)

Parameters

LPRECT prcSrc

Optional pointer to a RECT windows structure, that will receive the bitmap source rectangle.

LPRECT prcClipSrc

Optional pointer to a RECT windows structure, that will receive the bitmap source clip rectangle.

LPRECT prcDst

Optional pointer to a RECT windows structure, that will receive the bitmap destination rectangle.

LPRECT prcClipDst

Optional pointer to a RECT windows structure, that will receive the bitmap destination clip rectangle.

Returns

None.

Comments

Use this function to retrieve the rectangles used for the class object when painting the bitmap.

NOTE: These illustrations are for a bitmap with a TOP_LEFT view perspective. For an explanation of bitmap coordinates and view perspectives, refer to Accounting for View Perspective.

LBitmapBase::GetRects

In addition, you can specify a clipping area within either rectangle to limit the area to be painted. For the destination rectangle, a clipping area is commonly specified to repaint part of the image that was temporarily covered up. For a source rectangle, you can use a clipping area to update the display when only part of the image in the source rectangle has changed.

The following illustration shows how specifying a source clipping area affects the display. Text has been added to the source bitmap (using the bitmap as a display surface), and the source clipping area specifies the area to be repainted.

LBitmapBase::GetRects

You can specify the various rectangles in any way that meets your needs. Coordinates can have negative values and they can extend beyond the bounds of the bitmap or the device context. In fact, it is common for the display rectangle to be bigger than the device context, where scroll bars are used to see different parts of the image.

In simple cases, you can use this function as follows:

LBitmapBase::GetRects

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmapBase__GetRectsExample() 
{ 
   L_INT nRet; 
   LBitmapBase MyBitmap; 
   RECT DstRct,rcTemp; 
 
   nRet =MyBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")),24); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   rcTemp.left=10; 
   rcTemp.top=10; 
   rcTemp.right=300; 
   rcTemp.bottom=300; 
 
   nRet =MyBitmap.SetSrcRect(&rcTemp); 
   if(nRet !=SUCCESS) 
      return nRet; 
   rcTemp.left=20; 
   rcTemp.top=20; 
   rcTemp.right=200; 
   rcTemp.bottom=200; 
 
   nRet =MyBitmap.SetClipSrcRect(&rcTemp); 
   if(nRet !=SUCCESS) 
      return nRet; 
   rcTemp.left=0; 
   rcTemp.top=0; 
   rcTemp.right=MyBitmap.GetWidth(); 
   rcTemp.bottom=MyBitmap.GetHeight(); 
 
   nRet =MyBitmap.SetDstRect(&rcTemp); 
   if(nRet !=SUCCESS) 
      return nRet; 
   rcTemp.left=20; 
   rcTemp.top=20; 
   rcTemp.right=MyBitmap.GetWidth()-20; 
   rcTemp.bottom=MyBitmap.GetHeight()-30; 
 
  nRet = MyBitmap.SetClipDstRect(&rcTemp); 
  if(nRet !=SUCCESS) 
     return nRet; 
 
   MyBitmap.GetRects(0,0,&DstRct,0); 
  
   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.