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


C# Gdk.Rectangle.Inflate方法代码示例

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


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

示例1: RenderButton

		void RenderButton (Cairo.Context context, Gdk.Point corner, double opacity, bool hovered)
		{
			Gdk.Rectangle region = new Gdk.Rectangle (corner.X,
			                                          corner.Y,
			                                          ButtonSize.Width, ButtonSize.Height);



			context.RoundedRectangle (region.X + 0.5, region.Y + 0.5, region.Width - 1, region.Height - 1, 3);
			using (var lg = new LinearGradient (0, region.Top, 0, region.Bottom)) {
				if (hovered) {
					lg.AddColorStop (0, new Cairo.Color (.15, .76, .09, opacity));
					lg.AddColorStop (1, new Cairo.Color (.41, .91, .46, opacity));
				} else {
					lg.AddColorStop (0, new Cairo.Color (.41, .91, .46, opacity));
					lg.AddColorStop (1, new Cairo.Color (.15, .76, .09, opacity));
				}

				context.SetSource (lg);
				context.FillPreserve ();
			}

			context.SetSourceRGBA (.29, .79, .28, opacity);
			context.LineWidth = 1;
			context.Stroke ();

			region.Inflate (-1, -1);
			context.RoundedRectangle (region.X + 0.5, region.Y + 0.5, region.Width - 1, region.Height - 1, 2);

			using (var lg = new LinearGradient (0, region.Top, 0, region.Bottom)) {
				lg.AddColorStop (0, new Cairo.Color (1, 1, 1, .74 * opacity));
				lg.AddColorStop (0.1, new Cairo.Color (1, 1, 1, 0));
				lg.AddColorStop (0.9, new Cairo.Color (0, 0, 0, 0));
				lg.AddColorStop (1, new Cairo.Color (0, 0, 0, .34 * opacity));

				context.SetSource (lg);
				context.Stroke ();
			}

			using (var layout = ButtonLayout (PangoContext)) {
				int w, h;
				layout.GetPixelSize (out w, out h);

				RenderShadowedText (context, new Gdk.Point (corner.X + ButtonSize.Width / 2 - w / 2, corner.Y + ButtonSize.Height / 2 - h / 2 - 1), opacity, layout);
			}
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:46,代码来源:WelcomePageFirstRun.cs

示例2: GetRectangleFromPoints

        protected Gdk.Rectangle GetRectangleFromPoints(Gdk.Point a, Gdk.Point b)
        {
            int x = Math.Min (a.X, b.X);
            int y = Math.Min (a.Y, b.Y);
            int w = Math.Max (a.X, b.X);
            int h = Math.Max (a.Y, b.Y);

            var rect = new Gdk.Rectangle (x, y, w, h);
            rect.Inflate (BrushWidth, BrushWidth);
            return rect;
        }
开发者ID:RudoCris,项目名称:Pinta,代码行数:11,代码来源:BaseBrushTool.cs


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