本文整理汇总了C#中Cairo.Arc方法的典型用法代码示例。如果您正苦于以下问题:C# Cairo.Arc方法的具体用法?C# Cairo.Arc怎么用?C# Cairo.Arc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cairo
的用法示例。
在下文中一共展示了Cairo.Arc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: draw
static void draw (Cairo.Context gr, int width, int height)
{
int w, h;
ImageSurface image;
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.Arc (0.5, 0.5, 0.3, 0, 2*M_PI);
gr.Clip ();
gr.NewPath ();
image = new ImageSurface("data/e.png");
w = image.Width;
h = image.Height;
gr.Scale (1.0/w, 1.0/h);
image.Show (gr, 0, 0);
image.Destroy();
gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
gr.Clip ();
gr.NewPath ();
gr.Rectangle (new PointD (0, 0), 1, 1);
gr.Fill ();
gr.Color = new Color (0, 1, 0, 1);
gr.MoveTo ( new PointD (0, 0) );
gr.LineTo ( new PointD (1, 1) );
gr.MoveTo ( new PointD (1, 0) );
gr.LineTo ( new PointD (0, 1) );
gr.Stroke ();
}
示例2: 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();
}
示例3: 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.Arc (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 ();
}
示例4: RoundedRectangle
public static void RoundedRectangle(Cairo.Context c, RectangleD rect, double radius)
{
if (radius > (rect.Width /2) || radius > (rect.Height / 2)) {
radius = Math.Min ((rect.Width /2), (rect.Height / 2));
}
c.Save ();
/* Bottom Left */
c.MoveTo(rect.X, rect.Y + radius);
c.Arc (rect.X + radius, rect.Y + radius, radius, Math.PI, -Math.PI/2);
c.LineTo (rect.X2 - radius, rect.Y);
/* Bottom Right */
c.Arc (rect.X2 - radius, rect.Y + radius, radius, -Math.PI/2, 0);
c.LineTo (rect.X2, rect.Y2 - radius);
/* Top Right */
c.Arc (rect.X2 - radius, rect.Y2 - radius, radius, 0, Math.PI/2);
c.LineTo (rect.X + radius, rect.Y2);
/* Top Left */
c.Arc(rect.X + radius, rect.Y2 - radius, radius, Math.PI/2, Math.PI);
c.ClosePath ();
c.Restore ();
}
示例5: draw
static void draw (Cairo.Context gr, int width, int height)
{
gr.Scale (width, height);
gr.LineWidth = 0.04;
LinearGradient pat;
pat = new LinearGradient (0.0, 0.0, 0.0, 1.0);
pat.AddColorStop (1, new Color (0, 0, 0, 1) );
pat.AddColorStop (0, new Color (1, 1, 1, 1) );
gr.Rectangle ( new PointD (0, 0),
1, 1
);
gr.Pattern = pat;
gr.Fill ();
pat.Destroy ();
RadialGradient pat2 = new RadialGradient (0.45, 0.4, 0.1,
0.4, 0.4, 0.5);
pat2.AddColorStop (0, new Color (1, 1, 1, 1) );
pat2.AddColorStop (1, new Color (0, 0, 0, 1) );
gr.Pattern = pat2;
gr.Arc (0.5, 0.5, 0.3, 0, 2 * M_PI);
gr.Fill ();
pat2.Destroy ();
}
示例6: draw
public void draw(Cairo.Context cr)
{
cr.MoveTo (position);
cr.SetSourceRGB (0, 1.0, 0);
cr.Arc (position.X, position.Y, 5, 0, 2 * Math.PI);
cr.Fill ();
}
示例7: 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 ();
}
示例8: 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 ();
}
示例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: draw
public void draw(Cairo.Context cr)
{
if (!canSeePlayer) {
return;
}
cr.MoveTo (position);
cr.SetSourceRGB (1.0, 0.0, 0);
cr.Arc (position.X, position.Y, 5, 0, 2 * Math.PI);
cr.Fill ();
}
示例11: DrawFace
static void DrawFace (Cairo.PointD center, double radius, Cairo.Context e)
{
e.Arc (center.X, center.Y, radius, 0, 360);
Cairo.Gradient pat = new Cairo.LinearGradient (100, 200, 200, 100);
pat.AddColorStop (0, Eto.Drawing.Color.FromArgb (240, 240, 230, 75).ToCairo ());
pat.AddColorStop (1, Eto.Drawing.Color.FromArgb (0, 0, 0, 50).ToCairo ());
e.LineWidth = 0.1;
e.Pattern = pat;
e.FillPreserve ();
e.Stroke ();
}
示例12: 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();
}
示例13: DrawFace
void DrawFace (Cairo.PointD center, double radius, Cairo.Context e)
{
e.Arc (center.X, center.Y, radius, 0, 360);
Cairo.Gradient pat = new Cairo.LinearGradient (100, 200, 200, 100);
pat.AddColorStop (0, Generator.ConvertC (new Eto.Drawing.Color (240, 240, 230, 75)));
pat.AddColorStop (1, Generator.ConvertC (new Eto.Drawing.Color (0, 0, 0, 50)));
e.LineWidth = 0.1;
e.Pattern = pat;
e.FillPreserve ();
e.Stroke ();
}
示例14: DrawRoundedRectangle
/// <summary>
/// The draw rounded rectangle.
/// </summary>
protected 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 = Math.Min(height / 2, width / 2);
}
gr.MoveTo(this._x + x, this._y + y + radius);
gr.Arc(this._x + x + radius, this._y + y + radius, radius, Math.PI, -Math.PI / 2);
gr.LineTo(this._x + x + width - radius, this._y + y);
gr.Arc(this._x + x + width - radius, this._y + y + radius, radius, -Math.PI / 2, 0);
gr.LineTo(this._x + x + width, this._y + y + height - radius);
gr.Arc(this._x + x + width - radius, this._y + y + height - radius, radius, 0, Math.PI / 2);
gr.LineTo(this._x + x + radius, this._y + y + height);
gr.Arc(this._x + x + radius, this._y + y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath();
gr.Restore();
}
示例15: draw
static void draw (Cairo.Context gr, int width, int height)
{
gr.Scale (width, height);
gr.LineWidth = 0.04;
gr.SelectFontFace ("Sans", FontSlant.Normal, FontWeight.Bold);
gr.SetFontSize (0.35);
gr.MoveTo ( new PointD(0.04, 0.53) );
gr.ShowText ("Hello");
gr.MoveTo ( new PointD(0.27, 0.65) );
gr.TextPath ("void");
gr.ColorRgb = new Color (0.5, 0.5, 1, 0);
gr.FillPreserve ();
gr.ColorRgb = new Color (0, 0, 0, 0);
gr.LineWidth = 0.01;
gr.Stroke ();
gr.Color = new Color (1,0.2,0.2, 0.6);
gr.Arc (0.04, 0.53, 0.02, 0, 2*M_PI);
gr.Arc (0.27, 0.65, 0.02, 0, 2*M_PI);
gr.Fill ();
}