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


C# CanvasDrawingSession.FillGeometry方法代码示例

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


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

示例1: DrawHeart

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

            var heartGeometry = CreateHeart(sender, scale, center);
            ds.FillGeometry(heartGeometry, ForegroundColor);
            ds.DrawGeometry(heartGeometry, GlowColor, stroke);
        }
开发者ID:shanselman,项目名称:BabySmashWindows10,代码行数:12,代码来源:GlowShapeCustomControl.cs

示例2: DrawTriangle

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

            var triangleGeometry = CreateTriangleGeometry(sender, scale, center);
            ds.FillGeometry(triangleGeometry, ForegroundColor);
            ds.DrawGeometry(triangleGeometry, GlowColor, stroke);
        }
开发者ID:shanselman,项目名称:BabySmashWindows10,代码行数:12,代码来源:GlowShapeCustomControl.cs

示例3: Draw

        public void Draw(ICanvasAnimatedControl sender, CanvasTimingInformation timingInformation, CanvasDrawingSession ds)
        {
            ds.DrawCachedGeometry(clockFaceCachedFill, backgroundBrush);

            double fractionSecond;
            int seconds;

            if (sender.IsFixedTimeStep)
            {
                double updatesPerSecond = 1000.0 / sender.TargetElapsedTime.TotalMilliseconds;
                seconds = (int)((timingInformation.UpdateCount / updatesPerSecond) % 10);

                double updates = (double)timingInformation.UpdateCount;
                fractionSecond = (updates / updatesPerSecond) % 1.0;
            }
            else
            {
                double totalMilliseconds = timingInformation.TotalTime.TotalMilliseconds;
                double millisecondsThisIteration = totalMilliseconds % 1000;

                fractionSecond = millisecondsThisIteration / 1000.0f;
                seconds = (int)timingInformation.TotalTime.TotalSeconds % 10;
            }

            hueRotationEffect.Angle = (float)Math.PI * (seconds / 10.0f) * 2.0f;

            using (var timeSegmentGeometry = CreateTimeSegmentGeometry(ds, fractionSecond))
            {
                ds.FillGeometry(timeSegmentGeometry, foregroundBrush);

                DrawSecondsText(ds, new Vector2(center), seconds);

                ds.DrawGeometry(timeSegmentGeometry, Colors.White, 1, hairlineStrokeStyle);
            }


            ds.DrawCachedGeometry(clockFaceCachedStroke18, Colors.White);
            ds.DrawCachedGeometry(clockFaceCachedStroke16, Colors.Black);
        }
开发者ID:ben-sheeran,项目名称:Win2D,代码行数:39,代码来源:AnimatedControlExample.xaml.cs

示例4: DrawContactGeometry

        static void DrawContactGeometry(CanvasDrawingSession ds, CanvasGeometry geom)
        {
            if (geom == null)
                return;

            ds.FillGeometry(geom, Colors.Green);
            ds.DrawGeometry(geom, Colors.Blue, 5);
        }
开发者ID:jiatingxiu,项目名称:Win2D,代码行数:8,代码来源:Renderer.cs

示例5: DisplayRegionEditInProgress

        public void DisplayRegionEditInProgress(CanvasDrawingSession drawingSession, List<Vector2> points, float zoomFactor)
        {
            if (RegionSelectionMode == SelectionMode.MagicWand)
            {
                // Display a magic wand selection.
                var mask = GetMagicWandMask(points, zoomFactor);
                var border = GetSelectionBorder(mask, zoomFactor);

                drawingSession.Blend = CanvasBlend.Add;
                drawingSession.DrawImage(mask, Vector2.Zero, SourceBitmap.Bounds, 0.25f);

                drawingSession.Blend = CanvasBlend.SourceOver;
                drawingSession.DrawImage(border);
            }
            else
            {
                // Display a geometric shape selection.
                var geometry = GetSelectionGeometry(drawingSession, points);

                drawingSession.Blend = CanvasBlend.Add;
                drawingSession.FillGeometry(geometry, Color.FromArgb(0x20, 0xFF, 0xFF, 0xFF));

                drawingSession.Blend = CanvasBlend.SourceOver;
                drawingSession.DrawGeometry(geometry, Colors.Magenta, 1f / zoomFactor);
            }
        }
开发者ID:shawnhar,项目名称:stuart,代码行数:26,代码来源:EditGroup.cs

示例6: DoPathEffect

        private void DoPathEffect(CanvasControl sender, CanvasDrawingSession ds )
        {    
            using (var thBuilder = new Microsoft.Graphics.Canvas.Geometry.CanvasPathBuilder(sender))
            {
                var pthConverter = new PathToD2DPathGeometryConverter();

                foreach(var path in _paths)
                {
                    var offset = (float)ExpandAmount / 2;
                    using (var cl = new CanvasCommandList(ds))
                    using (var pthGeo = pthConverter.parse(path, thBuilder))
                    {
                        using (var clds = cl.CreateDrawingSession())
                        {
                            clds.FillGeometry(pthGeo,0,0, GlowColor);
                        }

                        _eg.Setup(cl, (float)GlowAmount, GlowColor);
                        ds.DrawImage(_eg.Output, offset, offset);
                        ds.FillGeometry(pthGeo,offset, offset, ((SolidColorBrush)GlowFill).Color);
                    }
                    
                }

            }
        }
开发者ID:liquidboy,项目名称:X,代码行数:26,代码来源:EffectLayer.cs

示例7: drawDOMArrow

        private static void drawDOMArrow(ICanvasResourceCreator device, CanvasDrawingSession ds, Point[] domPoints)
        {
           // Pen pen = new Pen(Color.Black, 3f);

            //pen.MiterLimit = 3;
            
            CanvasPathBuilder domPath = new CanvasPathBuilder(device);
            CanvasPathBuilder domArrow = new CanvasPathBuilder(device);

            if (domPoints[1].X == 0 && domPoints[1].Y == 0)
            {
                domPath.BeginFigure(domPoints[0].ToVector2());
                domPath.AddLine(domPoints[2].ToVector2());
                domPath.EndFigure(CanvasFigureLoop.Open);
            }
            else
            {
                domPath.BeginFigure(domPoints[0].ToVector2());
                domPath.AddLine(domPoints[1].ToVector2());
                domPath.AddLine(domPoints[2].ToVector2());
                domPath.EndFigure(CanvasFigureLoop.Open);
            }

            domArrow.BeginFigure(domPoints[3].ToVector2());
            domArrow.AddLine(domPoints[4].ToVector2());
            domArrow.AddLine(domPoints[5].ToVector2());
            domArrow.EndFigure(CanvasFigureLoop.Closed);

            CanvasGeometry cgPath = CanvasGeometry.CreatePath(domPath);
            CanvasGeometry cgArrow = CanvasGeometry.CreatePath(domArrow);

            ds.DrawGeometry(cgPath, Colors.Black,3f);
            ds.FillGeometry(cgArrow, Colors.Black);
        }
开发者ID:michael-spinelli,项目名称:Renderer2525C-W10-UWP,代码行数:34,代码来源:ModifierRenderer.cs


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