本文整理汇总了C#中Cairo.ClosePath方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.ClosePath方法的具体用法?C# Cairo.ClosePath怎么用?C# Cairo.ClosePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.ClosePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: draw
static void draw (Cairo.Context gr, int width, int height)
{
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.MoveTo ( new PointD (0.5, 0.1) );
gr.LineTo ( new PointD (0.9, 0.9) );
gr.RelLineTo ( new Distance (-0.4, 0.0) );
gr.CurveTo ( new PointD (0.2, 0.9),
new PointD ( 0.2, 0.5),
new PointD (0.5, 0.5)
);
gr.ClosePath ();
gr.MoveTo ( new PointD (0.25, 0.1) );
gr.RelLineTo ( new Distance (0.2, 0.2) );
gr.RelLineTo ( new Distance ( -0.2, 0.2) );
gr.RelLineTo ( new Distance (-0.2, -0.2) );
gr.ClosePath ();
gr.Color = new Color (0, 0, 1, 1);
gr.FillPreserve ();
gr.Color = new Color ( 0, 0, 0, 1);
gr.Stroke ();
}
示例2: DrawCircle
protected void DrawCircle (Cairo.Context cr, double x, double y, double size)
{
x += 0.5; y += 0.5;
cr.NewPath ();
cr.Arc (x + size/2, y + size / 2, (size-4)/2, 0, 2 * Math.PI);
cr.ClosePath ();
}
示例3: DrawRoundedRectangle
public static void DrawRoundedRectangle(Cairo.Context gr, double x, double y,
double width, double height, double radius,
Cairo.Color color, Cairo.Color borderColor)
{
gr.Save();
if((radius > height / 2) || (radius > width / 2))
radius = Math.Min(height / 2, width / 2);
gr.MoveTo(x, y + radius);
gr.Arc(x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
gr.LineTo(x + width - radius, y);
gr.Arc(x + width - radius, y + radius, radius, -Math.PI / 2, 0);
gr.LineTo(x + width, y + height - radius);
gr.Arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
gr.LineTo(x + radius, y + height);
gr.Arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath();
gr.Restore();
gr.LineJoin = LineJoin.Round;
gr.Color = borderColor;
gr.StrokePreserve();
gr.Color = color;
gr.Fill();
}
示例4: oval_path
static void oval_path (Cairo.Context gr, double xc, double yc, double xr, double yr)
{
gr.Translate (xc, yc);
gr.Scale (1.0, yr / xr);
gr.MoveTo (new PointD (xr, 0.0) );
gr.Arc (0, 0, xr, 0, 2 * M_PI);
gr.ClosePath ();
}
示例5: DrawTriangle
public static void DrawTriangle(Cairo.Context g, double x, double y,
int width, int height, Cairo.Color color)
{
g.Color = color;
g.MoveTo(x, y);
g.LineTo(x + width/2, y-height);
g.LineTo(x - width/2, y-height);
g.ClosePath();
g.Fill();
g.Stroke();
}
示例6: DrawHand
void DrawHand (double fThickness, double length, Cairo.Color color, double radians, Cairo.Context e)
{
e.MoveTo (new Cairo.PointD (center.X - (length / 9 * Math.Sin (radians)), center.Y + (length / 9 * Math.Cos (radians))));
e.LineTo (new Cairo.PointD (center.X + (length * Math.Sin (radians)), center.Y - (length * Math.Cos (radians))));
e.ClosePath ();
e.LineCap = Cairo.LineCap.Round;
e.LineJoin = Cairo.LineJoin.Round;
e.Color = color;
e.LineWidth = fThickness;
e.Stroke ();
}
示例7: RenderCircle
public static void RenderCircle(Cairo.Context g, Cairo.Color c, double r, double x, double y)
{
g.Save();
g.Color = c;
g.MoveTo(x, y);
g.Arc(x, y, r, 0, 6.28);
g.LineWidth = 3;
g.ClosePath();
g.Fill();
g.Restore();
}
示例8: DrawDiamond
protected void DrawDiamond (Cairo.Context cr, double x, double y, double size)
{
x += 0.5; y += 0.5;
size -= 2;
cr.NewPath ();
cr.MoveTo (x + size/2, y);
cr.LineTo (x + size, y + size/2);
cr.LineTo (x + size/2, y + size);
cr.LineTo (x, y + size/2);
cr.LineTo (x + size/2, y);
cr.ClosePath ();
}
示例9: DrawRoundedRectangle
static void DrawRoundedRectangle(Cairo.Context gr, double x, double y, double width, double height, double radius)
{
gr.Save ();
if ((radius > height / 2) || (radius > width / 2))
radius = min (height / 2, width / 2);
gr.Color = new Color (200, 10, 210, 1);
gr.MoveTo (x, y + radius);
gr.Arc (x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
gr.LineTo (x + width - radius, y);
gr.Arc (x + width - radius, y + radius, radius, -Math.PI / 2, 0);
gr.LineTo (x + width, y + height - radius);
gr.Arc (x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
gr.LineTo (x + radius, y + height);
gr.Arc (x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath ();
gr.Restore ();
}
示例10: CurvedRectangle
public static void CurvedRectangle (Cairo.Context c, RectangleD rect, double radius) {
if (rect.Width < (radius * 2.0) ) {
radius = rect.Width/2.0;
}
if (rect.Height < (radius * 2.0) ) {
radius = rect.Height/2.0;
}
c.MoveTo (rect.X, rect.Y+radius);
c.LineTo (rect.X, rect.Y2-radius);
c.CurveTo (rect.X, rect.Y2-radius, rect.X, rect.Y2, rect.X+radius, rect.Y2);
c.LineTo (rect.X2-radius, rect.Y2);
c.CurveTo (rect.X2-radius, rect.Y2, rect.X2, rect.Y2, rect.X2, rect.Y2-radius);
c.LineTo (rect.X2, rect.Y+radius);
c.CurveTo (rect.X2, rect.Y+radius, rect.X2, rect.Y, rect.X2-radius, rect.Y);
c.LineTo (rect.X+radius, rect.Y);
c.CurveTo (rect.X+radius, rect.Y, rect.X, rect.Y, rect.X, rect.Y+radius);
c.ClosePath();
}
示例11: DrawCaret
protected void DrawCaret (Cairo.Context cr)
{
if (TextEditor.ColorStyle == null || caretLine < 0)
return;
double y = GetYPosition (caretLine);
cr.MoveTo (0, y - 4);
cr.LineTo (7, y);
cr.LineTo (0, y + 4);
cr.ClosePath ();
cr.SetSourceColor (TextEditor.ColorStyle.PlainText.Foreground);
cr.Fill ();
}
示例12: DrawArrow
protected void DrawArrow (Cairo.Context cr, double x, double y, double size)
{
y += 2.5;
x += 2.5;
size -= 4;
double awidth = 0.5;
double aheight = 0.4;
double pich = (size - (size * aheight)) / 2;
cr.NewPath ();
cr.MoveTo (x + size * awidth, y);
cr.LineTo (x + size, y + size / 2);
cr.LineTo (x + size * awidth, y + size);
cr.RelLineTo (0, -pich);
cr.RelLineTo (-size * awidth, 0);
cr.RelLineTo (0, -size * aheight);
cr.RelLineTo (size * awidth, 0);
cr.RelLineTo (0, -pich);
cr.ClosePath ();
}
示例13: DrawErrorMarkers
void DrawErrorMarkers (TextEditor editor, Cairo.Context g, LineMetrics metrics, double y)
{
uint curIndex = 0, byteIndex = 0;
var o = metrics.LineSegment.Offset;
foreach (var task in errors.Select (t => t.Task)) {
var column = (uint)(Math.Min (Math.Max (0, task.Column - 1), metrics.Layout.LineChars.Length));
int index = (int)metrics.Layout.TranslateToUTF8Index (column, ref curIndex, ref byteIndex);
var pos = metrics.Layout.Layout.IndexToPos (index);
var co = o + task.Column - 1;
g.SetSourceColor (GetMarkerColor (false, metrics.SelectionStart <= co && co < metrics.SelectionEnd));
g.MoveTo (
metrics.TextRenderStartPosition + editor.TextViewMargin.TextStartPosition + pos.X / Pango.Scale.PangoScale,
y + editor.LineHeight - 3
);
g.RelLineTo (3, 3);
g.RelLineTo (-6, 0);
g.ClosePath ();
g.Fill ();
}
}
示例14: Draw
public void Draw(Gdk.Drawable d, Cairo.Context g, int width, int height, bool screenChanged)
{
if (!_visible)
{
return;
}
if (_w > 0 && _h > 0)
{
Gdk.GC gc = new Gdk.GC(d);
d.DrawPixbuf(gc, _background, 0, 0, _x, _y, _w, _h, Gdk.RgbDither.None, 0, 0);
int x0 = _x, x1 = _x + _w;
int y0 = _y, y1 = _y + _h;
g.MoveTo(x0 + 3, y0);
g.LineTo(x1 - 3, y0);
g.LineTo(x1, y0 + 3);
g.LineTo(x1, y1 - 3);
g.LineTo(x1 - 3, y1);
g.LineTo(x0 + 3, y1);
g.LineTo(x0, y1 - 3);
g.LineTo(x0, y0 + 3);
g.LineTo(x0 + 3, y0);
g.ClosePath();
g.LineWidth = 6;
g.Color = BorderColor;
g.Stroke();
}
g.Save();
DrawContents(d, g, width, height, screenChanged);
g.Restore();
}
示例15: RoundBorder
static void RoundBorder (Cairo.Context ctx, double x, double y, double w, double h)
{
double r = h / 2;
ctx.Arc (x + r, y + r, r, Math.PI / 2, Math.PI + Math.PI / 2);
ctx.LineTo (x + w - r, y);
ctx.Arc (x + w - r, y + r, r, Math.PI + Math.PI / 2, Math.PI + Math.PI + Math.PI / 2);
ctx.LineTo (x + r, y + h);
ctx.ClosePath ();
}