Esempio n. 1
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();
        }
Esempio n. 2
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();
        }