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); }
override protected void Render(Drawable drawable) { var iter = new RgnIterator(drawable, _("Average")); var average = drawable.CreatePixel(); iter.IterateSrc(pixel => average.Add(pixel)); average /= iter.Count; iter.IterateDest(() => average); }
protected override void Render(Drawable drawable) { var iter = new RgnIterator(drawable, _("Average")); var average = drawable.CreatePixel(); iter.IterateSrc(pixel => average.Add(pixel)); average /= iter.Count; iter.IterateDest(() => average); }
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; }