本文整理汇总了C#中Cairo.ArcNegative方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.ArcNegative方法的具体用法?C# Cairo.ArcNegative怎么用?C# Cairo.ArcNegative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.ArcNegative方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: draw
static void draw (Cairo.Context gr, int width, int height)
{
double xc = 0.5;
double yc = 0.5;
double radius = 0.4;
double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */
double angle2 = 180.0 * (M_PI/180.0); /* in radians */
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.ArcNegative (xc, yc, radius, angle1, angle2);
gr.Stroke ();
/* draw helping lines */
gr.Color = new Color(1, 0.2, 0.2, 0.6);
gr.Arc (xc, yc, 0.05, 0, 2*M_PI);
gr.Fill ();
gr.LineWidth = 0.03;
gr.Arc (xc, yc, radius, angle1, angle1);
gr.LineTo (new PointD(xc, yc));
gr.Arc (xc, yc, radius, angle2, angle2);
gr.LineTo (new PointD(xc, yc));
gr.Stroke ();
}
示例2: DrawOutline
/// <summary>
/// Draws the outline of the button to the given context.
/// </summary>
/// <remarks>This can be used by decorators to avoid doing the geometry themselves.</remarks>
public void DrawOutline(Cairo.Context cr)
{
// can't do anything if we're not inside a ring bar
if (!(ParentControl is RingBar))
return;
var ringBar = ParentControl as RingBar;
var outerRadius = ringBar.OuterRadius;
var startAngle = CenterAngle.Negate() - ringBar.DiffAngle / 2;
var stopAngle = startAngle + ringBar.DiffAngle;
var inner = new Coord(ringBar.InnerRadius, 0).Rotate(startAngle);
var outer = new Coord(ringBar.OuterRadius-2, 0).Rotate(startAngle);
cr.MoveTo(outerRadius + inner.X, outerRadius + inner.Y);
cr.LineTo(outerRadius + outer.X, outerRadius + outer.Y);
cr.Arc(outerRadius, outerRadius, outerRadius-2, startAngle.Radians, stopAngle.Radians);
var rotatedInner = inner.Rotate(ringBar.DiffAngle);
cr.LineTo(outerRadius + rotatedInner.X, outerRadius + rotatedInner.Y);
cr.ArcNegative(outerRadius, outerRadius, ringBar.InnerRadius, stopAngle.Radians, startAngle.Radians);
}