ArcMapAddinVisibility.ViewModels.RLOSViewModel.GenerateRasterRenderer C# (CSharp) Method

GenerateRasterRenderer() private static method

Generates a raster renderer using the provided settings
private static GenerateRasterRenderer ( IRaster pRaster ) : IRasterRenderer
pRaster IRaster
return IRasterRenderer
        private static IRasterRenderer GenerateRasterRenderer(IRaster pRaster)
        {
            IRasterStretchColorRampRenderer pStretchRen = new RasterStretchColorRampRenderer();
            //IRasterUniqueValueRenderer pStretchRen = new RasterUniqueValueRenderer();
            IRasterRenderer pRasRen = (IRasterRenderer)pStretchRen;

            pRasRen.Raster = pRaster;
            pRasRen.Update();

            IRgbColor pFromColor = new RgbColorClass();
            pFromColor.Red = 255;
            pFromColor.Green = 0;
            pFromColor.Blue = 0;

            IRgbColor pToColor = new RgbColorClass();
            pToColor.Red = 0;
            pToColor.Green = 255;
            pToColor.Blue = 0;

            IAlgorithmicColorRamp pRamp = new AlgorithmicColorRamp();
            pRamp.Size = 255;
            pRamp.FromColor = pFromColor;
            pRamp.ToColor = pToColor;
            bool bOK;
            pRamp.CreateRamp(out bOK);

            pStretchRen.BandIndex = 0;
            pStretchRen.ColorRamp = pRamp;

            pRasRen.Update();

            pRaster = null;
            pRasRen = null;
            pRamp = null;
            pToColor = null;
            pFromColor = null;

            return (IRasterRenderer)pStretchRen;
        }