L_BOOL LBitmapBase::EnableUseLUT(bEnable = TRUE)
Enables or disables the use of LUT.
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. |
The previous setting.
Win32, x64.
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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document