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


C# VertexSource.RoundedRect类代码示例

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


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

示例1: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			RoundedRect rect = new RoundedRect(LocalBounds, 0);
			//RoundedRect rect = new RoundedRect(LocalBounds, 0);
			graphics2D.Render(rect, ThumbColor);
			base.OnDraw(graphics2D);
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:7,代码来源:ScrollBar.cs

示例2: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			Button parentButton = (Button)Parent;

			RectangleDouble Bounds = LocalBounds;

			RoundedRect rectBorder = new RoundedRect(Bounds, BorderRadius);
			if (parentButton.Enabled == true)
			{
				graphics2D.Render(rectBorder, new RGBA_Bytes(0, 0, 0));
			}
			else
			{
				graphics2D.Render(rectBorder, new RGBA_Bytes(128, 128, 128));
			}
			RectangleDouble insideBounds = Bounds;
			insideBounds.Inflate(-BorderWidth);
			RoundedRect rectInside = new RoundedRect(insideBounds, Math.Max(BorderRadius - BorderWidth, 0));
			RGBA_Bytes insideColor = new RGBA_Bytes(1.0, 1.0, 1.0);
			if (parentButton.FirstWidgetUnderMouse)
			{
				if (parentButton.MouseDownOnButton)
				{
					insideColor = DefaultViewFactory.DefaultBlue;
				}
				else
				{
					insideColor = DefaultViewFactory.DefaultBlue.GetAsRGBA_Floats().Blend(RGBA_Floats.White, .75).GetAsRGBA_Bytes();
				}
			}

			graphics2D.Render(rectInside, insideColor);

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

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

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

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

示例6: Generate

		public Button Generate(string normalImageName, string hoverImageName, string pressedImageName = null, string disabledImageName = null)
		{
			if (pressedImageName == null)
			{
				pressedImageName = hoverImageName;
			}

			if (disabledImageName == null)
			{
				disabledImageName = normalImageName;
			}

			Agg.Image.ImageBuffer normalImage = StaticData.Instance.LoadIcon(normalImageName);
			Agg.Image.ImageBuffer pressedImage = StaticData.Instance.LoadIcon(pressedImageName);
			Agg.Image.ImageBuffer hoverImage = StaticData.Instance.LoadIcon(hoverImageName);
			Agg.Image.ImageBuffer disabledImage = StaticData.Instance.LoadIcon(disabledImageName);

			if (!ActiveTheme.Instance.IsDarkTheme && invertImageColor)
			{
				InvertLightness.DoInvertLightness(normalImage);
				InvertLightness.DoInvertLightness(pressedImage);
				InvertLightness.DoInvertLightness(hoverImage);
				InvertLightness.DoInvertLightness(disabledImage);
			}

			if (ActiveTheme.Instance.IsTouchScreen)
			{
				//normalImage.NewGraphics2D().Line(0, 0, normalImage.Width, normalImage.Height, RGBA_Bytes.Violet);
				RoundedRect rect = new RoundedRect(pressedImage.GetBounds(), 0);
				pressedImage.NewGraphics2D().Render(new Stroke(rect, 3), ActiveTheme.Instance.PrimaryTextColor);
			}

			ButtonViewStates buttonViewWidget = new ButtonViewStates(
				new ImageWidget(normalImage),
				new ImageWidget(hoverImage),
				new ImageWidget(pressedImage),
				new ImageWidget(disabledImage)
			);

			//Create button based on view container widget
			Button imageButton = new Button(0, 0, buttonViewWidget);
			imageButton.Margin = new BorderDouble(0);
			imageButton.Padding = new BorderDouble(0);
			return imageButton;
		}
开发者ID:fuding,项目名称:MatterControl,代码行数:45,代码来源:ImageButtonFactory.cs

示例7: OnDraw

		public override void OnDraw(Agg.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);

			if (this.isUnderlined)
			{
				//Printer.TypeFaceStyle.DoUnderline = true;
				RectangleDouble underline = new RectangleDouble(LocalBounds.Left, LocalBounds.Bottom, LocalBounds.Right, LocalBounds.Bottom);
				graphics2D.Rectangle(underline, buttonText.TextColor);
			}

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

示例8: DrawBorder

 private void DrawBorder(Graphics2D graphics2D)
 {
     RectangleDouble Bounds = LocalBounds;
     RoundedRect borderRect = new RoundedRect(this.LocalBounds, 0);
     Stroke strokeRect = new Stroke(borderRect, borderWidth);
     graphics2D.Render(strokeRect, borderColor);
 }
开发者ID:jeske,项目名称:agg-sharp,代码行数:7,代码来源:DropDownList.cs

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

示例10: Rectangle

		public override void Rectangle(double left, double bottom, double right, double top, RGBA_Bytes color, double strokeWidth)
		{
			RoundedRect rect = new RoundedRect(left + .5, bottom + .5, right - .5, top - .5, 0);
			Stroke rectOutline = new Stroke(rect, strokeWidth);

			Render(rectOutline, color);
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:7,代码来源:ImageGraphics2D.cs

示例11: FillRectangle

		public override void FillRectangle(double left, double bottom, double right, double top, IColorType fillColor)
		{
			RoundedRect rect = new RoundedRect(left, bottom, right, top, 0);
			Render(rect, fillColor.GetAsRGBA_Bytes());
		}
开发者ID:CNCBrasil,项目名称:agg-sharp,代码行数:5,代码来源:ImageGraphics2D.cs

示例12: OnDraw

        public override void OnDraw(Graphics2D graphics2D)
        {
            RectangleDouble borderRectangle = LocalBounds;
            RoundedRect rectBorder = new RoundedRect(borderRectangle, 0);

            graphics2D.Render(new Stroke(rectBorder, BorderWidth), BorderColor);
            base.OnDraw(graphics2D);
        }
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:8,代码来源:ClickWidget.cs

示例13: OnDraw

		public override void OnDraw(Graphics2D graphics2D)
		{
			double fontHeight = internalTextWidget.Printer.TypeFaceStyle.EmSizeInPixels;

			if (Selecting
				&& SelectionIndexToStartBefore != CharIndexToInsertBefore)
			{
				Vector2 selectPosition = internalTextWidget.Printer.GetOffsetLeftOfCharacterIndex(SelectionIndexToStartBefore);

				// for each selected line draw a rect for the chars of that line
				if (selectPosition.y == InsertBarPosition.y)
				{
					RectangleDouble bar = new RectangleDouble(Math.Ceiling(selectPosition.x),
											Math.Ceiling(internalTextWidget.Height + selectPosition.y),
											Math.Ceiling(InsertBarPosition.x + 1),
											Math.Ceiling(internalTextWidget.Height + InsertBarPosition.y - fontHeight));

					RoundedRect selectCursorRect = new RoundedRect(bar, 0);
					graphics2D.Render(selectCursorRect, this.highlightColor);
				}
				else
				{
					int firstCharToHighlight = Math.Min(CharIndexToInsertBefore, SelectionIndexToStartBefore);
					int lastCharToHighlight = Math.Max(CharIndexToInsertBefore, SelectionIndexToStartBefore);
					int lineStart = firstCharToHighlight;
					Vector2 lineStartPos = internalTextWidget.Printer.GetOffsetLeftOfCharacterIndex(lineStart);
					int lineEnd = lineStart + 1;
					Vector2 lineEndPos = internalTextWidget.Printer.GetOffsetLeftOfCharacterIndex(lineEnd);
					if (lineEndPos.y != lineStartPos.y)
					{
						// we are starting on a '\n', adjust so we will show the cr at the end of the line
						lineEndPos = lineStartPos;
					}
					bool firstCharOfLine = false;
					for (int i = lineEnd; i < lastCharToHighlight + 1; i++)
					{
						Vector2 nextPos = internalTextWidget.Printer.GetOffsetLeftOfCharacterIndex(i);
						if (firstCharOfLine)
						{
							if (lineEndPos.y != lineStartPos.y)
							{
								// we are starting on a '\n', adjust so we will show the cr at the end of the line
								lineEndPos = lineStartPos;
							}
							firstCharOfLine = false;
						}
						if (nextPos.y != lineStartPos.y)
						{
							if (lineEndPos.x == lineStartPos.x)
							{
								lineEndPos.x += Printer.TypeFaceStyle.GetAdvanceForCharacter(' ');
							}
							RectangleDouble bar = new RectangleDouble(Math.Ceiling(lineStartPos.x),
													Math.Ceiling(internalTextWidget.Height + lineStartPos.y),
													Math.Ceiling(lineEndPos.x + 1),
													Math.Ceiling(internalTextWidget.Height + lineEndPos.y - fontHeight));

							RoundedRect selectCursorRect = new RoundedRect(bar, 0);
							graphics2D.Render(selectCursorRect, this.highlightColor);
							lineStartPos = nextPos;
							firstCharOfLine = true;
						}
						else
						{
							lineEndPos = nextPos;
						}
					}
					if (lineEndPos.x != lineStartPos.x)
					{
						RectangleDouble bar = new RectangleDouble(Math.Ceiling(lineStartPos.x),
												Math.Ceiling(internalTextWidget.Height + lineStartPos.y),
												Math.Ceiling(lineEndPos.x + 1),
												Math.Ceiling(internalTextWidget.Height + lineEndPos.y - fontHeight));

						RoundedRect selectCursorRect = new RoundedRect(bar, 0);
						graphics2D.Render(selectCursorRect, this.highlightColor);
					}
				}
			}

			if (this.Focused && BarIsShowing)
			{
				double xFraction = graphics2D.GetTransform().tx;
				xFraction = xFraction - (int)xFraction;
				RectangleDouble bar2 = new RectangleDouble(Math.Ceiling(InsertBarPosition.x) - xFraction,
										Math.Ceiling(internalTextWidget.Height + InsertBarPosition.y - fontHeight),
										Math.Ceiling(InsertBarPosition.x + 1) - xFraction,
										Math.Ceiling(internalTextWidget.Height + InsertBarPosition.y));
				RoundedRect cursorRect = new RoundedRect(bar2, 0);
				graphics2D.Render(cursorRect, this.cursorColor);
			}

			RectangleDouble boundsPlusPoint5 = LocalBounds;
			boundsPlusPoint5.Inflate(-.5);
			RoundedRect borderRect = new RoundedRect(boundsPlusPoint5, 0);
			Stroke borderLine = new Stroke(borderRect);

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

示例14: OnDraw

        public override void OnDraw(Graphics2D graphics2D)
        {
            base.OnDraw(graphics2D);
            
            if (this.isActivePrint)
            {
                //RectangleDouble Bounds = LocalBounds;
                //RoundedRect rectBorder = new RoundedRect(Bounds, 0);

                this.BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
                SetTextColors(RGBA_Bytes.White);

                //graphics2D.Render(new Stroke(rectBorder, 4), ActiveTheme.Instance.SecondaryAccentColor);
            }            
            else if (this.isHoverItem)
            {
                RectangleDouble Bounds = LocalBounds;
                RoundedRect rectBorder = new RoundedRect(Bounds, 0);

                this.BackgroundColor = RGBA_Bytes.White;
                SetTextColors(RGBA_Bytes.Black);

                graphics2D.Render(new Stroke(rectBorder, 3), ActiveTheme.Instance.SecondaryAccentColor);
            }
			else
			{	
				this.BackgroundColor = RGBA_Bytes.White;
                SetTextColors(RGBA_Bytes.Black);                
			}
        }
开发者ID:klewisjohnson,项目名称:MatterControl,代码行数:30,代码来源:QueueRowItem.cs

示例15: OnDraw

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

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

			ImageClippingProxy clippingProxy = new ImageClippingProxy(widgetsSubImage);
			clippingProxy.clear(new RGBA_Floats(0, 0, 0));

			m_profile.text_size(8.0);

			// draw a background to show how the alpha is working
			int RectWidth = 32;
			int xoffset = 238;
			int yoffset = 171;
			ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
			for (int i = 0; i < 7; i++)
			{
				for (int j = 0; j < 7; j++)
				{
					if ((i + j) % 2 != 0)
					{
						VertexSource.RoundedRect rect = new VertexSource.RoundedRect(i * RectWidth + xoffset, j * RectWidth + yoffset,
							(i + 1) * RectWidth + xoffset, (j + 1) * RectWidth + yoffset, 2);
						rect.normalize_radius();

						ras.add_path(rect);
						scanlineRenderer.RenderSolid(clippingProxy, ras, sl, new RGBA_Bytes(.9, .9, .9));
					}
				}
			}

			double ini_scale = 1.0;

			Transform.Affine mtx1 = Affine.NewIdentity();
			mtx1 *= Affine.NewScaling(ini_scale, ini_scale);
			mtx1 *= Affine.NewTranslation(center_x, center_y);

			VertexSource.Ellipse e1 = new MatterHackers.Agg.VertexSource.Ellipse();
			e1.init(0.0, 0.0, 110.0, 110.0, 64);

			Transform.Affine mtx_g1 = Affine.NewIdentity();
			mtx_g1 *= Affine.NewScaling(ini_scale, ini_scale);
			mtx_g1 *= Affine.NewScaling(m_SaveData.m_scale, m_SaveData.m_scale);
			mtx_g1 *= Affine.NewScaling(m_scale_x, m_scale_y);
			mtx_g1 *= Affine.NewRotation(m_SaveData.m_angle);
			mtx_g1 *= Affine.NewTranslation(m_SaveData.m_center_x, m_SaveData.m_center_y);
			mtx_g1.invert();

			RGBA_Bytes[] color_profile = new RGBA_Bytes[256]; // color_type is defined in pixel_formats.h
			for (int i = 0; i < 256; i++)
			{
				color_profile[i] = new RGBA_Bytes(m_spline_r.spline()[i],
														m_spline_g.spline()[i],
														m_spline_b.spline()[i],
														m_spline_a.spline()[i]);
			}

			VertexSourceApplyTransform t1 = new VertexSourceApplyTransform(e1, mtx1);

			IGradient innerGradient = null;
			switch (m_GradTypeRBox.SelectedIndex)
			{
				case 0:
					innerGradient = new gradient_radial();
					break;

				case 1:
					innerGradient = new gradient_diamond();
					break;

				case 2:
					innerGradient = new gradient_x();
					break;

				case 3:
					innerGradient = new gradient_xy();
					break;

				case 4:
					innerGradient = new gradient_sqrt_xy();
					break;

				case 5:
					innerGradient = new gradient_conic();
					break;
			}

			IGradient outerGradient = null;
			switch (m_GradWrapRBox.SelectedIndex)
			{
				case 0:
					outerGradient = new gradient_reflect_adaptor(innerGradient);
					break;

				case 1:
					outerGradient = new gradient_repeat_adaptor(innerGradient);
					break;

//.........这里部分代码省略.........
开发者ID:annafeldman,项目名称:agg-sharp,代码行数:101,代码来源:gradients.cs


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