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


C# Cairo.LinearGradient.AddColorStop方法代码示例

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


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

示例1: DrawIcon

		static void DrawIcon (MonoTextEditor editor, Cairo.Context cr, DocumentLine lineSegment, double x, double y, double width, double height)
		{
			if (lineSegment.IsBookmarked) {
				var color1 = editor.ColorStyle.Bookmarks.Color;
				var color2 = editor.ColorStyle.Bookmarks.SecondColor;
				
				DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4);

				// FIXME: VV: Remove gradient features
				using (var pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4)) {
					pat.AddColorStop (0, color1);
					pat.AddColorStop (1, color2);
					cr.SetSource (pat);
					cr.FillPreserve ();
				}

				// FIXME: VV: Remove gradient features
				using (var pat = new Cairo.LinearGradient (x, y + height, x + width, y)) {
					pat.AddColorStop (0, color2);
					//pat.AddColorStop (1, color1);
					cr.SetSource (pat);
					cr.Stroke ();
				}
			}
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:25,代码来源:BookmarkMarker.cs

示例2: DrawFace

		static void DrawFace (Cairo.PointD center, double radius, Cairo.Context e)
		{
			e.Arc (center.X, center.Y, radius, 0, 360);
			Cairo.Gradient pat = new Cairo.LinearGradient (100, 200, 200, 100);
			pat.AddColorStop (0, Eto.Drawing.Color.FromArgb (240, 240, 230, 75).ToCairo ());
			pat.AddColorStop (1, Eto.Drawing.Color.FromArgb (0, 0, 0, 50).ToCairo ());
			e.LineWidth = 0.1;
			e.Pattern = pat;
			e.FillPreserve ();
			e.Stroke ();
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:11,代码来源:AnalogClock.cs

示例3: DrawFace

		void DrawFace (Cairo.PointD center, double radius, Cairo.Context e)
		{
			e.Arc (center.X, center.Y, radius, 0, 360);
			Cairo.Gradient pat = new Cairo.LinearGradient (100, 200, 200, 100);
			pat.AddColorStop (0, Generator.ConvertC (new Eto.Drawing.Color (240, 240, 230, 75)));
			pat.AddColorStop (1, Generator.ConvertC (new Eto.Drawing.Color (0, 0, 0, 50)));
			e.LineWidth = 0.1;
			e.Pattern = pat;
			e.FillPreserve ();
			e.Stroke ();
		}
开发者ID:hultqvist,项目名称:Eto,代码行数:11,代码来源:AnalogClock.cs

示例4: DrawIcon

		public void DrawIcon (TextEditor editor, Cairo.Context cr, LineSegment lineSegment, int lineNumber, double x, double y, double width, double height)
		{
			if (lineSegment.IsBookmarked) {
				Cairo.Color color1 = editor.ColorStyle.BookmarkColor1;
				Cairo.Color color2 = editor.ColorStyle.BookmarkColor2;
				
				DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4);
				Cairo.Gradient pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4);
				pat.AddColorStop (0, color1);
				pat.AddColorStop (1, color2);
				cr.Pattern = pat;
				cr.FillPreserve ();
				
				pat = new Cairo.LinearGradient (x, y + height, x + width, y);
				pat.AddColorStop (0, color2);
				//pat.AddColorStop (1, color1);
				cr.Pattern = pat;
				cr.Stroke ();
			}
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:20,代码来源:BookmarkMarker.cs

示例5: DrawIcon

		public void DrawIcon (TextEditor editor, Gdk.Drawable win, LineSegment lineSegment, int lineNumber, int x, int y, int width, int height)
		{
			if (lineSegment.IsBookmarked) {
				Cairo.Color color1 = Style.ToCairoColor (editor.ColorStyle.BookmarkColor1);
				Cairo.Color color2 = Style.ToCairoColor (editor.ColorStyle.BookmarkColor2);
				
				Cairo.Context cr = Gdk.CairoHelper.Create (win);
				DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4);
				Cairo.Gradient pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4);
				pat.AddColorStop (0, color1);
				pat.AddColorStop (1, color2);
				cr.Pattern = pat;
				cr.FillPreserve ();
				
				pat = new Cairo.LinearGradient (x, y + height, x + width, y);
				pat.AddColorStop (0, color2);
				//pat.AddColorStop (1, color1);
				cr.Pattern = pat;
				cr.Stroke ();
				((IDisposable)cr).Dispose();
			}
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:22,代码来源:BookmarkMarker.cs

示例6: OnExposeEvent

			protected override bool OnExposeEvent (Gdk.EventExpose evnt)
			{
				using (var context = Gdk.CairoHelper.Create (evnt.Window)) {
					context.Rectangle (
						evnt.Area.X,
						evnt.Area.Y,
						evnt.Area.Width,
						evnt.Area.Height
					);
					context.Clip ();
					context.LineWidth = 1;
					if (Background != null && Background.Width > 0) {
						for (int x=0; x < Allocation.Width; x += Background.Width) {
							Background.Show (context, x, -TitleBarHeight);
						}
					} else {
						context.Rectangle (0, 0, Allocation.Width, Allocation.Height);
						using (var lg = new Cairo.LinearGradient (0, 0, 0, Allocation.Height)) {
							lg.AddColorStop (0, Style.Light (Gtk.StateType.Normal).ToCairoColor ());
							lg.AddColorStop (1, Style.Mid (Gtk.StateType.Normal).ToCairoColor ());
							context.SetSource (lg);
						}
						context.Fill ();

					}
					context.MoveTo (0, Allocation.Height - 0.5);
					context.RelLineTo (Allocation.Width, 0);
					context.SetSourceColor (MonoDevelop.Ide.Gui.Styles.ToolbarBottomBorderColor);
					context.Stroke ();

					context.MoveTo (0, Allocation.Height - 1.5);
					context.RelLineTo (Allocation.Width, 0);
					context.SetSourceColor (MonoDevelop.Ide.Gui.Styles.ToolbarBottomGlowColor);
					context.Stroke ();

				}
				return base.OnExposeEvent (evnt);
			}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:38,代码来源:ExtendedTitleBarDialogBackend.cs

示例7: DrawBorder

		protected void DrawBorder (Cairo.Context cr, Cairo.Color color, double x, double y, double size)
		{
			using (var pat = new Cairo.LinearGradient (x, y + size, x + size, y)) {
				pat.AddColorStop (0, color);
				cr.Pattern = pat;
				cr.Stroke ();
			}
		}
开发者ID:nocache,项目名称:monodevelop,代码行数:8,代码来源:DebugTextMarker.cs

示例8: DrawCloseButton

		static void DrawCloseButton (Cairo.Context context, Gdk.Point center, bool hovered, double opacity, double animationProgress)
		{
			if (hovered) {
				double radius = 6;
				context.Arc (center.X, center.Y, radius, 0, Math.PI * 2);
				context.SetSourceRGBA (.6, .6, .6, opacity);
				context.Fill ();

				context.SetSourceRGBA (0.95, 0.95, 0.95, opacity);
				context.LineWidth = 2;

				context.MoveTo (center.X - 3, center.Y - 3);
				context.LineTo (center.X + 3, center.Y + 3);
				context.MoveTo (center.X - 3, center.Y + 3);
				context.LineTo (center.X + 3, center.Y - 3);
				context.Stroke ();
			} else {
				double lineColor = .63 - .1 * animationProgress;
				double fillColor = .74;

				double heightMod = Math.Max (0, 1.0 - animationProgress * 2);
				context.MoveTo (center.X - 3, center.Y - 3 * heightMod);
				context.LineTo (center.X + 3, center.Y + 3 * heightMod);
				context.MoveTo (center.X - 3, center.Y + 3 * heightMod);
				context.LineTo (center.X + 3, center.Y - 3 * heightMod);

				context.LineWidth = 2;
				context.SetSourceRGBA (lineColor, lineColor, lineColor, opacity);
				context.Stroke ();

				if (animationProgress > 0.5) {
					double partialProg = (animationProgress - 0.5) * 2;
					context.MoveTo (center.X - 3, center.Y);
					context.LineTo (center.X + 3, center.Y);

					context.LineWidth = 2 - partialProg;
					context.SetSourceRGBA (lineColor, lineColor, lineColor, opacity);
					context.Stroke ();


					double radius = partialProg * 3.5;

					// Background
					context.Arc (center.X, center.Y, radius, 0, Math.PI * 2);
					context.SetSourceRGBA (fillColor, fillColor, fillColor, opacity);
					context.Fill ();

					// Inset shadow
					using (var lg = new Cairo.LinearGradient (0, center.Y - 5, 0, center.Y)) {
						context.Arc (center.X, center.Y + 1, radius, 0, Math.PI * 2);
						lg.AddColorStop (0, new Cairo.Color (0, 0, 0, 0.2 * opacity));
						lg.AddColorStop (1, new Cairo.Color (0, 0, 0, 0));
						context.Pattern = lg;
						context.Stroke ();
					}

					// Outline
					context.Arc (center.X, center.Y, radius, 0, Math.PI * 2);
					context.SetSourceRGBA (lineColor, lineColor, lineColor, opacity);
					context.Stroke ();
				}
			}
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:63,代码来源:HoverCloseButton.cs

示例9: DrawBlockBg

		void DrawBlockBg (Cairo.Context ctx, double x, int width, BlockInfo block)
		{
			if (!IsChangeBlock (block.Type))
				return;
			
			x += 0.5;
			Gdk.Color color = block.Type == BlockType.Added ? baseAddColor : baseRemoveColor;
			double y = block.YStart + 0.5;
			int height = block.YEnd - block.YStart;
			
			double markerx = x + LeftPaddingBlock - 0.5;
			double rd = RoundedSectionRadius;
			if (block.SectionStart) {
				ctx.Arc (x + rd, y + rd, rd, 180 * (Math.PI / 180), 270 * (Math.PI / 180));
				ctx.LineTo (markerx, y);
			} else {
				ctx.MoveTo (markerx, y);
			}
			
			ctx.LineTo (markerx, y + height);
			
			if (block.SectionEnd) {
				ctx.LineTo (x + rd, y + height);
				ctx.Arc (x + rd, y + height - rd, rd, 90 * (Math.PI / 180), 180 * (Math.PI / 180));
			} else {
				ctx.LineTo (x, y + height);
			}
			if (block.SectionStart) {
				ctx.LineTo (x, y + rd);
			} else {
				ctx.LineTo (x, y);
			}
			ctx.Color = color.AddLight (0.1).ToCairoColor ();
			ctx.Fill ();
			
			ctx.Rectangle (markerx, y, width - markerx, height);
			Cairo.Gradient pat = new Cairo.LinearGradient (x, y, x + width, y);
			pat.AddColorStop (0, color.AddLight (0.21).ToCairoColor ());
			pat.AddColorStop (1, color.AddLight (0.3).ToCairoColor ());
			ctx.Pattern = pat;
			ctx.Fill ();
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:42,代码来源:CellRendererDiff.cs

示例10: OnExposeEvent

		protected override bool OnExposeEvent (Gdk.EventExpose evnt)
		{
			Gdk.Rectangle rect;
			
			if (GradientBackround) {
				rect = new Gdk.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
				HslColor gcol = Style.Background (Gtk.StateType.Normal);
				
				using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
					cr.NewPath ();
					cr.MoveTo (rect.X, rect.Y);
					cr.RelLineTo (rect.Width, 0);
					cr.RelLineTo (0, rect.Height);
					cr.RelLineTo (-rect.Width, 0);
					cr.RelLineTo (0, -rect.Height);
					cr.ClosePath ();
					Cairo.Gradient pat = new Cairo.LinearGradient (rect.X, rect.Y, rect.X, rect.Bottom);
					Cairo.Color color1 = gcol;
					pat.AddColorStop (0, color1);
					gcol.L -= 0.1;
					if (gcol.L < 0) gcol.L = 0;
					pat.AddColorStop (1, gcol);
					cr.Pattern = pat;
					cr.FillPreserve ();
				}
			}
			
			bool res = base.OnExposeEvent (evnt);
			
			Gdk.GC borderColor = Style.DarkGC (Gtk.StateType.Normal);
			
			rect = Allocation;
			for (int n=0; n<topMargin; n++)
				GdkWindow.DrawLine (borderColor, rect.X, rect.Y + n, rect.Right - 1, rect.Y + n);
			
			for (int n=0; n<bottomMargin; n++)
				GdkWindow.DrawLine (borderColor, rect.X, rect.Bottom - n - 1, rect.Right - 1, rect.Bottom - n - 1);
			
			for (int n=0; n<leftMargin; n++)
				GdkWindow.DrawLine (borderColor, rect.X + n, rect.Y, rect.X + n, rect.Bottom - 1);
			
			for (int n=0; n<rightMargin; n++)
				GdkWindow.DrawLine (borderColor, rect.Right - n - 1, rect.Y, rect.Right - n - 1, rect.Bottom - 1);
			
			return res;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:46,代码来源:DockItemContainer.cs

示例11: OnExposeEvent

		protected override bool OnExposeEvent (Gdk.EventExpose evnt)
		{
			Gdk.Rectangle rect = Allocation;
			
			if (GradientBackround) {
				HslColor gcol = Style.Background (Gtk.StateType.Normal);
				
				using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
					cr.NewPath ();
					cr.MoveTo (rect.X, rect.Y);
					cr.RelLineTo (rect.Width, 0);
					cr.RelLineTo (0, rect.Height);
					cr.RelLineTo (-rect.Width, 0);
					cr.RelLineTo (0, -rect.Height);
					cr.ClosePath ();
					Cairo.Gradient pat = new Cairo.LinearGradient (rect.X, rect.Y, rect.X, rect.Bottom);
					Cairo.Color color1 = gcol;
					pat.AddColorStop (0, color1);
					gcol.L -= 0.1;
					if (gcol.L < 0) gcol.L = 0;
					pat.AddColorStop (1, gcol);
					cr.Pattern = pat;
					cr.FillPreserve ();
				}
			}
			
			bool res = base.OnExposeEvent (evnt);
			
			//for some reason we seem to need to paint a sightly bigger box to align with the header
			//even though the allocation appears to be the same
			rect.Width += 1;
			rect.Height += 1;
			
			using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
				cr.Color = (HslColor) Style.Dark (Gtk.StateType.Normal);
				
				double y = rect.Y + topMargin / 2d;
				cr.LineWidth = topMargin;
				cr.Line (rect.X, y, rect.Right, y);
				cr.Stroke ();
				
				y = rect.Bottom - bottomMargin / 2d;
				cr.LineWidth = bottomMargin;
				cr.Line (rect.X, y, rect.Right, y);
				cr.Stroke ();
				
				double x = rect.X + leftMargin / 2d;
				cr.LineWidth = leftMargin;
				cr.Line (x, rect.Y, x, rect.Bottom);
				cr.Stroke ();
				
				x = rect.Right - rightMargin / 2d;
				cr.LineWidth = rightMargin;
				cr.Line (x, rect.Y, x, rect.Bottom);
				cr.Stroke ();
			}
			
			return res;
		}
开发者ID:JoeRobich,项目名称:monodevelop,代码行数:59,代码来源:DockItemContainer.cs

示例12: OnExposeEvent

			protected override bool OnExposeEvent (EventExpose evnt)
			{
				bool hideButton = widget.OriginalEditor.Document.ReadOnly || !widget.DiffEditor.Document.ReadOnly;
				using (Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window)) {
					int delta = widget.OriginalEditor.Allocation.Y - Allocation.Y;
					if (widget.Diff != null) {
						foreach (Diff.Hunk hunk in widget.Diff) {
							if (!hunk.Same) {
								int y1 = delta + widget.DiffEditor.LineToVisualY (hunk.Right.Start) - (int)widget.OriginalEditor.VAdjustment.Value;
								int y2 = delta + widget.DiffEditor.LineToVisualY (hunk.Right.Start + hunk.Right.Count) - (int)widget.OriginalEditor.VAdjustment.Value;
								if (y1 == y2)
									y2 = y1 + 1;
								
								int z1 = delta + widget.OriginalEditor.LineToVisualY (hunk.Left.Start) - (int)widget.DiffEditor.VAdjustment.Value;
								int z2 = delta + widget.OriginalEditor.LineToVisualY (hunk.Left.Start + hunk.Left.Count) - (int)widget.DiffEditor.VAdjustment.Value;
								
								if (z1 == z2)
									z2 = z1 + 1;
								cr.MoveTo (Allocation.Width, y1);
								
								cr.CurveTo (Allocation.Width / 2, y1,
									Allocation.Width / 2,  z1,
									0, z1);
								
								cr.LineTo (0, z2);
								cr.CurveTo (Allocation.Width / 2, z2, 
									Allocation.Width / 2, y2,
									Allocation.Width, y2);
								cr.ClosePath ();
								cr.Color = GetColor (hunk, fillAlpha);
								cr.Fill ();
								
								cr.Color = GetColor (hunk, lineAlpha);
								cr.MoveTo (Allocation.Width, y1);
								cr.CurveTo (Allocation.Width / 2, y1,
									Allocation.Width / 2,  z1,
									0, z1);
								cr.Stroke ();
								
								cr.MoveTo (0, z2);
								cr.CurveTo (Allocation.Width / 2, z2, 
									Allocation.Width / 2, y2,
									Allocation.Width, y2);
								cr.Stroke ();
								
								if (!hideButton) {
									bool isButtonSelected = selectedHunk != null && hunk.Left.Start == selectedHunk.Left.Start && hunk.Right.Start == selectedHunk.Right.Start;
									
									cr.Save ();
									int x, y, r;
									GetButtonPosition (hunk, z1, z2, y1, y2, out x, out y, out r);
									
									FoldingScreenbackgroundRenderer.DrawRoundRectangle (cr, true, true, x, y, r / 2, r, r);
									cr.Color = new Cairo.Color (1, 0, 0);
									cr.Fill ();
									FoldingScreenbackgroundRenderer.DrawRoundRectangle (cr, true, true, x + 1, y + 1, (r - 2) / 2, r - 2, r - 2);
	
									var shadowGradient = new Cairo.LinearGradient (x, y, x + r, y + r);
									if (isButtonSelected) {
										shadowGradient.AddColorStop (0, new Cairo.Color (1, 1, 1, 0));
										shadowGradient.AddColorStop (1, new Cairo.Color (1, 1, 1, 0.8));
									} else {
										shadowGradient.AddColorStop (0, new Cairo.Color (1, 1, 1, 0.8));
										shadowGradient.AddColorStop (1, new Cairo.Color (1, 1, 1, 0));
									}
									cr.Source = shadowGradient;
									cr.Fill ();
									
									cr.LineWidth = 2;
									cr.LineCap = Cairo.LineCap.Round;
									cr.Color = isButtonSelected ? new Cairo.Color (0.9, 0.9, 0.9) : new Cairo.Color (1, 1, 1);
									
									int a = 4;
									cr.MoveTo (x + a, y + a);
									cr.LineTo (x + r - a, y + r - a);
									cr.MoveTo (x + r - a, y + a);
									cr.LineTo (x + a, y + r - a);
									cr.Stroke ();
									cr.Restore ();
								}
							}
						}
					}
				}
				var result = base.OnExposeEvent (evnt);
				
				Gdk.GC gc = Style.DarkGC (State);
				evnt.Window.DrawLine (gc, Allocation.X, Allocation.Top, Allocation.X, Allocation.Bottom);
				evnt.Window.DrawLine (gc, Allocation.Right, Allocation.Top, Allocation.Right, Allocation.Bottom);
				
				evnt.Window.DrawLine (gc, Allocation.Left, Allocation.Y, Allocation.Right, Allocation.Y);
				evnt.Window.DrawLine (gc, Allocation.Left, Allocation.Bottom, Allocation.Right, Allocation.Bottom);
				
				return result;
			}
开发者ID:acken,项目名称:monodevelop,代码行数:95,代码来源:ComparisonWidget.cs

示例13: DrawAfterEol

		public override void DrawAfterEol (MonoTextEditor textEditor, Cairo.Context g, EndOfLineMetrics metrics)
		{
			if (!IsVisible)
				return;
			EnsureLayoutCreated (editor);
			int errorCounterWidth = 0, eh = 0;
			if (errorCountLayout != null) {
				errorCountLayout.GetPixelSize (out errorCounterWidth, out eh);
				errorCounterWidth = Math.Max (15, Math.Max (errorCounterWidth + 3, (int)(editor.LineHeight * 3 / 4)));
			}

			var sx = metrics.TextRenderEndPosition;
			var width = LayoutWidth + errorCounterWidth + editor.LineHeight;
			var drawLayout = layouts[0].Layout;
			var y = metrics.LineYRenderStartPosition;
			bool customLayout = true; //sx + width > editor.Allocation.Width;
			bool hideText = false;
			bubbleIsReduced = customLayout;
			var showErrorCount = errorCounterWidth > 0 && errorCountLayout != null;
			double roundingRadius = editor.LineHeight / 2 - 1;

			if (customLayout) {
				width = editor.Allocation.Width - sx;
				string text = layouts[0].Layout.Text;
				drawLayout = new Pango.Layout (editor.PangoContext);
				drawLayout.FontDescription = cache.fontDescription;
				var paintWidth = (width - errorCounterWidth - editor.LineHeight + 4);
				var minWidth = Math.Max (25, errorCounterWidth) * editor.Options.Zoom;
				if (paintWidth < minWidth) {
					hideText = true;
					showErrorCount = false;
//					drawLayout.SetMarkup ("<span weight='heavy'>···</span>");
					width = minWidth;
					//roundingRadius = 10 * editor.Options.Zoom;
					sx = Math.Min (sx, editor.Allocation.Width - width);
				} else {
					drawLayout.Ellipsize = Pango.EllipsizeMode.End;
					drawLayout.Width = (int)(paintWidth * Pango.Scale.PangoScale);
					drawLayout.SetText (text);
					int w2, h2;
					drawLayout.GetPixelSize (out w2, out h2);
					width = w2 + errorCounterWidth + editor.LineHeight - 2;
				}
			}

			bubbleDrawX = sx - editor.TextViewMargin.XOffset;
			bubbleDrawY = y + 2;
			bubbleWidth = width;
			var bubbleHeight = editor.LineHeight;

			g.RoundedRectangle (sx, y, width, bubbleHeight, roundingRadius);
			g.SetSourceColor (TagColor.Color);
			g.Fill ();

			// Draw error count icon
			if (showErrorCount) {
				var errorCounterHeight = bubbleHeight - 2;
				var errorCounterX = sx + width - errorCounterWidth - 1;
				var errorCounterY = Math.Round (y + (bubbleHeight - errorCounterHeight) / 2);

				g.RoundedRectangle (
					errorCounterX, 
					errorCounterY, 
					errorCounterWidth, 
					errorCounterHeight, 
					editor.LineHeight / 2 - 2
				);

				using (var lg = new Cairo.LinearGradient (errorCounterX, errorCounterY, errorCounterX, errorCounterY + errorCounterHeight)) {
					lg.AddColorStop (0, CounterColor.Color);
					lg.AddColorStop (1, CounterColor.Color.AddLight (-0.1));
					g.SetSource (lg);
					g.Fill ();
				}

				g.Save ();

				int ew;
				errorCountLayout.GetPixelSize (out ew, out eh);

				var tx = Math.Round (errorCounterX + (2 + errorCounterWidth - ew) / 2);
				var ty = Math.Round (errorCounterY + (-1 + errorCounterHeight - eh) / 2);

				g.Translate (tx, ty);
				g.SetSourceColor (CounterColor.SecondColor);
				g.ShowLayout (errorCountLayout);
				g.Restore ();
			}

			if (hideText) {
				// Draw dots
				double radius = 2 * editor.Options.Zoom;
				double spacing = 1 * editor.Options.Zoom;

				sx += 1 * editor.Options.Zoom + Math.Ceiling((bubbleWidth - 3 * (radius * 2) - 2 * spacing) / 2);

				for (int i = 0; i < 3; i++) {
					g.Arc (sx, y + bubbleHeight / 2, radius, 0, Math.PI * 2);
					g.SetSourceColor (TagColor.SecondColor);
					g.Fill ();
//.........这里部分代码省略.........
开发者ID:ArsenShnurkov,项目名称:monodevelop,代码行数:101,代码来源:MessageBubbleTextMarker.cs

示例14: OnExposeEvent

			protected override bool OnExposeEvent (Gdk.EventExpose evnt)
			{
				using (var ctx = Gdk.CairoHelper.Create (GdkWindow)) {
					ctx.Rectangle (0, 0, Allocation.Width, Allocation.Height);
					using (Cairo.LinearGradient g = new Cairo.LinearGradient (0, 0, 0, Allocation.Height)) {
						g.AddColorStop (0, Styles.BreadcrumbBackgroundColor);
						g.AddColorStop (1, Styles.BreadcrumbGradientEndColor);
						ctx.SetSource (g);
						ctx.Fill ();
					}

					ctx.MoveTo (0.5, Allocation.Height - 0.5);
					ctx.RelLineTo (Allocation.Width, 0);
					ctx.SetSourceColor (Styles.BreadcrumbBottomBorderColor);
					ctx.LineWidth = 1;
					ctx.Stroke ();
				}
				return base.OnExposeEvent (evnt);
			}
开发者ID:msiyer,项目名称:Pinta,代码行数:19,代码来源:DocumentToolbar.cs

示例15: DrawBackground


//.........这里部分代码省略.........
				}
				g.Color = TagColor.Color;
				g.Fill ();
				
// draw light bottom line
				g.MoveTo (new Cairo.PointD (right, y2Bottom));
				g.LineTo (new Cairo.PointD (x2 + 0.5, y2Bottom));
				g.Stroke ();
				
// stroke left line
				if (fitsInSameLine) {
					g.MoveTo (new Cairo.PointD (x2 + 0.5, y2));
					g.LineTo (new Cairo.PointD (x2 - editor.LineHeight / 2 + 0.5, y2 + editor.LineHeight / 2));
					g.LineTo (new Cairo.PointD (x2 + 0.5, y2Bottom));
				} else {
					g.MoveTo (new Cairo.PointD (x2 + 0.5, y2 - 1));
					g.LineTo (new Cairo.PointD (x2 + 0.5, y2Bottom + 1));
				}
				
				g.Color = TagColor.BorderColor;
				g.Stroke ();
				
// stroke top line
				if (fitsInSameLine) {
					g.Color = TagColor.BorderColor;
					g.MoveTo (new Cairo.PointD (right, y2));
					g.LineTo (new Cairo.PointD (x2 + 0.5, y2));
					g.Stroke ();
				}
			}
			
			if (editor.Options.ShowRuler) {
				double divider = Math.Max (editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
				if (divider >= x2) {
					g.MoveTo (new Cairo.PointD (divider + 0.5, y2));
					g.LineTo (new Cairo.PointD (divider + 0.5, y2Bottom));
					g.Color = GetLineColorBorder (highlighted, selected);
					g.Stroke ();
				}
			}

			
			for (int i = 0; i < layouts.Count; i++) {
				if (!IsCurrentErrorTextFitting (layout2) && !CollapseExtendedErrors)
					break;
				
				var layout = layouts [i];
				x2 = right - layout.Width - border - (ShowIconsInBubble ? cache.errorPixbuf.Width : 0);
				if (i == 0) {
					x2 -= errorCounterWidth;
					if (x2 < lineTextPx) {
						//			if (CollapseExtendedErrors) {
						x2 = lineTextPx;
						//			}
					}
				}
//				x2 = System.Math.Max (x2, fitsInSameLine ? editor.TextViewMargin.XOffset + editor.LineHeight / 2 : editor.TextViewMargin.XOffset);
				
				if (i > 0) {
					editor.TextViewMargin.DrawRectangleWithRuler (g, x, new Cairo.Rectangle (x, y, right, editor.LineHeight), isEolSelected ? editor.ColorStyle.SelectedText.Background : editor.ColorStyle.PlainText.Background, true);
					g.MoveTo (new Cairo.PointD (x2 + 0.5, y));
					g.LineTo (new Cairo.PointD (x2 + 0.5, y + editor.LineHeight));
					g.LineTo (new Cairo.PointD (right, y + editor.LineHeight));
					g.LineTo (new Cairo.PointD (right, y));
					g.ClosePath ();
					
					if (CollapseExtendedErrors) {
						using (var pat = new Cairo.LinearGradient (x2, y, x2, y + editor.LineHeight)) {
							pat.AddColorStop (0, GetLineColorTop (highlighted, selected));
							pat.AddColorStop (1, GetLineColorBottom (highlighted, selected));
							g.Pattern = pat;
						}
					} else {
						g.Color = GetLineColorTop (highlighted, selected);
					}
					g.Fill ();
					if (editor.Options.ShowRuler) {
						double divider = Math.Max (editor.TextViewMargin.XOffset, x + editor.TextViewMargin.RulerX);
						if (divider >= x2) {
							g.MoveTo (new Cairo.PointD (divider + 0.5, y));
							g.LineTo (new Cairo.PointD (divider + 0.5, y + editor.LineHeight));
							g.Color = TagColor.BorderColor;
							g.Stroke ();
						}
					}
				}
				g.Color = TextColor.Color;
				g.Save ();
				g.Translate (x2 + (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) + border, y + (editor.LineHeight - layout.Height) / 2 + layout.Height % 2);
				g.ShowLayout (layout.Layout);
				g.Restore ();
				y += editor.LineHeight;
				if (!UseVirtualLines)
					break;
			}

			DrawErrorMarkers (editor, g, layout2, startXPos, startYPos);

			return true;
		}
开发者ID:harishamdani,项目名称:monodevelop,代码行数:101,代码来源:MessageBubbleTextMarker.cs


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