Color History now only shows unique colors

This commit is contained in:
2022-06-07 13:23:03 +02:00
parent 0f4d845fd8
commit 1a468895ad

View File

@@ -69,25 +69,22 @@ namespace Paint_2
public List<Color> SandartGetLastColors(int colorNumber)
{
List<Color> result = new List<Color>();
if (Target.Colors.Count <= colorNumber)
{
//We need to fill with black color
for (int i = Target.Colors.Count; i > 0; i--)
{
result.Add(Target.Colors[(Target.Colors.Count) - i]);
Color targetColor = Target.Colors[(Target.Colors.Count) - i];
if (result.Count == 0 || result[result.Count - 1] != targetColor)
{
result.Add(targetColor);
}
for (int i = colorNumber - Target.Colors.Count; i > 0; i--)
}
//for (int i = colorNumber - Target.Colors.Count; i > 0; i--)
for (int i = colorNumber - result.Count; i > 0; i--)
{
result.Add(Color.FromArgb(0x00, 0x00, 0x00));
}
}
else
{
for (int i = colorNumber; i > 0; i--)
{
result.Add(Target.Colors[(Target.Colors.Count) - i]);
}
}
result.Reverse();
return result;
}
public Point Lerp(Point start, Point end, float t)