LBitmapBase::EnableUseLUT

#include "ltwrappr.h"

L_BOOL LBitmapBase::EnableUseLUT (bEnable)

L_BOOL bEnable;

/* flag that indicates whether to enable the LUT */

Enables or disables the use of LUT.

Parameter

Description

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

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.

See Also

Elements:

LBitmap::WindowLevelFillLUT, LBitmap::WindowLevelBitmap, Class Members

Topics:

Raster Image Functions: Palettes

 

Raster Image Functions: Displaying and Printing

Example

RGBQUAD L_HUGE* pLUT;
L_INT nRet;
L_INT nMin, nMax;
L_INT nLowBit, nHighBit;
LBitmap myBitmap;
L_INT nLUTLen = 0;

LSettings::UnlockSupport
(L_SUPPORT_MEDICAL, L_KEY_MEDICAL);
nRet = myBitmap.Load(TEXT("c:\\16.jpg"),16);

myBitmap.GetMinMaxBits(&nLowBit, &nHighBit);
myBitmap.GetMinMaxVal(&nMin, &nMax);

/* allocate the lookup table */
nLUTLen = 1<<(nHighBit - nLowBit + 1);
pLUT = (RGBQUAD L_HUGE*)malloc(sizeof(RGBQUAD) * nLUTLen);

/* fill the LUT with a color gradient */
myBitmap.WindowLevelFillLUT((RGBQUAD L_HUGE*)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 */

myBitmap.GetHandle()->LUTLength = nLUTLen;
myBitmap.GetHandle()->pLUT = (RGBQUAD L_HUGE*)GlobalAllocPtr(GHND,sizeof(RGBQUAD) * nLUTLen);
memcpy(myBitmap.GetHandle()->pLUT,pLUT,sizeof(RGBQUAD) * nLUTLen);
myBitmap.EnableUseLUT(TRUE);
myBitmap.ColorRes(24,CRF_BYTEORDERBGR|CRF_FLOYDSTEINDITHERING);

/* free the table */
free(pLUT);

if(myBitmap.GetHandle()->pLUT)
{
   GlobalFree(myBitmap.GetHandle()->pLUT);
   myBitmap.GetHandle()->LUTLength = 0;
}