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


C# CanvasDrawingSession.DrawCircle方法代码示例

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


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

示例1: DrawNode

 private void DrawNode(CanvasDrawingSession ds, Node node)
 {
     ds.FillCircle(node.Position, hitTestRadius, backgroundColor);
     ds.DrawCircle(node.Position, hitTestRadius, foregroundColor, 4);
     ds.DrawText(node.Name, node.Position, foregroundColor, textFormat);
 }
开发者ID:GreatChieftain,项目名称:Graph-Helper,代码行数:6,代码来源:GraphControl.xaml.cs

示例2: DrawDryInk_LinesMethod

        private void DrawDryInk_LinesMethod(CanvasDrawingSession ds, IReadOnlyList<InkStroke> strokes)
        {
            //
            // This shows off the fact that apps can use the custom drying path
            // to render dry ink using Win2D, and not necessarily 
            // rely on the built-in rendering in CanvasDrawingSession.DrawInk.
            //
            foreach (var stroke in strokes)
            {
                var color = stroke.DrawingAttributes.Color;

                var inkPoints = stroke.GetInkPoints().Select(point => point.Position.ToVector2()).ToList();

                for (int i = 1; i < inkPoints.Count; i++)
                {
                    ds.DrawLine(inkPoints[i - 1], inkPoints[i], color);
                    ds.DrawCircle(inkPoints[i], 3, color);
                }
            }
        }
开发者ID:SarahAnnTolsma,项目名称:Win2D,代码行数:20,代码来源:InkExample.xaml.cs

示例3: DrawCircle

        private void DrawCircle(CanvasControl sender, CanvasDrawingSession ds)
        {
            var width = (float) sender.ActualWidth;
            var height = (float) sender.ActualHeight;
            var stroke = this.defaultStroke;
            var radius = Math.Min(width, height) / 2 - stroke;
            var center = new Vector2(width / 2, height / 2);

            ds.FillCircle(center, radius, ForegroundColor);
            ds.DrawCircle(center, radius, GlowColor, stroke);
        }
开发者ID:shanselman,项目名称:BabySmashWindows10,代码行数:11,代码来源:GlowShapeCustomControl.cs

示例4: DrawCircles

        private void DrawCircles(CanvasControl sender, CanvasDrawingSession ds)
        {
            float width = (float)sender.ActualWidth;
            float height = (float)sender.ActualHeight;

            float endpointMargin = Math.Min(width, height) / 8;
            float controlMarginX = endpointMargin * 4;
            float controlMarginY = endpointMargin * 2;

            for (int i = 0; i < 25; i++)
            {
                Vector2[] bez = new Vector2[4];
                int n = (i * 24) + 9 - (i / 2);

                for (int k = 0; k < 3; k++)
                {
                    int j = 4 - (2 * k);
                    bez[k].X = (0 + (((n >> (j + 1)) & 1) * (width - controlMarginX)));
                    bez[k].Y = (0 + (((n >> j) & 1) * (height - controlMarginY)));
                }
                bez[3].X = width - endpointMargin; // Collect the ends in the lower right
                bez[3].Y = height - endpointMargin;

                const int nSteps = 80;
                const float tStep = 1.0f / nSteps;
                float t = 0;
                for (int step = 0; step < nSteps; step++)
                {
                    float s = 1 - t;
                    float ss = s * s;
                    float sss = ss * s;
                    float tt = t * t;
                    float ttt = tt * t;
                    float x = (sss * bez[0].X) + (3 * ss * t * bez[1].X) + (3 * s * tt * bez[2].X) + (ttt * bez[3].X);
                    float y = (sss * bez[0].Y) + (3 * ss * t * bez[1].Y) + (3 * s * tt * bez[2].Y) + (ttt * bez[3].Y);
                    float radius = ttt * endpointMargin;
                    float strokeWidth = (0.5f - Math.Abs(ss - 0.5f)) * 10;

                    ds.DrawCircle(x, y, radius, GradientColor(t), strokeWidth);
                    t += tStep;
                }
            }
        }
开发者ID:jiatingxiu,项目名称:Win2D,代码行数:43,代码来源:ShapesExample.xaml.cs

示例5: DrawContactPoints

 void DrawContactPoints(CanvasDrawingSession ds)
 {
     foreach (var entry in currentPointsInContact)
     {
         ds.DrawCircle(entry.Value.ToVector2(), 20, Colors.Red);
     }
 }
开发者ID:jiatingxiu,项目名称:Win2D,代码行数:7,代码来源:Renderer.cs

示例6: DrawDryInk_CustomGeometryMethod

        private void DrawDryInk_CustomGeometryMethod(CanvasDrawingSession ds, IReadOnlyList<InkStroke> strokes)
        {
            //
            // This shows off the fact that apps can use the custom drying path
            // to render dry ink using Win2D, and not necessarily 
            // rely on the built-in rendering in CanvasDrawingSession.DrawInk.
            //
            foreach (var stroke in strokes)
            {
                var color = stroke.DrawingAttributes.Color;

                var inkPoints = stroke.GetInkPoints();
                if (inkPoints.Count > 0)
                {
                    CanvasPathBuilder pathBuilder = new CanvasPathBuilder(canvasControl);
                    pathBuilder.BeginFigure(inkPoints[0].Position.ToVector2());
                    for (int i = 1; i < inkPoints.Count; i++)
                    {
                        pathBuilder.AddLine(inkPoints[i].Position.ToVector2());
                        ds.DrawCircle(inkPoints[i].Position.ToVector2(), 3, color);
                    }
                    pathBuilder.EndFigure(CanvasFigureLoop.Open);
                    CanvasGeometry geometry = CanvasGeometry.CreatePath(pathBuilder);
                    ds.DrawGeometry(geometry, color);
                }
            }
        }
开发者ID:RainbowGardens,项目名称:Win2D,代码行数:27,代码来源:InkExample.xaml.cs

示例7: Draw

            public void Draw(CanvasDrawingSession ds, float alpha = 1)
            {
                // Create a drop shadow by drawing a black circle with an offset position.
                const float dropShadowOffset = 4;

                ds.FillCircle(Position + new Vector2(dropShadowOffset), Radius, AdjustAlpha(Colors.Black, alpha));

                // Draw a white X.
                const float crossWidth = 3;
                float crossSize = Radius * 0.8f;

                Vector2 cross1 = new Vector2(crossSize, crossSize);
                Vector2 cross2 = new Vector2(crossSize, -crossSize);

                ds.DrawLine(Position - cross1, Position + cross1, AdjustAlpha(Colors.White, alpha), crossWidth);
                ds.DrawLine(Position - cross2, Position + cross2, AdjustAlpha(Colors.White, alpha), crossWidth);

                // Fill the circle with its unique color.
                ds.FillCircle(Position, Radius, AdjustAlpha(color, alpha));

                // White border around it.
                ds.DrawCircle(Position, Radius, AdjustAlpha(Colors.White, alpha));

                // Text label.
                ds.DrawText(label, Position, AdjustAlpha(Colors.White, alpha), textFormat);
            }
开发者ID:jiatingxiu,项目名称:Win2D,代码行数:26,代码来源:LayersExample.xaml.cs


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