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


C# Canvas.FillThickLine方法代码示例

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


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

示例1: Canvas

		void ICmpRenderer.Draw(IDrawDevice device)
		{
			Canvas canvas = new Canvas(device);
			
			// Update input stats texts for drawing
			this.WriteInputStats(ref this.mouseStatsText, DualityApp.Mouse);
			this.WriteInputStats(ref this.keyboardStatsText, DualityApp.Keyboard);
			this.WriteInputStats(ref this.joystickStatsText, DualityApp.Joysticks);
			this.WriteInputStats(ref this.gamepadStatsText, DualityApp.Gamepads);

			// Draw input stats texts
			{
				int y = 10;

				canvas.DrawText(this.mouseStatsText, 10, y, 0, null, Alignment.TopLeft, true);
				y += 20 + (int)this.mouseStatsText.TextMetrics.Size.Y;

				canvas.DrawText(this.keyboardStatsText, 10, y, 0, null, Alignment.TopLeft, true);
				y += 20 + (int)this.keyboardStatsText.TextMetrics.Size.Y;

				canvas.DrawText(this.joystickStatsText, 10, y, 0, null, Alignment.TopLeft, true);
				y += 20 + (int)this.joystickStatsText.TextMetrics.Size.Y;

				canvas.DrawText(this.gamepadStatsText, 10, y, 0, null, Alignment.TopLeft, true);
				y += 20 + (int)this.gamepadStatsText.TextMetrics.Size.Y;
			}

			// Draw the mouse cursor's movement trail
			if (DualityApp.Mouse.IsAvailable)
			{
				canvas.State.ColorTint = new ColorRgba(128, 192, 255, 128);
				canvas.FillThickLine(
					DualityApp.Mouse.X - DualityApp.Mouse.XSpeed, 
					DualityApp.Mouse.Y - DualityApp.Mouse.YSpeed, 
					DualityApp.Mouse.X, 
					DualityApp.Mouse.Y, 
					2);
				// Draw the mouse cursor at its local window coordiates
				canvas.State.ColorTint = ColorRgba.White;
				canvas.FillCircle(
					DualityApp.Mouse.X, 
					DualityApp.Mouse.Y, 
					2);
			}
		}
开发者ID:ChrisLakeZA,项目名称:duality,代码行数:45,代码来源:InputMonitor.cs

示例2: Draw

        public override void Draw(Canvas target, Vector3 basePos, float baseRotation, float baseScale)
        {
            float borderRadius = DefaultOutlineWidth;
            float circleRadius = this.radius * baseScale;

            // Scale anti-proportional to perspective scale in order to keep a constant size
            // in screen space even when actually drawing in world space.
            {
                float scale = 1.0f;
                Vector3 posTemp = this.pos + basePos;
                target.DrawDevice.PreprocessCoords(ref posTemp, ref scale);
                borderRadius /= scale;
                if (this.invariantScale) circleRadius /= scale;
            }

            // Determine circle position
            Vector3 circlePos = this.pos;
            MathF.TransformCoord(ref circlePos.X, ref circlePos.Y, baseRotation, baseScale);
            circlePos += basePos;

            // Draw circle
            target.State.ColorTint *= this.Color;
            target.FillCircleSegment(
                circlePos.X,
                circlePos.Y,
                circlePos.Z,
                circleRadius - borderRadius * 0.5f,
                this.minAngle + baseRotation,
                this.maxAngle + baseRotation);

            // Draw circle outline
            if (target.DrawDevice.DepthWrite) target.State.ZOffset -= 0.1f;
            target.State.ColorTint *= ColorRgba.Black;
            target.FillCircleSegment(
                circlePos.X,
                circlePos.Y,
                circlePos.Z,
                circleRadius,
                this.minAngle + baseRotation,
                this.maxAngle + baseRotation,
                borderRadius);
            if (MathF.CircularDist(this.minAngle, this.maxAngle) > MathF.RadAngle1 * 0.001f)
            {
                Vector2 minAngleVec = Vector2.FromAngleLength(this.minAngle + baseRotation, circleRadius);
                Vector2 maxAngleVec = Vector2.FromAngleLength(this.maxAngle + baseRotation, circleRadius);
                target.FillThickLine(
                    circlePos.X,
                    circlePos.Y,
                    circlePos.Z,
                    circlePos.X + minAngleVec.X,
                    circlePos.Y + minAngleVec.Y,
                    circlePos.Z,
                    borderRadius);
                target.FillThickLine(
                    circlePos.X,
                    circlePos.Y,
                    circlePos.Z,
                    circlePos.X + maxAngleVec.X,
                    circlePos.Y + maxAngleVec.Y,
                    circlePos.Z,
                    borderRadius);
            }
        }
开发者ID:ruzli,项目名称:duality,代码行数:63,代码来源:VisualLogCircleEntry.cs

示例3: 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();
		}
开发者ID:KSLcom,项目名称:duality,代码行数:74,代码来源:CanvasTest.cs


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