• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Agg.Graphics2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Graphics2D类属于MatterHackers.Agg命名空间,在下文中一共展示了Graphics2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DoDraw

		protected override void DoDraw(Graphics2D destRenderer)
		{
			ImageBuffer imageToDraw = ImageSequenceReference.Instance.GetImageByTime(m_TotalSeconds);
			//Image imageToDraw = m_PlayerShipSequence.GetImageByIndex(m_ImageIndex);
			//IBlender blender = new BlenderBGRA();
			IRecieveBlenderByte recieveBlender = new BlenderPreMultBGR();

			/*
			unsafe
			{
				IImage destBuffer = destRenderer.DestImage;
				byte* pPixels = destBuffer.GetPixelPointerY(200);
				byte[] sourceBuffer = imageToDraw.ByteBuffer;
				for (int y = 0; y < imageToDraw.Height(); y++)
				{
					int SourceYOffset = y * imageToDraw.StrideInBytes();
					int destYOffset = (int)destBuffer.StrideInBytesAbs() * y;
					for (int x = 0; x < imageToDraw.Width(); x++)
					{
						int sourceOffset = SourceYOffset + x * 4;
						RGBA_Bytes sourceColor = new RGBA_Bytes(sourceBuffer[sourceOffset + 2], sourceBuffer[sourceOffset + 1], sourceBuffer[sourceOffset + 0], sourceBuffer[sourceOffset + 3]);
						blender.BlendPixel(&pPixels[destYOffset + x * 4], sourceColor);
					}
				}
			}
			 */
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:27,代码来源:SequenceEntity.cs


示例2: DrawTo

		public static void DrawTo(Graphics2D graphics2D, Mesh meshToDraw, Vector2 offset, double scale, RGBA_Bytes silhouetteColor)
		{
			graphics2D.Rasterizer.gamma(new gamma_power(.3));
			PathStorage polygonProjected = new PathStorage();
			foreach (Face face in meshToDraw.Faces)
			{
				if (face.normal.z > 0)
				{
					polygonProjected.remove_all();
					bool first = true;
					foreach (FaceEdge faceEdge in face.FaceEdges())
					{
						Vector2 position = new Vector2(faceEdge.firstVertex.Position.x, faceEdge.firstVertex.Position.y);
						position += offset;
						position *= scale;
						if (first)
						{
							polygonProjected.MoveTo(position.x, position.y);
							first = false;
						}
						else
						{
							polygonProjected.LineTo(position.x, position.y);
						}
					}
					graphics2D.Render(polygonProjected, silhouetteColor);
				}
			}
			graphics2D.Rasterizer.gamma(new gamma_none());
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:30,代码来源:OrthographicZProjection.cs


示例3: OnDraw

 public override void OnDraw(Graphics2D graphics2D)
 {
     RectangleDouble barBounds = bar.BoundsRelativeToParent;
     graphics2D.FillRectangle(barBounds.Left, barBounds.Bottom, barBounds.Left + barBounds.Width * PercentComplete / 100.0, barBounds.Top, ActiveTheme.Instance.PrimaryAccentColor);
     graphics2D.Rectangle(barBounds, RGBA_Bytes.Black);
     base.OnDraw(graphics2D);
 }
开发者ID:rubenkar,项目名称:MatterControl,代码行数:7,代码来源:ProgressControl.cs


示例4: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			DrawBorder(graphics2D);
			DrawBackground(graphics2D);

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


示例5: OnDraw

        public override void OnDraw(Graphics2D graphics2D)
        {
            GameImageSequence menuBackground = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "CreditsScreen");
            graphics2D.Render(menuBackground.GetImageByIndex(0), 0, 0);

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


示例6: OnDraw

 public override void OnDraw(Graphics2D graphics2D)
 {
     base.OnDraw(graphics2D);
     RectangleDouble border = LocalBounds;
     border.Deflate(new BorderDouble(1));
     graphics2D.Rectangle(border, ActiveTheme.Instance.SecondaryBackgroundColor, 4);
 }
开发者ID:rubenkar,项目名称:MatterControl,代码行数:7,代码来源:ThemeColorSelectorWidget.cs


示例7: OnDraw

        public override void OnDraw(Graphics2D graphics2D)
        {
            ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect());

            IImageByte backBuffer = widgetsSubImage;
            
            GammaLookUpTable gamma = new GammaLookUpTable(m_gamma.Value);
            IRecieveBlenderByte NormalBlender = new BlenderBGRA();
            IRecieveBlenderByte GammaBlender = new BlenderGammaBGRA(gamma);
            ImageBuffer rasterNormal = new ImageBuffer();
            rasterNormal.Attach(backBuffer, NormalBlender);
            ImageBuffer rasterGamma = new ImageBuffer();
            rasterGamma.Attach(backBuffer, GammaBlender);
            ImageClippingProxy clippingProxyNormal = new ImageClippingProxy(rasterNormal);
            ImageClippingProxy clippingProxyGamma = new ImageClippingProxy(rasterGamma);

            clippingProxyNormal.clear(m_white_on_black.Checked ? new RGBA_Floats(0, 0, 0) : new RGBA_Floats(1, 1, 1));

            ScanlineRasterizer ras = new ScanlineRasterizer();
            ScanlineCachePacked8 sl = new ScanlineCachePacked8();

            VertexSource.Ellipse e = new VertexSource.Ellipse();

            // TODO: If you drag the control circles below the bottom of the window we get an exception.  This does not happen in AGG.
            // It needs to be debugged.  Turning on clipping fixes it.  But standard agg works without clipping.  Could be a bigger problem than this.
            //ras.clip_box(0, 0, width(), height());

            // Render two "control" circles
            e.init(m_x[0], m_y[0], 3, 3, 16);
            ras.add_path(e);
            ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
            scanlineRenderer.render_scanlines_aa_solid(clippingProxyNormal, ras, sl, new RGBA_Bytes(127, 127, 127));
            e.init(m_x[1], m_y[1], 3, 3, 16);
            ras.add_path(e);
            scanlineRenderer.render_scanlines_aa_solid(clippingProxyNormal, ras, sl, new RGBA_Bytes(127, 127, 127));

            double d = m_offset.Value;

            // Creating a rounded rectangle
            VertexSource.RoundedRect r = new VertexSource.RoundedRect(m_x[0] + d, m_y[0] + d, m_x[1] + d, m_y[1] + d, m_radius.Value);
            r.normalize_radius();

            // Drawing as an outline
            if (!m_DrawAsOutlineCheckBox.Checked)
            {
                Stroke p = new Stroke(r);
                p.width(1.0);
                ras.add_path(p);
            }
            else
            {
                ras.add_path(r);
            }

            scanlineRenderer.render_scanlines_aa_solid(clippingProxyGamma, ras, sl, m_white_on_black.Checked ? new RGBA_Bytes(255, 255, 255) : new RGBA_Bytes(0, 0, 0));

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


示例8: OnDraw

        public override void OnDraw(Graphics2D graphics2D)
        {
            GameImageSequence background = (GameImageSequence)DataAssetCache.Instance.GetAsset(typeof(GameImageSequence), "GameBackground");
            graphics2D.Render(background.GetImageByIndex(0), 0, 0);

            m_Playfield.Draw(graphics2D);

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


示例9: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			int thumbHeight = 10;
			//graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Black);
			double bottom = textScrollWidget.Position0To1 * (Height - thumbHeight);// the 2 is the border
			RectangleDouble thumb = new RectangleDouble(0, bottom, Width, bottom + thumbHeight);// the 1 is the border
			graphics2D.FillRectangle(thumb, RGBA_Bytes.DarkGray);
			base.OnDraw(graphics2D);
		}
开发者ID:fuding,项目名称:MatterControl,代码行数:9,代码来源:TextScrolBar.cs


示例10: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			base.OnDraw(graphics2D);

			if (Focused)
			{
				graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Orange);
			}
		}
开发者ID:tellingmachine,项目名称:MatterControl,代码行数:9,代码来源:PrinterChooser.cs


示例11: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			base.OnDraw(graphics2D);
			if (this.Width != TargetWidth)
			{
				SetSlidePosition();
				Invalidate();
			}
		}
开发者ID:broettge,项目名称:MatterControl,代码行数:9,代码来源:SlideWidget.cs


示例12: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			base.OnDraw(graphics2D);
			if (currentPanelIndex != desiredPanelIndex)
			{
				SetSlidePosition();
				Invalidate();
			}
		}
开发者ID:rorypond,项目名称:MatterControl,代码行数:9,代码来源:SlidePanelWidget.cs


示例13: OnDraw

        public override void OnDraw(Graphics2D graphics2D)
        {
            graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Black);

            RoundedRect boundsRect = new RoundedRect(dragBar.BoundsRelativeToParent, 0);
            graphics2D.Render(boundsRect, DragBarColor);

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


示例14: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			SetNoContentFieldDescriptionVisibility();
			base.OnDraw(graphics2D);

			if (ContainsFocus)
			{
				graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Orange);
			}
		}
开发者ID:broettge,项目名称:MatterControl,代码行数:10,代码来源:MHTextEditWidget.cs


示例15: DrawBorder

		private void DrawBorder(Graphics2D graphics2D)
		{
			if (borderColor.Alpha0To255 > 0)
			{
				RectangleDouble boarderRectangle = LocalBounds;

				RoundedRect rectBorder = new RoundedRect(boarderRectangle, 0);

				graphics2D.Render(new Stroke(rectBorder, borderWidth), borderColor);
			}
		}
开发者ID:broettge,项目名称:MatterControl,代码行数:11,代码来源:DropDownMenuFactory.cs


示例16: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect());

			int width = (int)widgetsSubImage.Width;
			int height = (int)widgetsSubImage.Height;

			ImageBuffer clippedSubImage = new ImageBuffer();
			clippedSubImage.Attach(widgetsSubImage, new BlenderBGRA());
			ImageClippingProxy imageClippingProxy = new ImageClippingProxy(clippedSubImage);
			imageClippingProxy.clear(new RGBA_Floats(1, 1, 1));

			Affine transform = Affine.NewIdentity();
			transform *= Affine.NewTranslation(-lionShape.Center.x, -lionShape.Center.y);
			transform *= Affine.NewScaling(lionScale, lionScale);
			transform *= Affine.NewRotation(angle + Math.PI);
			transform *= Affine.NewSkewing(skewX / 1000.0, skewY / 1000.0);
			transform *= Affine.NewTranslation(width / 2, height / 2);

			if (renderAsScanlineCheckBox.Checked)
			{
				rasterizer.SetVectorClipBox(0, 0, width, height);

				Stroke stroke = new Stroke(lionShape.Path);
				stroke.width(widthSlider.Value);
				stroke.line_join(LineJoin.Round);
				VertexSourceApplyTransform trans = new VertexSourceApplyTransform(stroke, transform);
				ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
				scanlineRenderer.RenderSolidAllPaths(imageClippingProxy, rasterizer, scanlineCache, trans, lionShape.Colors, lionShape.PathIndex, lionShape.NumPaths);
			}
			else
			{
				double w = widthSlider.Value * transform.GetScale();

				LineProfileAnitAlias lineProfile = new LineProfileAnitAlias(w, new gamma_none());
				OutlineRenderer outlineRenderer = new OutlineRenderer(imageClippingProxy, lineProfile);
				rasterizer_outline_aa rasterizer = new rasterizer_outline_aa(outlineRenderer);

				rasterizer.line_join(renderAccurateJoinsCheckBox.Checked ?
					rasterizer_outline_aa.outline_aa_join_e.outline_miter_accurate_join
					: rasterizer_outline_aa.outline_aa_join_e.outline_round_join);
				rasterizer.round_cap(true);

				VertexSourceApplyTransform trans = new VertexSourceApplyTransform(lionShape.Path, transform);

				rasterizer.RenderAllPaths(trans, lionShape.Colors, lionShape.PathIndex, lionShape.NumPaths);
			}

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


示例17: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			RectangleDouble Bounds = LocalBounds;
			RoundedRect rectBorder = new RoundedRect(Bounds, this.borderRadius);

			graphics2D.Render(rectBorder, borderColor);

			RectangleDouble insideBounds = Bounds;
			insideBounds.Inflate(-this.borderWidth);
			RoundedRect rectInside = new RoundedRect(insideBounds, Math.Max(this.borderRadius - this.borderWidth, 0));

			graphics2D.Render(rectInside, this.fillColor);

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


示例18: 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


示例19: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			if (!startedLoad)
			{
				try
				{
					startedLoad = true;
					WebClient client = new WebClient();
					client.DownloadDataCompleted += client_DownloadDataCompleted;
					client.DownloadDataAsync(new Uri(uriToLoad));
				}
				catch (Exception)
				{
				}
			}

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


示例20: DebugRenderToImage

		public DebugRenderToImage(Mesh meshToRender)
		{
			this.meshToRender = meshToRender;
			image = new ImageBuffer(xResolution, yResolution, 32, new BlenderBGRA());
			graphics = image.NewGraphics2D();

			// assume project on y for now
			foreach (Vertex vertex in meshToRender.Vertices)
			{
				min.x = Math.Min(min.x, vertex.Position[xAxis]);
				min.y = Math.Min(min.y, vertex.Position[yAxis]);

				max.x = Math.Max(max.x, vertex.Position[xAxis]);
				max.y = Math.Max(max.y, vertex.Position[yAxis]);
			}

			scale = Math.Min((image.Width - padding * 2) / (max.x - min.x), (image.Height - padding * 2) / (max.y - min.y));
			origin = new Vector2(min.x * scale, min.y * scale) - new Vector2(padding, padding);
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:19,代码来源:DebugRenderToImage.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Agg.RGBA_Bytes类代码示例发布时间:2022-05-26
下一篇:
C# Agg.BorderDouble类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap