WindowLevelFillLUT example for C++ Builder

   long nHigh;
   long nLow;
   LEADRasterProcess* pRasterProc= NULL;

     CoCreateInstance(CLSID_LEADRasterProcess, NULL, CLSCTX_ALL, IID_ILEADRasterProcess, (void**)&pRasterProc);

   pRasterProc->Grayscale (LEADRasterView1->Raster, 16);

   LEADRasterView1->Raster->GetMinMaxBits () ;
   LEADRasterView1->Raster->GetMinMaxVal () ;

   LEADRasterView1->Raster->LevelLowBit = 0;
   LEADRasterView1->Raster->LevelHighBit = (short)(LEADRasterView1->Raster->BitmapBits - 1);

   nLow = LEADRasterView1->Raster->MinBit;
   nHigh = 1<<(LEADRasterView1->Raster->MaxBit - LEADRasterView1->Raster->MinBit + 1);

    //allocate the LUT
   LEADRasterView1->Raster->set_LevelLUT (nHigh - 1, 0);

    //fill the entire LUT with gradient from RED to BLUE
   LEADRasterView1->Raster->WindowLevelFillLUT (RGB (255, 0, 0), RGB (0, 0, 255),
                             nLow, nHigh,
                             LEADRasterView1->Raster->MinBit,
                             LEADRasterView1->Raster->MaxBit,
                             LEADRasterView1->Raster->MinVal,
                             LEADRasterView1->Raster->MaxVal,
                             True);

    //now use it
   pRasterProc->WindowLevel (LEADRasterView1->Raster);
   pRasterProc-> Release( );