LBitmap::PicturizeCallBack

#include "ltwrappr.h"

virtual L_INT LBitmap::PicturizeCallBack(pCellBitmap, x, y)

pBITMAPHANDLE pCellBitmap;

/* pointer to the bitmap handle */

L_INT x;

/* X coordinate */

L_INT y;

/* Y coordinate */

Called every time the best match is found to replace the rectangle

Parameter

Description

pCellBitmap

The pointer to the bitmap handle referencing the bitmap that will be placed in the position starting at (x, y). Do not delete or change this bitmap in any way.

x

X coordinate (column) where the new bitmap has been placed.

y

Y coordinate (row) where the new bitmap has been placed.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This callback is called every time the best match is found to replace the rectangle starting at (x, y) in the class object's original bitmap.

Required DLLs and Libraries

LTDIS
LTFIL
LTIMG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LBitmap::Picturize, Class Members

Example

class LUserBitmap : public LBitmap  
{
   HWND m_hWnd;
public:
   LUserBitmap(HWND hwnd);
   virtual L_INT PicturizeCallBack(
                                 pBITMAPHANDLE pCellBitmap,
                                 L_INT x,L_INT y
                               );
virtual ~LUserBitmap();
};
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
////////////////////////////////////////////////////////////////////
LUserBitmap::LUserBitmap(HWND hwnd)
{
   m_hWnd = hwnd;
}
LUserBitmap::~LUserBitmap()
{
}
L_INT LUserBitmap::PicturizeCallBack(
                                     pBITMAPHANDLE pThumb,
                                     L_INT x,L_INT y
                                     )
{
   LBitmap ThumbBitmap(pThumb);
   RECT  rcDest;
   HDC   hdc = GetDC(m_hWnd);
   // assume that the original bitmap was viewed at 100% zoom factor.
   // Also assume that we are painting on a 24BPP display. 
   SetRect(&rcDest, x, y, x + ThumbBitmap.GetWidth(), y + ThumbBitmap.GetHeight());
   // paint the bitmap at (x,y) coordinates
   ThumbBitmap.Paint()->SetDC(hdc);
   ThumbBitmap.SetDstRect(&rcDest);
   ThumbBitmap.Paint()->PaintDC();
   ReleaseDC(m_hWnd, hdc);
   // return an error code if you want to abort the process
   return SUCCESS;
}
L_INT LBitmap__PicturizeCallBackExample(HWND hWnd)
{
   L_INT nRet;
   LUserBitmap LeadBitmap(hWnd);
   //Load an image
   nRet =LeadBitmap.Load(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\image1.cmp"), 0,ORDER_BGR);
   if(nRet !=SUCCESS)
      return nRet;
   // Call add noise function
   // during the calling of this function
   // StatusCallBack will be called
   nRet =LeadBitmap.Picturize(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images"),
                              PICTURIZE_LOADALL|PICTURIZE_RESIZE,
                              32, 32);
   if(nRet !=SUCCESS)
      return nRet;
   
   return SUCCESS;
}