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


C# Graphics2D.DrawString方法代码示例

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


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

示例1: OnDraw

        public override void OnDraw(Graphics2D graphics2D)
        {
            if (!putUpDiagnostics)
            {
                //DiagnosticWidget diagnosticView = new DiagnosticWidget(this);
                putUpDiagnostics = true;
            }
            this.NewGraphics2D().Clear(new RGBA_Bytes(255, 255, 255));

            base.OnDraw(graphics2D);

            long milliseconds = totalTime.ElapsedMilliseconds;
            graphics2D.DrawString("ms: ", Width - 60, Height - 14);
            graphics2D.DrawString(milliseconds.ToString() + "  ", Width, Height - 14, justification: Justification.Right);
            totalTime.Restart();
        }
开发者ID:jeske,项目名称:agg-sharp,代码行数:16,代码来源:GUITester.cs

示例2: OnDraw

        public override void OnDraw(Graphics2D graphics2D)
        {
            if(needRedraw)
            {
                needRedraw = false;
                rayTraceScene();
            }
            trackBallTransform.AxisToWorld = trackBallController.GetTransform4X4();

            graphics2D.FillRectangle(new rect_d(0, 0, 1000, 1000), RGBA_Bytes.Red);
            graphics2D.Render(destImage, 0, 0);
            trackBallController.DrawRadius(graphics2D);

            graphics2D.DrawString("Ray Trace: " + renderTime.ElapsedMilliseconds.ToString(), 20, 10);

            base.OnDraw(graphics2D);
        }
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:17,代码来源:PreviewWindowRayTrace.cs

示例3: EditorDraw

        void EditorDraw(Graphics2D pDestFrame)
        {
            Vector2 WayPointPos = m_pCurWayPoint.GetPosition();
            if (m_pParent != null)
            {
                RGBA_Bytes LineColor = new RGBA_Bytes(128, 128, 128);
                Vector2 ParentPos = m_pParent.m_pCurWayPoint.GetPosition();
                // draw a line back to your parent
                pDestFrame.Line(WayPointPos.x, WayPointPos.y, ParentPos.x, ParentPos.y, LineColor);
            }

            // print out the stats for this point
            int LineSpacing = 12;
            int LineOffset = -LineSpacing;
            string Text = "";

            Text.FormatWith("G: {0:0.0}", m_AccumulatedCostFromStartG);
            pDestFrame.DrawString(Text, WayPointPos.x, WayPointPos.y + LineOffset, justification: Justification.Center);
            LineOffset += LineSpacing;

            Text.FormatWith("H: {0:0.0}", m_EstimatedCostToDestH);
            pDestFrame.DrawString(Text, WayPointPos.x, WayPointPos.y + LineOffset, justification: Justification.Center);
            LineOffset += LineSpacing;

            Text.FormatWith("F: {0:0.0}", m_TotalCostForThisNodeF);
            pDestFrame.DrawString(Text, WayPointPos.x, WayPointPos.y + LineOffset, justification: Justification.Center);
            LineOffset += LineSpacing;
        }
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:28,代码来源:AStar.cs

示例4: OnDraw


//.........这里部分代码省略.........
#if SourceDepth24
                ImageBuffer image2 = new ImageBuffer(new BlenderBGR());
#else
				ImageBuffer image2 = new ImageBuffer(new BlenderBGRA());
#endif
				if (image2.Attach(widgetsSubImage, (int)bbox.Left, (int)bbox.Bottom, (int)bbox.Right, (int)bbox.Top))
				{
					// Blur it
					if (m_method.SelectedIndex == 0)
					{
						// More general method, but 30-40% slower.
						//------------------
						//m_stack_blur.blur(pixf2, agg::uround(m_radius.Value));

						// Faster, but bore specific.
						// Works only for 8 bits per channel and only with radii <= 254.
						//------------------
						stack_blur test = new stack_blur();
						test.Blur(image2, agg_basics.uround(m_radius.Value), agg_basics.uround(m_radius.Value));
					}
					else
					{
						// True Gaussian Blur, 3-5 times slower than Stack Blur,
						// but still constant time of radius. Very sensitive
						// to precision, doubles are must here.
						//------------------
						m_recursive_blur.blur(image2, m_radius.Value);
					}
				}
			}
			else
			{
				/*
				// Blur separate channels
				//------------------
				if(m_channel_r.Checked)
				{
					typedef agg::pixfmt_alpha_blend_gray<
						agg::blender_gray8,
						agg::rendering_buffer,
						3, 2> pixfmt_gray8r;

					pixfmt_gray8r pixf2r(m_rbuf2);
					if(pixf2r.attach(pixf, int(bbox.x1), int(bbox.y1), int(bbox.x2), int(bbox.y2)))
					{
						agg::stack_blur_gray8(pixf2r, agg::uround(m_radius.Value),
													  agg::uround(m_radius.Value));
					}
				}

				if(m_channel_g.Checked)
				{
					typedef agg::pixfmt_alpha_blend_gray<
						agg::blender_gray8,
						agg::rendering_buffer,
						3, 1> pixfmt_gray8g;

					pixfmt_gray8g pixf2g(m_rbuf2);
					if(pixf2g.attach(pixf, int(bbox.x1), int(bbox.y1), int(bbox.x2), int(bbox.y2)))
					{
						agg::stack_blur_gray8(pixf2g, agg::uround(m_radius.Value),
													  agg::uround(m_radius.Value));
					}
				}

				if(m_channel_b.Checked)
				{
					typedef agg::pixfmt_alpha_blend_gray<
						agg::blender_gray8,
						agg::rendering_buffer,
						3, 0> pixfmt_gray8b;

					pixfmt_gray8b pixf2b(m_rbuf2);
					if(pixf2b.attach(pixf, int(bbox.x1), int(bbox.y1), int(bbox.x2), int(bbox.y2)))
					{
						agg::stack_blur_gray8(pixf2b, agg::uround(m_radius.Value),
													  agg::uround(m_radius.Value));
					}
				}
				 */
			}

			double tm = stopwatch.ElapsedMilliseconds;

			// Render the shape itself
			//------------------
			if (m_FlattenCurves.Checked)
			{
				m_ras.add_path(m_shape);
			}
			else
			{
				m_ras.add_path(m_path);
			}

			scanlineRenderer.RenderSolid(clippingProxy, m_ras, m_sl, new RGBA_Floats(0.6, 0.9, 0.7, 0.8).GetAsRGBA_Bytes());

			graphics2D.DrawString(string.Format("{0:F2} ms", tm), 140, 30);
			base.OnDraw(graphics2D);
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:101,代码来源:blur.cs

示例5: Draw

        public void Draw(MatterHackers.Agg.Transform.ITransform Position, Graphics2D renderer)
        {
            double TextHeight = m_Position.y - 20;
            double Range = (m_DataViewMaxY - m_DataViewMinY);
            VertexSourceApplyTransform TransformedLinesToDraw;
            Stroke StrockedTransformedLinesToDraw;

            RoundedRect BackGround = new RoundedRect(m_Position.x, m_Position.y - 1, m_Position.x + m_Width, m_Position.y - 1 + m_Height + 2, 5);
            VertexSourceApplyTransform TransformedBackGround = new VertexSourceApplyTransform(BackGround, Position);
            renderer.Render(TransformedBackGround, new RGBA_Bytes(0, 0, 0, .5));

            // if the 0 line is within the window than draw it.
            if (m_DataViewMinY < 0 && m_DataViewMaxY > 0)
            {
                m_LinesToDraw.remove_all();
                m_LinesToDraw.MoveTo(m_Position.x,
                    m_Position.y + ((0 - m_DataViewMinY) * m_Height / Range));
                m_LinesToDraw.LineTo(m_Position.x + m_Width,
                    m_Position.y + ((0 - m_DataViewMinY) * m_Height / Range));
                TransformedLinesToDraw = new VertexSourceApplyTransform(m_LinesToDraw, Position);
                StrockedTransformedLinesToDraw = new Stroke(TransformedLinesToDraw);
            	renderer.Render(StrockedTransformedLinesToDraw, new RGBA_Bytes(0, 0, 0, 1));
            }

            double MaxMax = -999999999;
            double MinMin = 999999999;
            double MaxAverage = 0;
            foreach (KeyValuePair<String, HistoryData> historyKeyValue in m_DataHistoryArray)
	        {
                HistoryData history = historyKeyValue.Value;
                m_LinesToDraw.remove_all();
                MaxMax = System.Math.Max(MaxMax, history.GetMaxValue());
                MinMin = System.Math.Min(MinMin, history.GetMinValue());
                MaxAverage = System.Math.Max(MaxAverage, history.GetAverageValue());
		        for(int i = 0; i < m_Width - 1; i++)
		        {
                    if(i==0)
                    {
                        m_LinesToDraw.MoveTo(m_Position.x + i,
                            m_Position.y + ((history.GetItem(i) - m_DataViewMinY) * m_Height / Range));
                    }
                    else
                    {
                        m_LinesToDraw.LineTo(m_Position.x + i,
                            m_Position.y + ((history.GetItem(i) - m_DataViewMinY) * m_Height / Range));
                    }
		        }

                TransformedLinesToDraw = new VertexSourceApplyTransform(m_LinesToDraw, Position);
                StrockedTransformedLinesToDraw = new Stroke(TransformedLinesToDraw);
            	renderer.Render(StrockedTransformedLinesToDraw, history.m_Color);
                
                String Text = historyKeyValue.Key + ": Min:" + MinMin.ToString("0.0") + " Max:" + MaxMax.ToString("0.0");
                renderer.DrawString(Text, m_Position.x, TextHeight - m_Height);
                TextHeight -= 20;
            }

            RoundedRect BackGround2 = new RoundedRect(m_Position.x, m_Position.y - 1, m_Position.x + m_Width, m_Position.y - 1 + m_Height + 2, 5);
            VertexSourceApplyTransform TransformedBackGround2 = new VertexSourceApplyTransform(BackGround2, Position);
            Stroke StrockedTransformedBackGround = new Stroke(TransformedBackGround2);
           	renderer.Render(StrockedTransformedBackGround, new RGBA_Bytes(0.0, 0, 0, 1));

            //renderer.Color = BoxColor;
            //renderer.DrawRect(m_Position.x, m_Position.y - 1, m_Width, m_Height + 2);
        }
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:65,代码来源:DataViewGraph.cs

示例6: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			double currentTextHeight = -20;
			double Range = (valueMax - valueMin);
			VertexSourceApplyTransform TransformedLinesToDraw;
			Stroke StrockedTransformedLinesToDraw;

			Vector2 renderOffset = new Vector2(1, Height - graphHeight - 22);
            RoundedRect backGround = new RoundedRect(renderOffset.x, renderOffset.y - 1, renderOffset.x + graphWidth, renderOffset.y - 1 + graphHeight + 2, 5);
			graphics2D.Render(backGround, new RGBA_Bytes(0, 0, 0, .5));

			// if the 0 line is within the window than draw it.
			if (valueMin < 0 && valueMax > 0)
			{
				linesToDrawStorage.remove_all();
				linesToDrawStorage.MoveTo(renderOffset.x,
					renderOffset.y + ((0 - valueMin) * graphHeight / Range));
				linesToDrawStorage.LineTo(renderOffset.x + graphWidth,
					renderOffset.y + ((0 - valueMin) * graphHeight / Range));
				StrockedTransformedLinesToDraw = new Stroke(linesToDrawStorage);
				graphics2D.Render(StrockedTransformedLinesToDraw, new RGBA_Bytes(0, 0, 0, 1));
			}

			double MaxMax = -999999999;
			double MinMin = 999999999;
			double MaxAverage = 0;
			foreach (KeyValuePair<String, HistoryData> historyKeyValue in dataHistoryArray)
			{
				HistoryData history = historyKeyValue.Value;
				linesToDrawStorage.remove_all();
				MaxMax = System.Math.Max(MaxMax, history.GetMaxValue());
				MinMin = System.Math.Min(MinMin, history.GetMinValue());
				MaxAverage = System.Math.Max(MaxAverage, history.GetAverageValue());
				for (int i = 0; i < graphWidth - 1; i++)
				{
					if (i == 0)
					{
						linesToDrawStorage.MoveTo(renderOffset.x + i,
							renderOffset.y + ((history.GetItem(i) - valueMin) * graphHeight / Range));
					}
					else
					{
						linesToDrawStorage.LineTo(renderOffset.x + i,
							renderOffset.y + ((history.GetItem(i) - valueMin) * graphHeight / Range));
					}
				}

				StrockedTransformedLinesToDraw = new Stroke(linesToDrawStorage);
				graphics2D.Render(StrockedTransformedLinesToDraw, history.lineColor);

				String Text = historyKeyValue.Key + ": Min:" + MinMin.ToString("0.0") + " Max:" + MaxMax.ToString("0.0") + " Avg:" + MaxAverage.ToString("0.0");
				graphics2D.DrawString(Text, renderOffset.x, renderOffset.y + currentTextHeight, backgroundColor: new RGBA_Bytes(RGBA_Bytes.White, 220), drawFromHintedCach: true);
				currentTextHeight -= 20;
			}

			RoundedRect BackGround2 = new RoundedRect(renderOffset.x, renderOffset.y - 1, renderOffset.x + graphWidth, renderOffset.y - 1 + graphHeight + 2, 5);
			Stroke StrockedTransformedBackGround = new Stroke(BackGround2);
			graphics2D.Render(StrockedTransformedBackGround, new RGBA_Bytes(0.0, 0, 0, 1));

			//renderer.Color = BoxColor;
			//renderer.DrawRect(m_Position.x, m_Position.y - 1, m_Width, m_Height + 2);

			base.OnDraw(graphics2D);
		}
开发者ID:broettge,项目名称:MatterControl,代码行数:64,代码来源:DataViewGraph.cs

示例7: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			Matrix4X4 currentRenderMatrix = trackballTumbleWidget.ModelviewMatrix;
			if (lastRenderedMatrix != currentRenderMatrix)
			{
				Stopwatch traceTime = new Stopwatch();
				traceTime.Start();
				rayTraceScene();
				traceTime.Stop();

				timingStrings.Add("Time to trace BVH {0:0.0}s".FormatWith(traceTime.Elapsed.TotalSeconds));
			}
			//allObjectsHolder.AxisToWorld = trackBallController.GetTransform4X4();

			graphics2D.FillRectangle(new RectangleDouble(0, 0, 1000, 1000), RGBA_Bytes.Red);
			graphics2D.Render(destImage, 0, 0);
			//trackBallController.DrawRadius(graphics2D);
			totalTime.Stop();
			timingStrings.Add("Total Time {0:0.0}s".FormatWith(totalTime.Elapsed.TotalSeconds));

			if (!SavedTimes)
			{
				SavedTimes = true;
				File.WriteAllLines("timing.txt", timingStrings.ToArray());
			}

			graphics2D.DrawString("Ray Trace: " + renderTime.ElapsedMilliseconds.ToString(), 20, 10);

			base.OnDraw(graphics2D);
			currentRenderMatrix = lastRenderedMatrix;
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:31,代码来源:RayTracerWiget.cs


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