ApplyVOILUT Example for C++ 5.0 and later

int CTestImgProcView::TestVOILUT(BOOL bLinear)
{
  int nRet = 0;

  ILEADRasterVariant * pRasterVar = NULL;
  CoCreateInstance(
   CLSID_LEADRasterVariant,
   NULL,
   CLSCTX_ALL,
   IID_ILEADRasterVariant,
   (void**)&pRasterVar
   ); 

  pRasterVar->Type = VALUE_ARRAY_LONG;
  pRasterVar->ItemCount = 4096;
 
  if (bLinear)
  {
   nRet = m_pRasterProc->ApplyLinearVOILUT(m_LeadRasterView.GetRaster(), 0, 0.5, (VOILUTConstants)0);
  }
  else
  {
   for(int i = 0; i < 4096; ++i)
   {
     if(i<30)
     {
      pRasterVar->PutLongItemValue(i, 0);
     }
     else
      if (i > 630)
      {
       pRasterVar->PutLongItemValue(i,630);
      }
     else
     {
      pRasterVar->PutLongItemValue(i,i);
     }

   }       

   m_pRasterProc->ApplyVOILUT(m_LeadRasterView.GetRaster(), pRasterVar, 0, (VOILUTConstants)0);
  }
 
  pRasterVar->Release();

  return nRet;
}