本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: Create
public object Create (Color color)
{
return color.ToCairo ();
}
示例5: SetColor
public void SetColor (SolidBrush widget, Color color)
{
widget.ControlObject = color.ToCairo ();
}
示例6: Create
public object Create (Color color, float thickness)
{
return new PenObject {
Color = color.ToCairo (),
Thickness = thickness,
MiterLimit = 10f,
LineCap = PenLineCap.Square.ToCairo ()
};
}
示例7: SetColor
public void SetColor (Pen widget, Color color)
{
((PenObject)widget.ControlObject).Color = color.ToCairo ();
}
示例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;
}