LBase::OverlayCallBack

#include "ltwrappr.h"

virtual L_INT LBase::OverlayCallBack(pOverlayCallbackData)

pFILEOVERLAYCALLBACKDATA pOverlayCallbackData;

pointer to a structure

Override this function to get the overlay bitmap and other information from the user when loading a file containing an overlay.

Parameter

Description

pOverlayCallbackData

Pointer to a FILEOVERLAYCALLBACKDATA structure that contains information for the callback. Some members of this structure are for input, some are for output. For more information, refer to FILEOVERLAYCALLBACKDATA.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

When loading a file containing an overlay, typically PTOCA files, LEADTOOLS will call this function to let the user provide the overlay bitmap. Typically, the overlay bitmap is in a different file on the disk. The callback can be called before or after LEADTOOLS tries to load the overlay bitmap. For more information, refer to LBase::EnableOverlayCallBack.

When this function is called, you should fill the appropriate fields in the FILEOVERLAYCALLBACKDATA structure to set up the overlay bitmap and its information. For more information, refer to the FILEOVERLAYCALLBACKDATA structure

Required DLLs and Libraries

LTKRN

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:

LBase::IsOverlayCallBackEnabled, LBase::EnableOverlayCallBack, LFile::Load, Class Members

Example

class LUserBitmapExt : public LBitmap   
{ 
   public:  
      LUserBitmapExt(); 
      virtual L_INT  OverlayCallBack(pFILEOVERLAYCALLBACKDATA pOverlayCallbackData);  
      virtual ~LUserBitmapExt(); 
      LMemoryFile MyBitmap;  
}; 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
LUserBitmapExt::LUserBitmapExt() 
{ 
} 
 
LUserBitmapExt::~LUserBitmapExt() 
{ 
 
} 
 
L_INT LUserBitmapExt::OverlayCallBack(pFILEOVERLAYCALLBACKDATA pOverlayCallbackData)  
{ 
   L_TCHAR szBuffer[800];  
   L_TCHAR szOverlayFileName[_MAX_PATH];  
   FILEINFO FileInfo;  
   L_INT nRet;  
   LBitmap MyBitmap;  
   // show overlay information 
   wsprintf(szBuffer, TEXT("File: %s\nPageNumber: %d\nInfo: %d"), 
      pOverlayCallbackData->pszFilename,  
      pOverlayCallbackData->nPageNumber,  
      pOverlayCallbackData->bInfo);  
   MessageBox(NULL, szBuffer, TEXT("Overlay Callback"), 0);  
 
   // construct the overlay file name (assume its c:\temp\overlay_#.tmp where # is the page number)  
   wsprintf(szOverlayFileName, MAKE_IMAGE_PATH(TEXT("overlay_%d.tmp")), pOverlayCallbackData->nPageNumber);  
   MyBitmap.SetFileName(szOverlayFileName);  
   if(pOverlayCallbackData->bInfo)  
   { 
      // info, we only need to fill in the nInfoXXX members of the structure 
      ZeroMemory(&FileInfo, sizeof(FILEINFO));  
      nRet = MyBitmap.File()->GetInfo(&FileInfo, sizeof(FILEINFO) ,0, NULL);  
 
      if(nRet == SUCCESS)  
      { 
         pOverlayCallbackData->nInfoWidth = FileInfo.Width;  
         pOverlayCallbackData->nInfoHeight = FileInfo.Height;  
         pOverlayCallbackData->nInfoXResolution = FileInfo.XResolution;  
         pOverlayCallbackData->nInfoYResolution = FileInfo.YResolution;  
      } 
   } 
   else 
   { 
      // we need to load the overlay bitmap into the pLoadBitmap member 
      nRet = MyBitmap.File()->Load(0,  
											  ORDER_BGRORGRAY,  
											  NULL,  
											  NULL);  
											  *pOverlayCallbackData->pLoadBitmap = *MyBitmap.GetHandle(); 
   } 
 
   return nRet;  
 
} 
L_INT LBase__OverlayCallBackExample()  
{ 
	L_INT nRet; 
   L_TCHAR* pszPtokaFileName = MAKE_IMAGE_PATH(TEXT("SUPPLEMENT ON CHECK.tmp")); 
   L_TCHAR* pszTiffFileName = MAKE_IMAGE_PATH(TEXT("test.tif")); 
 
   LUserBitmapExt Bitmap;  
 
   nRet = SUCCESS;  
 
   // load the PTOCA file from memory 
   Bitmap.EnableOverlayCallBack(TRUE);  
   nRet = Bitmap.Load(pszPtokaFileName, 0, ORDER_BGRORGRAY, NULL, NULL);  
	if(nRet != SUCCESS) 
		return nRet; 
   Bitmap.EnableOverlayCallBack (FALSE);  
    
   // save the bitmap as TIFF 
   nRet = Bitmap.Save(pszTiffFileName, FILE_TIF, 1, 0, NULL);  
	if(nRet != SUCCESS) 
		return nRet; 
 
   // free the bitmap 
   if(Bitmap.IsAllocated()) 
      Bitmap.Free(); 
 
   return nRet;  
} 
Help Version 20.0.2020.4.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help