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


C# Cairo.SetSourceRGBA方法代码示例

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


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

示例1: Draw

		public override void Draw (Mono.TextEditor.MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics, int startOffset, int endOffset)
		{
			this.editor = editor;
			var line = editor.GetLine (loc.Line);
			if (line == null)
				return;
			var x = editor.ColumnToX (line, loc.Column) - editor.HAdjustment.Value + editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition;

			cr.Rectangle (Math.Floor (x) + 0.5, Math.Floor (metrics.LineYRenderStartPosition) + 0.5 + (line == editor.GetLineByOffset (startOffset) ? editor.LineHeight - tagMarkerHeight - 1 : 0), tagMarkerWidth * cr.LineWidth, tagMarkerHeight * cr.LineWidth);

			if (HslColor.Brightness (editor.ColorStyle.PlainText.Background) < 0.5) {
				cr.SetSourceRGBA (0.8, 0.8, 1, 0.9);
			} else {
				cr.SetSourceRGBA (0.2, 0.2, 1, 0.9);
			}
			cr.Stroke ();
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:17,代码来源:SmartTagMarker.cs

示例2: DrawPixbuf

 public static void DrawPixbuf(Cairo.Context cr, Pixbuf pixbuf)
 {
     cr.SetSourceRGBA(0.0, 0.0, 0.0, 1.0);
     cr.Operator = Cairo.Operator.DestIn;
     Gdk.CairoHelper.SetSourcePixbuf (cr, pixbuf, 0, 0);
     cr.Paint ();
     cr.Operator = Cairo.Operator.Over;
     cr.Paint ();
 }
开发者ID:niwakazoider,项目名称:unicast,代码行数:9,代码来源:WindowController.cs

示例3: OnDrawn

 protected override bool OnDrawn(Cairo.Context cr)
 {
     cr.Save ();
     Gdk.RGBA color = Hyena.Gui.GtkUtilities.ColorBlend (
         StyleContext.GetBackgroundColor (StateFlags.Normal),
         StyleContext.GetColor (StateFlags.Normal));
     cr.SetSourceRGBA (color.Red, color.Green, color.Blue, color.Alpha);
     DrawCairo (cr);
     cr.Restore ();
     return false;
 }
开发者ID:knocte,项目名称:banshee,代码行数:11,代码来源:LinearProgress.cs

示例4: paintSquare

 protected void paintSquare(Cairo.Context context, int x, int y, bool fill)
 {
     context.Save ();
     context.SetSourceRGB (0, 0, 1);
     context.Translate (x, y);
     context.Rectangle (new Cairo.Rectangle (0, 0, fieldSize, fieldSize));
     context.SetSourceRGBA (0, 0, 0, fill ? 0.5 : 0.3);
     context.FillPreserve ();
     context.NewPath ();
     context.Restore ();
 }
开发者ID:Teyras,项目名称:Bounce,代码行数:11,代码来源:BoardRenderer.cs

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

示例6: DrawIconMarginBackground

		void DrawIconMarginBackground (TextEditor ed, Cairo.Context cr, MarginDrawMetrics metrics)
		{
			cr.Rectangle (metrics.X, metrics.Y, metrics.Width, metrics.Height);
			cr.SetSourceColor (IconMarginColor.Color);
			cr.Fill ();
			cr.MoveTo (metrics.Right - 0.5, metrics.Y);
			cr.LineTo (metrics.Right - 0.5, metrics.Bottom);
			cr.SetSourceColor (IconMarginColor.BorderColor);
			cr.Stroke ();
			if (cache.CurrentSelectedTextMarker != null && cache.CurrentSelectedTextMarker != this) {
				cr.Rectangle (metrics.X, metrics.Y, metrics.Width, metrics.Height);
				cr.SetSourceRGBA (ed.ColorStyle.IndicatorMargin.Color.R, ed.ColorStyle.IndicatorMargin.Color.G, ed.ColorStyle.IndicatorMargin.Color.B, 0.5);
				cr.Fill ();
			}
		}
开发者ID:llucenic,项目名称:monodevelop,代码行数:15,代码来源:MessageBubbleTextMarker.cs

示例7: DrawEolMarker

		void DrawEolMarker (Cairo.Context cr, DocumentLine line, bool selected, double x, double y)
		{
			if (!textEditor.Options.IncludeWhitespaces.HasFlag (IncludeWhitespaces.LineEndings))
				return;

			Pango.Layout layout;
			Pango.Rectangle rect;

			var index = GetEolMarkerIndex (line.UnicodeNewline);
			layout = eolMarkerLayout [index];
			rect = eolMarkerLayoutRect [index];
			cr.Save ();
			cr.Translate (x, y + System.Math.Max (0, LineHeight - rect.Height - 1));
			var col = ColorStyle.PlainText.Foreground;

			if (selected && !SelectionColor.TransparentForeground) {
				col = SelectionColor.Foreground;
			} else {
				if (line != null && line.NextLine != null && line.NextLine.StartSpan != null && line.NextLine.StartSpan.Count > 0) {
					var span = line.NextLine.StartSpan.Peek ();
					var chunkStyle = ColorStyle.GetChunkStyle (span.Color);
					if (chunkStyle != null)
						col = ColorStyle.GetForeground (chunkStyle);
				}
			}

			cr.SetSourceRGBA (col.R, col.G, col.B, whitespaceMarkerAlpha * 1.4); // needs to more opaque due to font rendering
			cr.ShowLayout (layout);
			cr.Restore ();
		}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:30,代码来源:TextViewMargin.cs

示例8: Draw

			public override void Draw (TextEditor editor, Cairo.Context cr, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos)
			{
				var line = editor.GetLine (loc.Line);
				var x = editor.ColumnToX (line, loc.Column) - editor.HAdjustment.Value + editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition;

				cr.Rectangle (Math.Floor (x) + 0.5, Math.Floor (y) + 0.5 + (line == editor.GetLineByOffset (startOffset) ? editor.LineHeight - tagMarkerHeight - 1 : 0), tagMarkerWidth * cr.LineWidth, tagMarkerHeight * cr.LineWidth);

				if (HslColor.Brightness (editor.ColorStyle.PlainText.Background) < 0.5) {
					cr.SetSourceRGBA (0.8, 0.8, 1, 0.9);
				} else {
					cr.SetSourceRGBA (0.2, 0.2, 1, 0.9);
				}
				cr.Stroke ();
			}
开发者ID:vitorelli,项目名称:monodevelop,代码行数:14,代码来源:CodeActionEditorExtension.cs

示例9: RenderLineNumberIcon

		void RenderLineNumberIcon (Widget widget, Cairo.Context cr, Gdk.Rectangle cell_area, int markupHeight, int yOffset)
		{
			if (Frame == null)
				return;

			cr.Save ();

			#if CENTER_ROUNDED_RECTANGLE
			cr.Translate (cell_area.X + Padding, (cell_area.Y + (cell_area.Height - RoundedRectangleHeight) / 2.0));
			#else
			cr.Translate (cell_area.X + Padding, cell_area.Y + Padding + yOffset);
			#endif

			cr.Antialias = Cairo.Antialias.Subpixel;

			cr.RoundedRectangle (0.0, 0.0, RoundedRectangleWidth, RoundedRectangleHeight, RoundedRectangleRadius);
			cr.Clip ();

			if (IsUserCode)
				cr.SetSourceRGBA (0.90, 0.60, 0.87, 1.0); // 230, 152, 223
			else
				cr.SetSourceRGBA (0.77, 0.77, 0.77, 1.0); // 197, 197, 197

			cr.RoundedRectangle (0.0, 0.0, RoundedRectangleWidth, RoundedRectangleHeight, RoundedRectangleRadius);
			cr.Fill ();

			cr.SetSourceRGBA (0.0, 0.0, 0.0, 0.11);
			cr.RoundedRectangle (0.0, 0.0, RoundedRectangleWidth, RoundedRectangleHeight, RoundedRectangleRadius);
			cr.LineWidth = 2;
			cr.Stroke ();

			var lineNumber = !string.IsNullOrEmpty (Frame.File) ? Frame.Line : -1;

			using (var layout = PangoUtil.CreateLayout (widget, lineNumber != -1 ? lineNumber.ToString () : "???")) {
				layout.Alignment = Pango.Alignment.Left;
				layout.FontDescription = LineNumberFont;

				int width, height;
				layout.GetPixelSize (out width, out height);

				double y_offset = (RoundedRectangleHeight - height) / 2.0;
				double x_offset = (RoundedRectangleWidth - width) / 2.0;

				// render the text shadow
				cr.Save ();
				cr.SetSourceRGBA (0.0, 0.0, 0.0, 0.34);
				cr.Translate (x_offset, y_offset + 1);
				cr.ShowLayout (layout);
				cr.Restore ();

				cr.SetSourceRGBA (1.0, 1.0, 1.0, 1.0);
				cr.Translate (x_offset, y_offset);
				cr.ShowLayout (layout);
			}

			cr.Restore ();
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:57,代码来源:ExceptionCaughtDialog.cs

示例10: DrawForeground

			public override void DrawForeground (TextEditor editor, Cairo.Context cr, MarginDrawMetrics metrics)
			{
				cr.Arc (metrics.X + metrics.Width / 2 + 2, metrics.Y + metrics.Height / 2, 7 * editor.Options.Zoom, 0, Math.PI * 2);
				isFailed = false;
				var test = NUnitService.Instance.SearchTestById (unitTest.UnitTestIdentifier);
				bool searchCases = false;

				if (unitTest.IsIgnored) {
					cr.SetSourceRGB (0.9, 0.9, 0);
				} else {

					if (test != null) {
						var result = test.GetLastResult ();
						if (result == null) {
							cr.SetSourceRGB (0.5, 0.5, 0.5);
							searchCases = true;

						} else if (result.IsNotRun) {
							cr.SetSourceRGBA (0.9, 0.9, 0, test.IsHistoricResult ? 0.5 : 1.0);
						} else if (result.IsSuccess) {
							cr.SetSourceRGBA (0, 1, 0, test.IsHistoricResult ? 0.2 : 1.0);
						} else if (result.IsFailure) {
							cr.SetSourceRGBA (1, 0, 0, test.IsHistoricResult ? 0.2 : 1.0);
							failMessage = result.Message;
							isFailed = true;
						} else if (result.IsInconclusive) {
							cr.SetSourceRGBA (0, 1, 1, test.IsHistoricResult ? 0.2 : 1.0);
						} else {
							cr.SetSourceRGB (0.5, 0.5, 0.5);
						}
					} else {
						cr.SetSourceRGB (0.5, 0.5, 0.5);
						searchCases = true;
					}
					if (searchCases) {
						foreach (var caseId in unitTest.TestCases) {
							test = NUnitService.Instance.SearchTestById (unitTest.UnitTestIdentifier + caseId);
							if (test != null) {
								var result = test.GetLastResult ();
								if (result == null || result.IsNotRun || test.IsHistoricResult) {
								} else if (result.IsNotRun) {
									cr.SetSourceRGB (0.9, 0.9, 0);
								} else if (result.IsSuccess) {
									cr.SetSourceRGB (0, 1, 0);
								} else if (result.IsFailure) {
									cr.SetSourceRGB (1, 0, 0);
									failMessage = result.Message;
									isFailed = true;
									break;
								} else if (result.IsInconclusive) {
									cr.SetSourceRGB (0, 1, 1);
								} 
							}
						}
					}
				}

				cr.FillPreserve ();
				if (unitTest.IsIgnored) {
					cr.SetSourceRGB (0.4, 0.4, 0);
					cr.Stroke ();

				} else {
					if (test != null) {
						var result = test.GetLastResult ();
						if (result == null) {
							cr.SetSourceRGB (0.2, 0.2, 0.2);
							cr.Stroke ();
						} else if (result.IsNotRun && !test.IsHistoricResult) {
							cr.SetSourceRGB (0.4, 0.4, 0);
							cr.Stroke ();
						} else if (result.IsSuccess && !test.IsHistoricResult) {
							cr.SetSourceRGB (0, 0.5, 0);
							cr.Stroke ();
						} else if (result.IsFailure && !test.IsHistoricResult) {
							cr.SetSourceRGB (0.5, 0, 0);
							cr.Stroke ();
						} else if (result.IsInconclusive && !test.IsHistoricResult) {
							cr.SetSourceRGB (0, 0.7, 0.7);
							cr.Stroke ();
						} 
					}
				}
				cr.NewPath ();
			}
开发者ID:llucenic,项目名称:monodevelop,代码行数:85,代码来源:UnitTestTextEditorExtension.cs

示例11: DrawRowRule

 public override void DrawRowRule(Cairo.Context cr, int x, int y, int width, int height)
 {
     cr.SetSourceRGBA (rule_color.R, rule_color.G, rule_color.B, Context.FillAlpha);
     cr.Rectangle (x, y, width, height);
     cr.Fill ();
 }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:6,代码来源:GtkTheme.cs

示例12: FillRectangle

        public void FillRectangle(Rectangle rect,Cairo.Context ctx,bool known,bool selected)
        {
            if(known)
                    ctx.SetSourceRGBA (0, 0,0.7, 0.3);
                else
                    ctx.SetSourceRGBA (0.7, 0,0, 1.3);

                ctx.LineWidth = selected ? 8.2 : 0.8 ;
                Rectangle r = ImageCoordsToWindow (rect);
                Log.Debug("Fill Rectangle"+rect.ToString()+ "  >>>  "+r.ToString()  + "  ["+XOffset +","+YOffset+"]" );
                ctx.MoveTo (r.X, r.Y);
                ctx.LineTo (r.X + r.Width, r.Y);
                ctx.LineTo (r.X + r.Width, r.Y + r.Height);
                ctx.LineTo (r.X, r.Y + r.Height);
                ctx.LineTo (r.X, r.Y);
                ctx.Stroke ();
        }
开发者ID:kanitw,项目名称:facespot,代码行数:17,代码来源:FaceOverlay.cs

示例13: DrawIndicator

		void DrawIndicator (Cairo.Context cr, Cairo.Color color, Cairo.Color borderColor)
		{
			const int indicatorPadding = 3;
			const int indicatorDiameter = 8;
			var x1 = Allocation.Width / 2d;
			var y1 = indicatorPadding + indicatorDiameter / 2d;

			cr.Arc (x1, y1 + 1, indicatorDiameter / 2d, 0, 2 * Math.PI);
			cr.SetSourceRGBA (0, 0, 0, 0.2);
			cr.Fill ();

			cr.Arc (x1, y1, indicatorDiameter / 2d, 0, 2 * Math.PI);
			cr.SetSourceColor (color);
			cr.Fill ();

			cr.Arc (x1, y1, indicatorDiameter / 2d - 1, 0, 2 * Math.PI);
			cr.SetSourceRGBA (1, 1, 1, 0.1);
			cr.Stroke ();

			cr.Arc (x1, y1, indicatorDiameter / 2d, 0, 2 * Math.PI);
			cr.SetSourceColor (borderColor);
			cr.Stroke ();
		}
开发者ID:BrainSlugs83,项目名称:monodevelop,代码行数:23,代码来源:QuickTaskOverviewMode.cs

示例14: Draw

        public void Draw(Cairo.Context g, double scale, bool fillSelection)
        {
            g.Save ();
            g.Translate (0.5, 0.5);
            g.Scale (scale, scale);

            g.AppendPath (selection_path);

            if (fillSelection)
            {
                g.SetSourceRGBA(0.7, 0.8, 0.9, 0.2);
                g.FillRule = Cairo.FillRule.EvenOdd;
                g.FillPreserve ();
            }

            g.LineWidth = 1 / scale;

            // Draw a white line first so it shows up on dark backgrounds
            g.SetSourceRGB (1, 1, 1);
            g.StrokePreserve ();

            // Draw a black dashed line over the white line
            g.SetDash (new double[] { 2 / scale, 4 / scale }, 0);
            g.SetSourceRGB (0, 0, 0);

            g.Stroke ();
            g.Restore ();
        }
开发者ID:CiprianKhlud,项目名称:Pinta,代码行数:28,代码来源:DocumentSelection.cs

示例15: paintTrail

 protected void paintTrail(Cairo.Context context, int x, int y)
 {
     context.Save ();
     context.SetSourceRGB (0, 1, 0);
     context.Translate (x, y);
     context.Rectangle (new Cairo.Rectangle (0, 0, fieldSize, fieldSize));
     context.SetSourceRGBA (0, 1, 0, 0.3);
     context.FillPreserve ();
     context.NewPath ();
     context.Restore ();
 }
开发者ID:Teyras,项目名称:Bounce,代码行数:11,代码来源:BoardRenderer.cs


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