LBitmapBase::EnableUseLUT

#include "ltwrappr.h"

L_BOOL LBitmapBase::EnableUseLUT(bEnable = TRUE)

Enables or disables the use of LUT.

Parameters

L_BOOL bEnable

Flag that indicates when the LUT is used. Possible values are:

Value Meaning
TRUE The LUT is used in all image processing functions, including save. (default).
FALSE The LUT is used only when painting. It is ignored when an image processing function is applied or when a file is saved.

Returns

The previous setting.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmapBase__EnableUseLUTExample() 
{ 
    
   RGBQUAD * pLUT; 
   L_INT nRet; 
   L_INT nMin, nMax; 
   L_INT nLowBit, nHighBit; 
   LBitmap myBitmap; 
   L_INT nLUTLen = 0; 
 
   nRet =myBitmap.Load(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Beauty16.jpg")),16); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet =myBitmap.GetMinMaxBits(&nLowBit,&nHighBit); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =myBitmap.GetMinMaxVal(&nMin, &nMax); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   /* allocate the lookup table */ 
   nLUTLen = 1<<(nHighBit - nLowBit + 1); 
   pLUT = (RGBQUAD *)malloc(sizeof(RGBQUAD) * nLUTLen); 
 
 
  /* fill the LUT with a color gradient */ 
   /* fill the LUT with a color gradient */ 
   nRet =myBitmap.WindowLevelFillLUT((RGBQUAD *)pLUT, 
                              nLUTLen, 
                              RGB(255,0,0), /* RED */ 
                              RGB(0,0,255), /* BLUE */ 
                              nLowBit, /* Starting value */ 
                              nLUTLen, /* Ending value */ 
                              nLowBit, /* Bitmap's LowBit */ 
                              nHighBit, /* Bitmap's HighBit */ 
                              nMin, /* Bitmap's MinVal */ 
                              nMax, /* Bitmap's MaxVal */ 
                              0, /*nFactor*/  
      FILLLUT_INSIDE | FILLLUT_LINEAR) /* Fill Inside range */; 
    
   if(nRet !=SUCCESS) 
      return nRet; 
 
   myBitmap.GetHandle()->LUTLength = nLUTLen; 
   myBitmap.GetHandle()->pLUT = (RGBQUAD *)GlobalAllocPtr(GHND,sizeof(RGBQUAD) * nLUTLen); 
   memcpy(myBitmap.GetHandle()->pLUT,pLUT,sizeof(RGBQUAD) * nLUTLen); 
   myBitmap.EnableUseLUT(TRUE); 
   nRet =myBitmap.ColorRes(24,CRF_BYTEORDERBGR|CRF_FLOYDSTEINDITHERING); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   /* free the table */ 
    free(pLUT); 
    
   if(myBitmap.GetHandle()->pLUT) 
   { 
      GlobalFree(myBitmap.GetHandle()->pLUT); 
      myBitmap.GetHandle()->LUTLength = 0; 
   } 
 
   return SUCCESS; 
} 
Help Version 22.0.2021.9.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help