UseLUT example for Visual Basic

Dim RasterIO As New LEADRasterIO
Dim RasterProc As New LEADRasterProcess

Private Sub Form_Load()
    Dim nLow, nHigh As Long
   
    RasterIO.Load LEADRasterView1.Raster, "c:\16.jpg", 16, 0, 1
   
    LEADRasterView1.Raster.GetMinMaxBits
    LEADRasterView1.Raster.GetMinMaxVal
   
    LEADRasterView1.Raster.LevelLowBit = 0
    LEADRasterView1.Raster.LevelHighBit = LEADRasterView1.Raster.BitmapBits - 1
   
    nLow = LEADRasterView1.Raster.MinBit
    nHigh = 2 ^ (LEADRasterView1.Raster.MaxBit - LEADRasterView1.Raster.MinBit + 1)
    'allocate the LUT
    LEADRasterView1.Raster.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, _
                            0, _
                            FILLLUT_INSIDE Or FILLLUT_LINEAR

End Sub

Private Sub Command3_Click()
    LEADRasterView1.Raster.UseLUT = True
    RasterProc.ColorRes LEADRasterView1.Raster, 24, CRP_BYTEORDERBGR, CRD_NODITHERING, 0
End Sub