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


C# CanvasDrawingSession.DrawCachedGeometry方法代码示例

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


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

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

示例2: Draw

        /// <summary>
        /// user needs to call "ds.Clear(Colors.Transparent);" before this function if necessary
        /// </summary>
        /// <param name="ds"></param>
        /// <param name="lineColor"></param>
        /// <param name="lineWidth"></param>
        /// <param name="fillColor"></param>
        /// <param name="m"></param>
        public void Draw(CanvasDrawingSession ds, Color lineColor, float lineWidth, Color fillColor, Matrix3x2 m)
        {
            /*if (m != null)
                _cg = _cg.Transform(m);
            if (!(lineColor == Colors.Transparent))
            {
                ds.DrawGeometry(_cg, lineColor, lineWidth);
            }

            if (fillColor != null)
                ds.FillGeometry(_cg, fillColor);//*/

            ds.Transform = m;
            if (_ccgStroke != null && lineColor != Colors.Transparent)
                ds.DrawCachedGeometry(_ccgStroke, lineColor);
            if (_ccgFill != null && fillColor != Colors.Transparent)
                ds.DrawCachedGeometry(_ccgFill, fillColor);

            ds.Transform = Matrix3x2.Identity;

        }
开发者ID:michael-spinelli,项目名称:Renderer2525C-W10-UWP,代码行数:29,代码来源:SVGPath.cs


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