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


C# SharpDX.DrawLine方法代码示例

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


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

示例1: Render

        internal static async Task Render(CompositionEngine compositionEngine, SharpDX.Direct2D1.RenderTarget renderTarget, FrameworkElement rootElement, Line line)
        {
            var rect = line.GetBoundingRect(rootElement).ToSharpDX();
            //var fill = line.Fill.ToSharpDX(renderTarget, rect);
            var stroke = await line.Stroke.ToSharpDX(renderTarget, rect);

            if (stroke == null ||
                line.StrokeThickness <= 0)
            {
                return;
            }

            //var layer = new Layer(renderTarget);
            //var layerParameters = new LayerParameters();
            //layerParameters.ContentBounds = rect;
            //renderTarget.PushLayer(ref layerParameters, layer);

            renderTarget.DrawLine(
                new DrawingPointF(
                    rect.Left + (float)line.X1,
                    rect.Top + (float)line.Y1),
                new DrawingPointF(
                    rect.Left + (float)line.X2,
                    rect.Top + (float)line.Y2),
                    stroke,
                    (float)line.StrokeThickness,
                    line.GetStrokeStyle(compositionEngine.D2DFactory));

            //renderTarget.PopLayer();
        }
开发者ID:prabaprakash,项目名称:Visual-Studio-2013,代码行数:30,代码来源:LineRenderer.cs

示例2: Render

        internal static async Task Render(CompositionEngine compositionEngine, SharpDX.Direct2D1.RenderTarget renderTarget, FrameworkElement rootElement, Line line)
        {
            var rect = line.GetBoundingRect(rootElement).ToSharpDX();
            var stroke = await line.Stroke.ToSharpDX(renderTarget, rect);

            if (stroke == null ||
                line.StrokeThickness <= 0)
            {
                return;
            }

            var layer = line.CreateAndPushLayerIfNecessary(renderTarget, rootElement);

            renderTarget.DrawLine(
                new Vector2(
                    rect.Left + (float)line.X1,
                    rect.Top + (float)line.Y1),
                new Vector2(
                    rect.Left + (float)line.X2,
                    rect.Top + (float)line.Y2),
                    stroke,
                    (float)line.StrokeThickness,
                    line.GetStrokeStyle(compositionEngine.D2DFactory));

            if (layer != null)
            {
                renderTarget.PopLayer();
                layer.Dispose();
            }
        }
开发者ID:cstehreem,项目名称:WinRTXamlToolkit,代码行数:30,代码来源:LineRenderer.cs

示例3: Draw

 public void Draw(SharpDX.Direct2D1.RenderTarget d2dRenderTarget)
 {
     //if (DrawnParticles == null)
     //    return;
     GameForm.solidColorBrush.Color = Colors.AliceBlue;
     for (int i = 0; i < Particles.Count; i++)
     {
         Particles[i].Draw(d2dRenderTarget);
     }
     var x = Lines.ToArray();
     GameForm.solidColorBrush.Color = Colors.Yellow;
     for (int i = 0; i < x.Count() - 1; i++)
         d2dRenderTarget.DrawLine(x[i], x[i + 1], GameForm.solidColorBrush);
 }
开发者ID:DarkLotus,项目名称:TD,代码行数:14,代码来源:ParticleManager.cs


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