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


C# Context.RoundedRectangle方法代码示例

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


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

示例1: Render

        public override void Render(Node node, Context context)
        {
            ButtonNode button = node as ButtonNode;

            context.RoundedRectangle (0.5, 0.5, button.Width - 1, button.Height - 1, button.Rounding);
            if (button.Relief) {
                using (var lg = new global::Cairo.LinearGradient (0, 0, 0, button.Height)) {
                    CreateGradient (lg, button.State, button.Opacity);
                    context.Pattern = lg;
                    context.FillPreserve ();
                }

                context.LineWidth = 1;
                context.Color = new Color (0.8, 0.8, 0.8, button.Opacity).ToCairo ();
                context.Stroke ();
            }
        }
开发者ID:Clancey,项目名称:Canvas,代码行数:17,代码来源:ButtonNodeRenderer.cs

示例2: DrawBackground

		public override void DrawBackground (Mono.TextEditor.MonoTextEditor editor, Context cr, LineMetrics metrics, int startOffset, int endOffset)
		{
			int markerStart = usage.Offset;
			int markerEnd = usage.EndOffset;

			if (markerEnd < startOffset || markerStart > endOffset) 
				return; 

			double @from;
			double to;
			var startXPos = metrics.TextRenderStartPosition;
			var endXPos = metrics.TextRenderEndPosition;
			var y = metrics.LineYRenderStartPosition;
			if (markerStart < startOffset && endOffset < markerEnd) {
				@from = startXPos;
				to = endXPos;
			} else {
				int start = startOffset < markerStart ? markerStart : startOffset;
				int end = endOffset < markerEnd ? endOffset : markerEnd;

				uint curIndex = 0, byteIndex = 0;
				TextViewMargin.TranslateToUTF8Index (metrics.Layout.LineChars, (uint)(start - startOffset), ref curIndex, ref byteIndex);

				int x_pos = metrics.Layout.Layout.IndexToPos ((int)byteIndex).X;

				@from = startXPos + (int)(x_pos / Pango.Scale.PangoScale);

				TextViewMargin.TranslateToUTF8Index (metrics.Layout.LineChars, (uint)(end - startOffset), ref curIndex, ref byteIndex);
				x_pos = metrics.Layout.Layout.IndexToPos ((int)byteIndex).X;

				to = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
			}

			@from = Math.Max (@from, editor.TextViewMargin.XOffset);
			to = Math.Max (to, editor.TextViewMargin.XOffset);
			if (@from < to) {
				Mono.TextEditor.Highlighting.AmbientColor colorStyle;
				if ((usage.UsageType & ReferenceUsageType.Write) == ReferenceUsageType.Write ||
					(usage.UsageType & ReferenceUsageType.Declariton) == ReferenceUsageType.Declariton) {
					colorStyle = editor.ColorStyle.ChangingUsagesRectangle;
				} else {
					colorStyle = editor.ColorStyle.UsagesRectangle;
				}

				using (var lg = new LinearGradient (@from + 1, y + 1, to , y + editor.LineHeight)) {
					lg.AddColorStop (0, colorStyle.Color);
					lg.AddColorStop (1, colorStyle.SecondColor);
					cr.SetSource (lg);
					cr.RoundedRectangle (@from + 0.5, y + 1.5, to - @from - 1, editor.LineHeight - 2, editor.LineHeight / 4);
					cr.FillPreserve ();
				}

				cr.SetSourceColor (colorStyle.BorderColor);
				cr.Stroke ();
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:56,代码来源:UsageSegmentMarker.cs

示例3: ClipChildren

 public override void ClipChildren(Node node, Context context)
 {
     ButtonNode button = node as ButtonNode;
     context.RoundedRectangle (0.5, 0.5, button.Width - 1, button.Height - 1, button.Rounding);
     context.Clip ();
 }
开发者ID:Clancey,项目名称:Canvas,代码行数:6,代码来源:ButtonNodeRenderer.cs


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