/// <summary> /// Add each color in a row to the histogram and register them to the quantizer /// </summary> /// <param name="totalWidth">the width of the row</param> /// <param name="line">the row</param> /// <param name="colorCount">the histogram to which we will add</param> private void AddRow(int totalWidth, int[] line, ConcurrentDictionary <Color, int> colorCount) { for (int width = 0; width < totalWidth; width++) { Color color = Color.FromArgb(line[width]); quantizer.AddColor(color); colorCount.AddOrUpdate(color, 1, (c, count) => count + 1); } }