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


C# Color.ToCairo方法代码示例

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


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

示例1: Create

		public object Create (Color startColor, Color endColor, PointF startPoint, PointF endPoint)
		{
			var gradient = new EtoGradient (startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
			gradient.Extend = Cairo.Extend.Pad;
			gradient.AddColorStop (0, startColor.ToCairo ());
			gradient.AddColorStop (1, endColor.ToCairo ());
			return gradient;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:8,代码来源:LinearGradientBrushHandler.cs

示例2: Create

		public object Create (Color startColor, Color endColor, PointF startPoint, PointF endPoint)
		{
			var gradient = new EtoGradient (startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
			cairo_pattern_set_extend (gradient.Pointer, Cairo.Extend.Repeat);
			// not in windows?? gradient.Extend = Cairo.Extend.Repeat;
			gradient.AddColorStop (0, startColor.ToCairo ());
			gradient.AddColorStop (1, endColor.ToCairo ());
			return gradient;
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:9,代码来源:LinearGradientBrushHandler.cs

示例3: Create

		public object Create(Color startColor, Color endColor, PointF center, PointF gradientOrigin, SizeF radius)
		{
			var gradient = new EtoGradient(gradientOrigin, center, radius);
			gradient.Radius = radius;
			gradient.Extend = Cairo.Extend.Pad;
			gradient.AddColorStop(0, startColor.ToCairo());
			gradient.AddColorStop(1, endColor.ToCairo());
			return gradient;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:9,代码来源:RadialGradientBrushHandler.cs

示例4: Create

		public object Create (Color color)
		{
			return color.ToCairo ();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:4,代码来源:SolidBrushHandler.cs

示例5: SetColor

		public void SetColor (SolidBrush widget, Color color)
		{
			widget.ControlObject = color.ToCairo ();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:4,代码来源:SolidBrushHandler.cs

示例6: Create

		public object Create (Color color, float thickness)
		{
			return new PenObject {
				Color = color.ToCairo (),
				Thickness = thickness,
				MiterLimit = 10f,
				LineCap = PenLineCap.Square.ToCairo ()
			};
		}
开发者ID:mhusen,项目名称:Eto,代码行数:9,代码来源:PenHandler.cs

示例7: SetColor

		public void SetColor (Pen widget, Color color)
		{
			((PenObject)widget.ControlObject).Color = color.ToCairo ();
		}
开发者ID:mhusen,项目名称:Eto,代码行数:4,代码来源:PenHandler.cs

示例8: GenerateGradient

		/// <summary>
		/// Creates a gradient for the given position, size, and anchor location.
		/// </summary>
		protected Cairo.LinearGradient GenerateGradient(Coord point, Coord size, AnchorLocation location, 
		                                                Color startColor, Color stopColor)
		{
			Cairo.LinearGradient grad = null;
			var x = point.X;
			var y = point.Y;
			var r = (size.X + size.Y) / 2.0;
			switch (location)
			{
			case AnchorLocation.E:
				grad = new Cairo.LinearGradient(x + size.X, y, x, y);
				break;
			case AnchorLocation.NE:
				grad = new Cairo.LinearGradient(x + r, y, x, y + r);
				break;
			case AnchorLocation.N:
				grad = new Cairo.LinearGradient(x, y, x, y + size.Y);
				break;
			case AnchorLocation.NW:
				grad = new Cairo.LinearGradient(x, y, x + r, y + r);
				break;
			case AnchorLocation.W:
				grad = new Cairo.LinearGradient(x, y, x + size.X, y);
				break;
			case AnchorLocation.SW:
				grad = new Cairo.LinearGradient(x, y + r, x + r, y);
				break;
			case AnchorLocation.S:
				grad = new Cairo.LinearGradient(x, y + size.Y, x, y);
				break;
			case AnchorLocation.SE:
				grad = new Cairo.LinearGradient(x + r, y + r, x, y);
				break;
			}
			
			// assign the colors
			if (startColor == null)
				startColor = defaultBackgroundColor;
			grad.AddColorStop(0, startColor.ToCairo());
			if (stopColor == null)
				stopColor = defaultBackgroundColor;
			grad.AddColorStop(1, stopColor.ToCairo());
			
			return grad;
		}
开发者ID:erisonliang,项目名称:monoworks,代码行数:48,代码来源:BasicDecorator.cs


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