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


C# PathGradientBrush.SetBlendTriangularShape方法代码示例

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


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

示例1: gradient

 public void gradient(Point[] points, PathGradientBrush pgbrush, Triangle tre, GraphicsPath brushPath)
 {
     Color[] mySurroundColor = { tre.v1.currColor, tre.v2.currColor, tre.v3.currColor};
     pgbrush.SurroundColors = mySurroundColor;
     int averageR = (tre.v1.currColor.R + tre.v2.currColor.R + tre.v3.currColor.R) / 3;
     int averageG = (tre.v1.currColor.G + tre.v2.currColor.G + tre.v3.currColor.G) / 3;
     int averageB = (tre.v1.currColor.B + tre.v2.currColor.B + tre.v3.currColor.B) / 3;
     Color centerCol = Color.FromArgb((byte) averageR, (byte)averageG, (byte)averageB);
     pgbrush.CenterColor = centerCol;
     pgbrush.SetBlendTriangularShape(0.7f, 0.7f);
     graphics.FillPolygon(pgbrush, points);
     pgbrush.Dispose();
 }
开发者ID:arapovavikka,项目名称:Triangulation,代码行数:13,代码来源:Form1.cs

示例2: DrawMenuButtonDropShadow

        /// <summary>
        /// Draw a gradient shadow effect
        /// </summary>
        private void DrawMenuButtonDropShadow(Graphics g, RectangleF bounds, int depth, int opacity)
        {
            // offset shadow dimensions
            RectangleF shadowBounds = bounds;
            shadowBounds.Inflate(1, 1);
            shadowBounds.Offset(depth, depth);

            // create a clipping region
            bounds.Inflate(1, 1);
            using (GraphicsPath clipPath = CreateRoundRectanglePath(
                g,
                bounds.X, bounds.Y,
                bounds.Width, bounds.Height,
                CornerRadius))
            {
                // clip the interior
                using (Region region = new Region(clipPath))
                    g.SetClip(region, CombineMode.Exclude);
            }

            // create a graphics path
            using (GraphicsPath gp = CreateRoundRectanglePath(g, shadowBounds.X, shadowBounds.Y,
                shadowBounds.Width, shadowBounds.Height, 8))
            {
                // draw with a path brush
                using (PathGradientBrush borderBrush = new PathGradientBrush(gp))
                {
                    borderBrush.CenterColor = Color.FromArgb(opacity, Color.Black);
                    borderBrush.SurroundColors = new Color[] { Color.Transparent };
                    borderBrush.SetBlendTriangularShape(.5f, 1.0f);
                    borderBrush.FocusScales = new PointF(.4f, .5f);
                    g.FillPath(borderBrush, gp);
                    g.ResetClip();
                }
            }
        }
开发者ID:Egoily,项目名称:CSharp-EAlbum,代码行数:39,代码来源:MediaButton.cs

示例3: SetBlendTriangularShape_ScaleTooBig

		public void SetBlendTriangularShape_ScaleTooBig ()
		{
			using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
				pgb.SetBlendTriangularShape (1, 1.01f);
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:PathGradientBrushTest.cs

示例4: SetBlendTriangularShape_FocusTooSmall

		public void SetBlendTriangularShape_FocusTooSmall ()
		{
			using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
				pgb.SetBlendTriangularShape (-1);
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:PathGradientBrushTest.cs

示例5: SetBlendTriangularShape_Scale

		public void SetBlendTriangularShape_Scale ()
		{
			using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
				// max valid
				pgb.SetBlendTriangularShape (0, 1);
				Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
				// min valid
				pgb.SetBlendTriangularShape (1, 0);
				Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
				// middle
				pgb.SetBlendTriangularShape (0.5f, 0.5f);
				Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
				// no impact on matrix
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:PathGradientBrushTest.cs

示例6: Rectangle

		public void Rectangle ()
		{
			using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.TileFlipXY)) {
				CheckDefaultRectangle ("Original", pgb.Rectangle);
				pgb.MultiplyTransform (new Matrix (2, 0, 0, 2, 2, 2));
				CheckDefaultRectangle ("Multiply", pgb.Rectangle);
				pgb.ResetTransform ();
				CheckDefaultRectangle ("Reset", pgb.Rectangle);
				pgb.RotateTransform (90);
				CheckDefaultRectangle ("Rotate", pgb.Rectangle);
				pgb.ScaleTransform (4, 0.25f);
				CheckDefaultRectangle ("Scale", pgb.Rectangle);
				pgb.TranslateTransform (-10, -20);
				CheckDefaultRectangle ("Translate", pgb.Rectangle);

				pgb.SetBlendTriangularShape (0.5f);
				CheckDefaultRectangle ("SetBlendTriangularShape", pgb.Rectangle);
				pgb.SetSigmaBellShape (0.5f);
				CheckDefaultRectangle ("SetSigmaBellShape", pgb.Rectangle);
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:21,代码来源:PathGradientBrushTest.cs


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