override public bool Execute() { var iter = new RgnIterator(ActiveDrawable, "Select Similar"); var tool = new ByColorSelectTool(ActiveDrawable); var uniqueColors = new HashSet <RGB>(); iter.IterateSrc(pixel => uniqueColors.Add(pixel.Color)); Console.WriteLine("Colors: " + uniqueColors.Count); // More or less arbitrary hack if (uniqueColors.Count > 10) { return(true); } foreach (var color in uniqueColors) { tool.Select(color, 0, ChannelOps.Add, true, false, 0, false); } return(true); }
public override bool Execute() { var iter = new RgnIterator(ActiveDrawable, "Select Similar"); var tool = new ByColorSelectTool(ActiveDrawable); var uniqueColors = new HashSet<RGB>(); iter.IterateSrc(pixel => uniqueColors.Add(pixel.Color)); Console.WriteLine("Colors: " + uniqueColors.Count); // More or less arbitrary hack if (uniqueColors.Count > 10) return true; foreach (var color in uniqueColors) { tool.Select(color, 0, ChannelOps.Add, true, false, 0, false); } return true; }