LBitmapBase::ColorResBitmapCallBack

#include "ltwrappr.h"

virtual L_INT LBitmapBase::ColorResBitmapCallBack(pBitmap, pBuffer, nLines)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_UCHAR * pBuffer;

/* pointer to the buffer that contains the processed bitmap data */

L_INT nLines;

/* number of lines in the buffer */

Handles the converted image data that the LBitmapBase::ColorRes function has written to a buffer.

Parameter

Description

pBitmap

The pointer to the bitmap handle referencing the bitmap that contains the image information.

pBuffer

A pointer to a buffer containing one or more lines of output image data that the calling function has already converted.

nLines

The number of lines in the pBuffer buffer.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function is called for the color resolution operation only if the callback functions are enabled. You can override this function to do your own processing. If you return an error code then the operation will be terminated. This function will be called only if you enabled the callback functions using LBase::EnableCallBack(TRUE).

Required DLLs and Libraries

LTDIS
LTFIL

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:

LBitmapBase::ColorRes, LBase::EnableCallBack, LBase::IsCallBackEnabled, Class Members

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
class ColorResBitmap : public LBitmapBase 
{
protected:
virtual L_INT ColorResBitmapCallBack (pBITMAPHANDLE pBitmap, L_UCHAR  * pBuffer, L_INT nLines);
};
L_INT ColorResBitmap::ColorResBitmapCallBack(pBITMAPHANDLE pBitmap, L_UCHAR  * pBuffer, L_INT nLines)
{
   UNREFERENCED_PARAMETER(nLines);
   UNREFERENCED_PARAMETER(pBuffer);
   UNREFERENCED_PARAMETER(pBitmap);
       ::MessageBox(0,TEXT("Color Res"),TEXT("Color Res"),MB_OK);
       return(SUCCESS);
}
L_INT LBitmapBase__ColorResBitmapCallBackExample()
{
   L_INT nRet;
   ColorResBitmap Bitmap ;
   nRet =Bitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")),24);
   if(nRet !=SUCCESS)
      return nRet;
   if(Bitmap.IsCallBackEnabled()==FALSE)
      Bitmap.EnableCallBack(TRUE);
   //this will call ColorResCallBack()
   nRet =Bitmap.ColorRes(8,CRF_FIXEDPALETTE|CRF_FLOYDSTEINDITHERING);
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}