本文整理汇总了C#中Canvas.DrawDashLine方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.DrawDashLine方法的具体用法?C# Canvas.DrawDashLine怎么用?C# Canvas.DrawDashLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas.DrawDashLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawWorldLooseConstraint
private void DrawWorldLooseConstraint(Canvas canvas, RigidBody bodyA, Vector2 anchorA, Vector2 anchorB)
{
Vector3 bodyPosA = bodyA.GameObj.Transform.Pos;
ColorRgba clr = this.JointColor;
canvas.State.SetMaterial(new BatchInfo(DrawTechnique.Alpha, clr));
canvas.DrawDashLine(
anchorA.X,
anchorA.Y,
bodyPosA.Z,
anchorB.X,
anchorB.Y,
bodyPosA.Z);
}
示例2: DrawTestImageRow
private void DrawTestImageRow(Canvas c, int baseX, int baseY)
{
Vector2[] polygon = new Vector2[]
{
new Vector2(0.0f, 0.0f),
new Vector2(50.0f, 0.0f),
new Vector2(50.0f, 45.0f),
new Vector2(5.0f, 50.0f),
};
int x = baseX;
int y = baseY;
// Outline Shapes
c.PushState();
{
c.DrawCircle(x, y, 25);
x += 100;
c.DrawCircleSegment(x, y, 25, 0.0f, MathF.RadAngle30 * 4, true);
x += 100;
c.DrawLine(x, y , x + 50, y + 25);
c.DrawDashLine(x, y + 25, x + 50, y + 50);
c.DrawThickLine(x, y + 50, x + 50, y + 75, 3);
x += 100;
c.DrawOval(x, y, 50, 50);
x += 100;
c.DrawOvalSegment(x, y, 50, 50, 0.0f, MathF.RadAngle30 * 4, true);
x += 100;
c.DrawPolygon(polygon, x, y);
x += 100;
c.DrawRect(x, y, 50, 50);
x += 100;
c.DrawText("Hello World", x, y, drawBackground: true);
x = baseX;
y += 100;
}
c.PopState();
// Filled Shapes
c.PushState();
{
c.FillCircle(x, y, 25);
x += 100;
c.FillCircleSegment(x, y, 0, 25, MathF.RadAngle30 * 0, MathF.RadAngle30 * 4);
c.FillCircleSegment(x, y, 0, 25, MathF.RadAngle30 * 5, MathF.RadAngle30 * 9, 10);
x += 100;
c.FillThickLine(x, y + 25, x + 50, y + 50, 3);
x += 100;
c.FillOval(x, y, 50, 50);
x += 100;
c.FillOvalSegment(x, y, 0, 50, 50, MathF.RadAngle30 * 0, MathF.RadAngle30 * 4);
c.FillOvalSegment(x, y, 0, 50, 50, MathF.RadAngle30 * 5, MathF.RadAngle30 * 9, 10);
x += 100;
c.FillPolygon(polygon, x, y);
x += 100;
c.FillRect(x, y, 50, 50);
x = baseX;
y += 100;
}
c.PopState();
}
示例3: DrawLocalLooseConstraint
private void DrawLocalLooseConstraint(Canvas canvas, RigidBody bodyA, RigidBody bodyB, Vector2 anchorA, Vector2 anchorB)
{
Vector3 bodyPosA = bodyA.GameObj.Transform.Pos;
Vector3 bodyPosB = bodyB.GameObj.Transform.Pos;
ColorRgba clr = this.JointColor;
Vector2 anchorAToWorld = bodyA.GameObj.Transform.GetWorldVector(anchorA);
Vector2 anchorBToWorld = bodyB.GameObj.Transform.GetWorldVector(anchorB);
canvas.State.SetMaterial(new BatchInfo(DrawTechnique.Alpha, clr));
canvas.DrawDashLine(
bodyPosA.X + anchorAToWorld.X,
bodyPosA.Y + anchorAToWorld.Y,
bodyPosA.Z,
bodyPosB.X + anchorBToWorld.X,
bodyPosB.Y + anchorBToWorld.Y,
bodyPosB.Z);
}