當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。