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); }
protected override void Render(Drawable drawable) { Tile.CacheDefault(drawable); var iter = new RgnIterator(drawable, _("Fragment")); using (var pf = new PixelFetcher(drawable) {EdgeMode = EdgeMode.Black}) { iter.IterateDest((x, y) => { return (pf[y - 4, x - 4] + pf[y - 4, x + 4] + pf[y + 4, x - 4] + pf[y + 4, x + 4]) / 4; }); } }
override protected void Render(Drawable drawable) { Tile.CacheDefault(drawable); var iter = new RgnIterator(drawable, _("Fragment")); using (var pf = new PixelFetcher(drawable) { EdgeMode = EdgeMode.Black }) { iter.IterateDest((x, y) => (pf[y - 4, x - 4] + pf[y - 4, x + 4] + pf[y + 4, x - 4] + pf[y + 4, x + 4]) / 4); } }
public void Render(Image image, Drawable drawable, Progress progress) { var dimensions = image.Dimensions; Tile.CacheDefault(drawable); var pf = new PixelFetcher(drawable, false); var iter = new RgnIterator(drawable, RunMode.Interactive); iter.IterateSrcDest(src => src); int dropSize = GetValue <int>("drop_size"); int fishEye = GetValue <int>("fish_eye"); int number = GetValue <int>("number"); var factory = new RaindropFactory(dropSize, fishEye, dimensions); for (int numBlurs = 0; numBlurs <= number; numBlurs++) { var raindrop = factory.Create(); if (raindrop == null) { if (progress != null) { progress.Update(1.0); } break; } raindrop.Render(factory.BoolMatrix, pf, drawable); if (progress != null) { progress.Update((double)numBlurs / number); } } pf.Dispose(); drawable.Flush(); drawable.Update(); }
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; }
public void Render(Image image, Drawable drawable, Progress progress) { var dimensions = image.Dimensions; Tile.CacheDefault(drawable); var pf = new PixelFetcher(drawable, false); var iter = new RgnIterator(drawable, RunMode.Interactive); iter.IterateSrcDest(src => src); int dropSize = GetValue<int>("drop_size"); int fishEye = GetValue<int>("fish_eye"); int number = GetValue<int>("number"); var factory = new RaindropFactory(dropSize, fishEye, dimensions); for (int numBlurs = 0; numBlurs <= number; numBlurs++) { var raindrop = factory.Create(); if (raindrop == null) { if (progress != null) progress.Update(1.0); break; } raindrop.Render(factory.BoolMatrix, pf, drawable); if (progress != null) progress.Update((double) numBlurs / number); } pf.Dispose(); drawable.Flush(); drawable.Update(); }
public DrawableUpdater(Drawable drawable) { _iter = new RgnIterator(drawable, "Forge..."); }
public void Render(Drawable drawable) { var iter = new RgnIterator(drawable, _("Swirlies")); iter.IterateDest(DoSwirlies); }
public void Render() { var iter = new RgnIterator(_drawable, "NCP"); iter.IterateDest(DoNCP); }
public void Render() { var iter = new RgnIterator(_drawable, _("Sky")); iter.IterateDest(DoSky); }
public void Render(Drawable drawable) { var iter = new RgnIterator(drawable, _("Mezzotint")); iter.IterateSrcDest(pixel => DoMezzotint(pixel)); }
public void Render(Drawable drawable) { var iter = new RgnIterator(drawable, _("Pointillize")); iter.IterateDest(GetPointillizeFunc(drawable)); }