栅格数据渲染
Public Function UsingRasterStretchColorRampRenderer(ByVal pRLayer As IRasterLayer) As IRasterLayer
Dim pRaster As IRasterpRaster = pRLayer.Raster
'Create stretch renderer and QI RasterRenderer interface
Dim pStretchRen As IRasterStretchColorRampRenderer
pStretchRen = New RasterStretchColorRampRenderer
Dim pRasRen As IRasterRenderer
pRasRen = pStretchRen
'Set raster for the render and update
pRasRen.Raster = pRaster
pRasRen.Update()
' Define two colors
Dim pFromColor As IColor
Dim pToColor As IColor
pFromColor = New RgbColor
pFromColor.RGB = #f3ff96
pToColor = New RgbColor
pToColor.RGB = #00ff00
'Create a color ramp to use
Dim pRamp As IAlgorithmicColorRamp
pRamp = New AlgorithmicColorRamp
pRamp.FromColor = pFromColor
pRamp.ToColor = pToColor
pRamp.Size = 255
pRamp.CreateRamp(True)
pStretchRen.BandIndex = 0
pStretchRen.ColorRamp = pRamp
'Update the renderer and plug into layer
pRasRen.Update()
pRLayer.Renderer = pStretchRen
UsingRasterStretchColorRampRenderer = pRLayer
pRaster = Nothing
pRasRen = Nothing
pStretchRen = Nothing
pRamp = Nothing
End Function