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


C# Dimensions.IsInside方法代码示例

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


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

示例1: RenderShadow

        void RenderShadow(PixelFetcher pf, Drawable drawable, Dimensions dimensions)
        {
            int blurRadius = _newSize / 25 + 1;

              int x0 = -_radius - blurRadius;
              int y0 = x0;
              int x1 = _newSize - _radius + blurRadius;
              int y1 = x1;
              var rectangle = new Rectangle(x0, y0, x1, y1);

              foreach (var c in new CoordinateGenerator(rectangle))
            {
              if (c.Radius <= _radius * 1.1)
            {
              var average = drawable.CreatePixel();
              int blurPixels = 0;
              int m, n;

              for (int k = -blurRadius; k < blurRadius + 1; k++)
            {
              m = X + c.X + k;
              for (int l = -blurRadius; l < blurRadius + 1; l++)
            {
              n = Y + c.Y + l;

              if (dimensions.IsInside(m, n))
            {
              average += pf[n, m];
              blurPixels++;
            }
            }
            }

              m = X + c.X;
              n = Y + c.Y;

              if (dimensions.IsInside(m, n))
            {
              pf[n, m] = average / blurPixels;
            }
            }
            }
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:43,代码来源:Raindrop.cs

示例2: RenderDrop

        void RenderDrop(BoolMatrix boolMatrix, PixelFetcher pf, 
		    Dimensions dimensions)
        {
            int x0 = -_radius;
              int y0 = -_radius;
              int x1 = _newSize - _radius;
              int y1 = _newSize - _radius;
              var rectangle = new Rectangle(x0, y0, x1, y1);

              foreach (var c in new CoordinateGenerator(rectangle))
            {
              double r = c.Radius;
              double a = c.Angle;

              if (r <= _radius)
            {
              double oldRadius = r;
              r = (Math.Exp (r / _s) - 1) / _newCoeff;

              int k = X + (int) (r * Math.Sin(a));
              int l = Y + (int) (r * Math.Cos(a));

              int m = X + c.X;
              int n = Y + c.Y;

              if (dimensions.IsInside(k, l) && dimensions.IsInside(m, n))
            {
              boolMatrix[n, m] = true;

              var newColor = pf[l, k] + GetBright(oldRadius, a);
              newColor.Clamp0255();
              pf[l, k] = newColor;
            }
            }
            }
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:36,代码来源:Raindrop.cs


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