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


C# Drawable.MergeShadow方法代码示例

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


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

示例1: 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

示例2: Render

        public void Render(Image image, Drawable drawable)
        {
            Tile.CacheDefault(drawable);

              var activeLayer = image.ActiveLayer;
              var newLayer = new Layer(activeLayer)
            {
              Name = "_DifferenceClouds_",
              Visible = false,
              Mode = activeLayer.Mode,
              Opacity = activeLayer.Opacity
            };

              // Initialization steps
              _bpp = drawable.Bpp;
              var pf = new PixelFetcher(drawable, true);
              _progress = 0;
              _hasAlpha = newLayer.HasAlpha;

              var rectangle = drawable.MaskBounds;
              _maxProgress = rectangle.Area;

              if (rectangle.Width > 0 && rectangle.Height > 0)
            {
              //
              // This first time only puts in the seed pixels - one in each
              // corner, and one in the center of each edge, plus one in the
              // center of the image.
              //
              InitSeedPixels(pf, rectangle);

              //
              // Now we recurse through the images, going further each time.
              //
              int depth = 1;
              while (!DoDifferenceClouds(pf, rectangle.X1, rectangle.Y1,
                     rectangle.X2 - 1, rectangle.Y2 - 1,
                     depth, 0))
            {
              depth++;
            }
            }

              pf.Dispose();

              drawable.Flush();
              drawable.MergeShadow(true);

              DoDifference(drawable, newLayer);

              drawable.Update(rectangle);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:52,代码来源: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.MergeShadow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。