CSharpImageLibrary.DDS.DDS_BlockHelpers.DoSomethingWithPalette C# (CSharp) Method

DoSomethingWithPalette() static private method

static private DoSomethingWithPalette ( int uSteps, uint wColourA, uint wColourB, RGBColour ColourA, RGBColour ColourB ) : RGBColour[]
uSteps int
wColourA uint
wColourB uint
ColourA RGBColour
ColourB RGBColour
return RGBColour[]
        static RGBColour[] DoSomethingWithPalette(int uSteps, uint wColourA, uint wColourB, RGBColour ColourA, RGBColour ColourB)
        {
            // Create palette colours
            RGBColour[] step = new RGBColour[4];

            if ((uSteps == 3) == (wColourA <= wColourB))
            {
                step[0] = ColourA;
                step[1] = ColourB;
            }
            else
            {
                step[0] = ColourB;
                step[1] = ColourA;
            }

            if (uSteps == 3)
            {
                step[2].r = step[0].r + (1f / 2f) * (step[1].r - step[0].r);
                step[2].g = step[0].g + (1f / 2f) * (step[1].g - step[0].g);
                step[2].b = step[0].b + (1f / 2f) * (step[1].b - step[0].b);
            }
            else
            {
                // "step" appears to be the palette as this is the interpolation
                step[2].r = step[0].r + (1f / 3f) * (step[1].r - step[0].r);
                step[2].g = step[0].g + (1f / 3f) * (step[1].g - step[0].g);
                step[2].b = step[0].b + (1f / 3f) * (step[1].b - step[0].b);

                step[3].r = step[0].r + (2f / 3f) * (step[1].r - step[0].r);
                step[3].g = step[0].g + (2f / 3f) * (step[1].g - step[0].g);
                step[3].b = step[0].b + (2f / 3f) * (step[1].b - step[0].b);
            }

            return step;
        }