Alexandria.Raster.BlendPalette C# (CSharp) Метод

BlendPalette() публичный статический Метод

Create a blended palette, which blends colors from the perspective of either A and B or B and A, but unevenly (unless if blend is 0.5). The first colour has blend influence on the result; the second colour has (1 - blend) influence. BlendColorIndex(int,int,int) can be used to create proper indices.
public static BlendPalette ( IList original, double blend = 2.0/3.0 ) : Codex
original IList The original set of colours.
blend double The blending between colours used in a combination. Making this a value other than 0.5 puts more variety into the dithering.
Результат Codex
        public static Codex<Color> BlendPalette(IList<Color> original, double blend = 2.0 / 3.0)
        {
            int count = original.Count;
            var colors = new Color[count * count];
            double ta = blend, tb = 1 - blend;

            for (var a = 0; a < count; a++) {
                var ca = original[a];

                for (var b = 0; b < count; b++) {
                    var cb = original[b];
                    colors[BlendColorIndex(a, b, count)] = Color.FromArgb(
                        (int)(ca.R * ta + cb.R * tb),
                        (int)(ca.G * ta + cb.G * tb),
                        (int)(ca.B * ta + cb.B * tb));
                }
            }

            return new Codex<Color>(colors);
        }