当前位置: 首页>>代码示例>>C#>>正文


C# Drawable.Flush方法代码示例

本文整理汇总了C#中Drawable.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# Drawable.Flush方法的具体用法?C# Drawable.Flush怎么用?C# Drawable.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drawable的用法示例。


在下文中一共展示了Drawable.Flush方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        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();
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:37,代码来源:Renderer.cs

示例2: DoDifference

        void DoDifference(Drawable sourceDrawable, Drawable toDiffDrawable)
        {
            _indexedColorsMap = new IndexedColorsMap();

              var rectangle = sourceDrawable.MaskBounds;
              var srcPR = new PixelRgn(sourceDrawable, rectangle, true, true);
              var destPR = new PixelRgn(toDiffDrawable, rectangle, false, false);

              var iterator = new RegionIterator(srcPR, destPR);
              iterator.ForEach((src, dest) => src.Set(MakeAbsDiff(dest, src)));

              sourceDrawable.Flush();
              sourceDrawable.MergeShadow(false);
              sourceDrawable.Update(rectangle);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:15,代码来源:Renderer.cs

示例3: Render


//.........这里部分代码省略.........
              sum_sq += val * val;

              if (ii == i && jj == j)
                continue;

              vary[count] = i * w + j;
              varx[count] = ii * w + jj;
              var[count] = val - Y[i, j];
              var[count] *= var[count];
              if (_useChroma)
                {
                  val = inI[ii, jj] - inI[i, j];
                  var[count] += val * val;
                  val = inQ[ii, jj] - inQ[i, j];
                  var[count] += val * val;
                }
              if (var[count] < min_variance)
                min_variance = var[count];
              ++count;
            }
            }

              double sigma =
            (sum_sq - (sum * sum)/(double)(count + 1)) / (double)count;
              if (sigma < 0.000002)
            sigma = 0.000002;
              else if (sigma < (min_variance / LN_100))
            sigma = min_variance / LN_100;

              sum = 0;
              for (ii = 0; ii < count; ii++)
            {
              var[ii] = Math.Exp(-var[ii] / sigma);
              sum += var[ii];
            }

              for (ii = 0; ii < count; ii++)
            {
              AI[n] = vary[ii];
              AJ[n] = varx[ii];
              // Fix me: just A[i, j]?
              A[n / (h * w) , n % (h * w)] = -var[ii] / sum;
              ++n;
            }
            }

              AI[n] = AJ[n] = i * w + j;
              // Fix me: just A[i, j]?
              A[n / (h * w), n % (h * w)] = 1.0;
              ++n;
            }
            }

              UmfPack umf = new UmfPack();
              umf.Defaults();

              var Ax = new double[WindowPixels, h * w];
              var Ap = new int[h * w + 1];
              var Ai = new int[WindowPixels * h * w];
              var Map = new int[WindowPixels * h * w];

              umf.TripletToCol(h * w, h * w, n, AI, AJ, A, Ap, Ai, Ax, Map);

              umf.Symbolic(h * w, h * w, Ap, Ai, Ax);
              umf.Numeric(Ap, Ai, Ax);
              umf.FreeSymbolic();

              progress.Update(0.3);

              var outI = new double[h, w];
              var outQ = new double[h, w];

              umf.Solve(Ap, Ai, Ax, outI, I);

              progress.Update(0.6);

              umf.Solve(Ap, Ai, Ax, outQ, Q);
              umf.FreeNumeric();

              progress.Update(0.9);

              for (i = 0; i < h; i++)
            {
              // FIXME: This is only for the alpha channel..
              var imgRow = srcRgn.GetRow(srcRgn.X, srcRgn.Y + i, w);

              for (j = 0; j < w; j++)
            {
              yiq2rgb(Y[i, j], outI[i, j], outQ[i, j], imgRow[j]);
            }

              dstRgn.SetRow(imgRow, dstRgn.X, dstRgn.Y + i);
              }

              drawable.Flush();
              drawable.MergeShadow(true);
              drawable.Update(dstRgn.X, dstRgn.Y, dstRgn.W, dstRgn.H);

              progress.Update(1.0);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:101,代码来源:Colorize.cs


注:本文中的Drawable.Flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。