LEADTOOLS Raster Imaging C++ Class Library Help > Classes and Member Functions > LBitmapBase > LBitmapBase Member Functions > LBitmapBase::GetRects |
#include "ltwrappr.h"
virtual L_VOID LBitmapBase::GetRects(prcSrc, prcClipSrc, prcDst, prcClipDst)
LPRECT prcSrc; |
/* pointer to a RECT windows structure */ |
LPRECT prcClipSrc; |
/* pointer to a RECT windows structure */ |
LPRECT prcDst; |
/* pointer to a RECT windows structure */ |
LPRECT prcClipDst; |
/* pointer to a RECT windows structure */ |
Retrieves the rectangles used when painting the class objects bitmap.
Parameter |
Description |
prcSrc |
Optional pointer to a RECT windows structure, that will receive the bitmap source rectangle. |
prcClipSrc |
Optional pointer to a RECT windows structure, that will receive the bitmap source clip rectangle. |
prcDst |
Optional pointer to a RECT windows structure, that will receive the bitmap destination rectangle. |
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. |
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.
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:
Required DLLs and Libraries
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Win32, x64.
See Also
Functions: |
LBitmapBase::SetSrcRect, LBitmapBase::SetClipSrcRect, LBitmapBase::SetDstRect, LBitmapBase::SetClipDstRect, Class Members |
Topics: |
|
|
|
|
Example
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 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; }