internal static byte[] GetColor(OverlayResult[] pixels, IBitmapCustom bitmap) { Tuple <byte[], double>[] colors = new Tuple <byte[], double> [pixels.Length]; for (int cntr = 0; cntr < pixels.Length; cntr++) { colors[cntr] = Tuple.Create(bitmap.GetColor_Byte(pixels[cntr].X, pixels[cntr].Y), pixels[cntr].Percent); } return(UtilityWPF.AverageColors(colors)); }
private static Color GetTriangleColor(Tuple <int, int, double>[] pixels, Color[] allColors, int width) { //TODO: See if linq is faster/slower than creating the array //return UtilityWPF.AverageColors(pixels.Select(o => Tuple.Create(allColors[(o.Item2 * o.Item1) + o.Item1], o.Item3))); Tuple <Color, double>[] colors = new Tuple <Color, double> [pixels.Length]; for (int cntr = 0; cntr < pixels.Length; cntr++) { colors[cntr] = Tuple.Create(allColors[(pixels[cntr].Item2 * width) + pixels[cntr].Item1], pixels[cntr].Item3); } return(UtilityWPF.AverageColors(colors)); //return AverageColors(colors); }