Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #4
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;
        }