UseLUT example for C++ 5.0 and later
void CMfcDemoDlg::OnLoad()
{
long nHigh,nLow;
ILEADRasterIO *pRasterIO = NULL;
ILEADRasterProcess *pRasterProc = NULL;
CoCreateInstance(
CLSID_LEADRasterIO,
NULL,
CLSCTX_ALL,
IID_ILEADRasterIO,
(void**)&pRasterIO
);
CoCreateInstance(
CLSID_LEADRasterProcess,
NULL,
CLSCTX_ALL,
IID_ILEADRasterProcess,
(void**)&pRasterProc
);
pRasterIO->Load((m_RasterView.GetRaster()),"c:\\16.jpg",16,0,1);
m_RasterView.GetRaster().GetMinMaxBits();
m_RasterView.GetRaster().GetMinMaxVal();
m_RasterView.GetRaster().SetLevelLowBit(0);
m_RasterView.GetRaster().SetLevelHighBit(m_RasterView.GetRaster().GetBitmapBits()
- 1);
nLow = m_RasterView.GetRaster().GetMinBit ();
nHigh = 1<<(m_RasterView.GetRaster().GetMaxBit() - m_RasterView.GetRaster().
GetMinBit() + 1);
//allocate the LUT
m_RasterView.GetRaster().SetLevelLUT(nHigh -
1, 0);
//fill the entire LUT with gradient from RED to BLUE
m_RasterView.GetRaster().WindowLevelFillLUT(
RGB(255, 0, 0),
RGB(0, 0, 255),
nLow, nHigh,
m_RasterView.GetRaster().GetMinBit (),
m_RasterView.GetRaster().GetMaxBit(),
m_RasterView.GetRaster().GetMinVal(),
m_RasterView.GetRaster().GetMaxVal(),
0,
FILLLUT_INSIDE | FILLLUT_LINEAR);
m_RasterView.GetRaster().SetUseLUT (TRUE);
pRasterProc->ColorRes(m_RasterView.GetRaster(),24,
CRP_BYTEORDERBGR, CRD_NODITHERING, 0);
pRasterIO->Release();
pRasterProc->Release();
}