示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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;
            });
            }
        }
示例#5
0
        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);
            }
        }
示例#6
0
        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();
        }
示例#7
0
        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;
        }
示例#8
0
        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();
        }
示例#9
0
 public DrawableUpdater(Drawable drawable)
 {
     _iter = new RgnIterator(drawable, "Forge...");
 }
示例#10
0
        public void Render(Drawable drawable)
        {
            var iter = new RgnIterator(drawable, _("Swirlies"));

            iter.IterateDest(DoSwirlies);
        }
示例#11
0
        public void Render()
        {
            var iter = new RgnIterator(_drawable, "NCP");

            iter.IterateDest(DoNCP);
        }
示例#12
0
        public void Render()
        {
            var iter = new RgnIterator(_drawable, _("Sky"));

            iter.IterateDest(DoSky);
        }
示例#13
0
 public void Render()
 {
     var iter = new RgnIterator(_drawable, _("Sky"));
       iter.IterateDest(DoSky);
 }
示例#14
0
 public void Render()
 {
     var iter = new RgnIterator(_drawable, "NCP");
       iter.IterateDest(DoNCP);
 }
示例#15
0
        public void Render(Drawable drawable)
        {
            var iter = new RgnIterator(drawable, _("Mezzotint"));

            iter.IterateSrcDest(pixel => DoMezzotint(pixel));
        }
示例#16
0
        public void Render(Drawable drawable)
        {
            var iter = new RgnIterator(drawable, _("Pointillize"));

            iter.IterateDest(GetPointillizeFunc(drawable));
        }
示例#17
0
 public void Render(Drawable drawable)
 {
     var iter = new RgnIterator(drawable, _("Pointillize"));
       iter.IterateDest(GetPointillizeFunc(drawable));
 }
示例#18
0
 public void Render(Drawable drawable)
 {
     var iter = new RgnIterator(drawable, _("Mezzotint"));
       iter.IterateSrcDest(pixel => DoMezzotint(pixel));
 }
示例#19
0
 public DrawableUpdater(Drawable drawable)
 {
     _iter = new RgnIterator(drawable, "Forge...");
 }
示例#20
0
 public void Render(Drawable drawable)
 {
     var iter = new RgnIterator(drawable, _("Swirlies"));
       iter.IterateDest(DoSwirlies);
 }