本文整理汇总了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();
}
示例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();
}
}
示例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);
}