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


C# Agg.Graphics2D类代码示例

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


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


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