当前位置: 首页>>代码示例>>C#>>正文


C# Context.Arc方法代码示例

本文整理汇总了C#中Cairo.Context.Arc方法的典型用法代码示例。如果您正苦于以下问题:C# Context.Arc方法的具体用法?C# Context.Arc怎么用?C# Context.Arc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cairo.Context的用法示例。


在下文中一共展示了Context.Arc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: draw

	static void draw (Context cr, int width, int height)
	{
		double xc = 0.5;
		double yc = 0.5;
		double radius = 0.4;
		double angle1 = 45.0  * (Math.PI / 180.0);  // angles are specified
		double angle2 = 180.0 * (Math.PI / 180.0);  // in radians
		
		cr.Scale (width, height);
		cr.LineWidth = 0.04;

		cr.Arc (xc, yc, radius, angle1, angle2);
		cr.Stroke ();
		
		// draw helping lines
		cr.Color = new Color(1, 0.2, 0.2, 0.6);
		cr.Arc (xc, yc, 0.05, 0, 2 * Math.PI);
		cr.Fill ();
		cr.LineWidth = 0.03;
		cr.Arc (xc, yc, radius, angle1, angle1);
		cr.LineTo (new PointD (xc, yc));
		cr.Arc (xc, yc, radius, angle2, angle2);
		cr.LineTo (new PointD (xc, yc));
		cr.Stroke ();
	}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:25,代码来源:arc.cs

示例2: OnTransformIp

  protected override FlowReturn OnTransformIp (Gst.Buffer buf) {
    if (!buf.IsWritable)
      return FlowReturn.Error;

    Cairo.ImageSurface img = new Cairo.ImageSurface (buf.Data, Cairo.Format.Rgb24, width, height, width*4);

    using (Cairo.Context context = new Cairo.Context (img)) {
      double dx = (double) ( (buf.Timestamp / Clock.MSecond) % 2180) / 5;
      context.Save ();
      context.Scale (width / 640.0, height / 480.0);
      context.MoveTo (300, 10 + dx);
      context.LineTo (500 - dx, 400);
      context.LineWidth = 4.0;
      context.Color = new Color (0, 0, 1.0);
      context.Stroke();
      context.Restore ();

      if (lastX != -1 && lastY != -1) {
        context.Color = new Color (1.0, 0, 0);
        context.Translate (lastX, lastY);
        context.Scale (Math.Min (width / 640.0, height / 480.0), Math.Min (width / 640.0, height / 480.0));
        context.Arc (0, 0, 10.0, 0.0, 2 * Math.PI);
        context.Fill();
      }
    }

    img.Destroy ();
    return base.OnTransformIp (buf);
  }
开发者ID:jwzl,项目名称:ossbuild,代码行数:29,代码来源:TransformSample.cs

示例3: DrawPoints

 public static void DrawPoints(List<PointD> points,Context cr)
 {
     foreach (PointD p in points){
         cr.MoveTo(p);
         cr.SetSourceRGB (0.3, 0.3, 0.3);
         cr.Arc (p.X, p.Y, 2, 0, 2 * Math.PI);
         cr.Fill ();
     }
 }
开发者ID:latestversion,项目名称:projects,代码行数:9,代码来源:Drawer.cs

示例4: OvalPath

	void OvalPath (Context cr, double xc, double yc, double xr, double yr)
	{
		Matrix m = cr.Matrix;

		cr.Translate (xc, yc);
		cr.Scale (1.0, yr / xr);
		cr.MoveTo (xr, 0.0);
		cr.Arc (0, 0, xr, 0, 2 * Math.PI);
		cr.ClosePath ();

		cr.Matrix = m;
	}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:12,代码来源:CairoSample.cs

示例5: draw

        public void draw(Context cr)
        {
            Triangle t = model.tri;
            switch (model.alignment) {
            case ActiveTriangle.TriangleAlignment.ChaoticEvil:
                cr.SetSourceRGB (0.5, 0, 0);
                break;
            case ActiveTriangle.TriangleAlignment.TrueNeutral:
                cr.SetSourceRGB (0, 0.8, 0);
                break;
            default:
                cr.SetSourceRGB (1.0, 1.0, 0);
                break;

            }
            cr.LineWidth = 1.1;
            cr.MoveTo (t.a);
            cr.LineTo (t.b);
            cr.MoveTo (t.b);
            cr.LineTo (t.c);
            cr.MoveTo (t.c);
            cr.LineTo (t.a);
            cr.Stroke ();

            cr.Fill();

            Tuple<PointD,PointD,PointD,PointD> points;

            points = model.getSharpestPointAndAssociatedMidpointAndDullestPoints ();
            PointD sharpest = points.Item1;
            PointD midPoint = points.Item2;

            cr.SetSourceRGB (1.0, 0.3, 0.3);
            cr.Arc (sharpest.X, sharpest.Y, 2, 0, 2 * Math.PI);
            cr.Fill ();

            cr.Arc (midPoint.X, midPoint.Y, 2, 0, 2 * Math.PI);
            cr.Fill ();
        }
开发者ID:latestversion,项目名称:projects,代码行数:39,代码来源:ActiveTriangleView.cs

示例6: Draw

        public override void Draw(Context context)
        {
            double middle = DisplayBox.Width / 2.0;

            context.LineWidth = LineWidth;
            context.Save ();
            context.Translate (DisplayBox.X + middle, DisplayBox.Y + middle);
            context.Arc (0.0, 0.0, middle, 0.0, 2.0 * Math.PI);
            context.Restore ();
            context.Color = new Cairo.Color (1.0, 1.0, 0.2, 0.2);
            context.FillPreserve ();
            context.Color = new Cairo.Color (0.0, 0.0, 0.0, 1.0);
            context.Stroke ();
        }
开发者ID:mono,项目名称:monohotdraw,代码行数:14,代码来源:LabelHandle.cs

示例7: arc

		public void arc(Context cr, int width, int height)
		{
			PointD c = new PointD (0.5, 0.5);
			double radius = 0.4;
			double angle1 = 45.0  * (Math.PI/180.0);  /* angles are specified */
			double angle2 = 180.0 * (Math.PI/180.0);  /* in radians           */

			Normalize(cr, width, height);

			cr.Arc(c.X, c.Y, radius, angle1, angle2);
			cr.Stroke();

			// draw helping lines
			cr.Color = new Color (1, 0.2, 0.2, 0.6);
			cr.Arc(c.X, c.Y, 0.05, 0, 2*Math.PI);
			cr.Fill();
			cr.LineWidth = 0.03;
			cr.Arc(c.X, c.Y, radius, angle1, angle1);
			cr.LineTo(c);
			cr.Arc(c.X, c.Y, radius, angle2, angle2);
			cr.LineTo(c);
			cr.Stroke();
		}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:23,代码来源:Snippets.cs

示例8: Draw

		public override void Draw (Context context, IDrawingView view) {
			RectangleD rect = ViewDisplayBox(view);
			
			double middle = rect.Width / 2.0;

			context.LineWidth = LineWidth;
			context.Save ();
			context.Translate (rect.X + middle, rect.Y + middle);
			context.Arc (0.0, 0.0, middle, 0.0, 2.0 * Math.PI);
			context.Restore ();
			context.Color = new Cairo.Color (0.2, 0.2, 1.0, 0.5);
			context.FillPreserve ();
			context.Color = new Cairo.Color (0.0, 0.0, 0.0, 1.0);
			context.Stroke ();
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:15,代码来源:PolyLineHandle.cs

示例9: BasicDraw

		public override void BasicDraw (Context context) {
			double midwidth  = DisplayBox.Width / 2.0;
			double midheight = DisplayBox.Height / 2.0;

			context.LineWidth = LineWidth;
			context.Save ();
			context.Translate (DisplayBox.X + midwidth, DisplayBox.Y + midheight);
			context.Scale (midwidth - 1.0, midheight - 1.0);
			context.Arc (0.0, 0.0, 1.0, 0.0, 2.0 * Math.PI);
			context.Restore ();
			context.Color = FillColor;
			context.FillPreserve ();
			context.Color = LineColor;
			context.Stroke ();
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:15,代码来源:EllipseFigure.cs

示例10: Draw

		public static void Draw (Context grw, ArcElement arc)
		{
			if (arc.Foregraund != null) {
				grw.SetSourceRGB (
					arc.Foregraund.Red, 
					arc.Foregraund.Green, 
					arc.Foregraund.Blue);
			}

			grw.Arc (
				arc.Center.GeometryX, 
				arc.Center.GeometryY, 
				arc.GeometryRadius, 
				arc.ArcStart, 
				arc.ArcStop);

			grw.Stroke ();
		}
开发者ID:jdpillon,项目名称:ArduinoLadder,代码行数:18,代码来源:ArcBrush.cs

示例11: DrawVertexStructure

 public static void DrawVertexStructure(VertexStructure vs, Context cr)
 {
     VertexStructure head = vs;
     int i = 0;
     do {
         cr.MoveTo (vs.v);
         cr.SetSourceRGB (0, 0, 0.8);
         cr.Arc (vs.v.X, vs.v.Y, 2, 0, 2 * Math.PI);
         cr.Fill ();
         cr.LineWidth = 1;
         cr.MoveTo (vs.v);
         cr.LineTo(vs.next.v);
         cr.Stroke();
         vs = vs.next;
         //Logger.Log("Meh..." + i);
         i++;
     } while(!ReferenceEquals(vs,head));
 }
开发者ID:latestversion,项目名称:projects,代码行数:18,代码来源:Drawer.cs

示例12: OnMouseMove

		protected override Gdk.Rectangle OnMouseMove (Context g, Color strokeColor, ImageSurface surface,
		                                              int x, int y, int lastX, int lastY)
		{
			int dx = x - lastX;
			int dy = y - lastY;
			double d = Math.Sqrt (dx * dx + dy * dy) * 2.0;

			double cx = Math.Floor (x / 100.0) * 100 + 50;
			double cy = Math.Floor (y / 100.0) * 100 + 50;

			int steps = Random.Next (1, 10);
			double step_delta = d / steps;

			for (int i = 0; i < steps; i++) {
				g.Arc (cx, cy, (steps - i) * step_delta, 0, Math.PI * 2);
				g.Stroke ();
			}

			return Gdk.Rectangle.Zero;
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:20,代码来源:CircleBrush.cs

示例13: Draw

		public static void Draw(Context grw, Connector con)
		{
			var c = con.Selected ? AppController.Instance.Config.SelectedConnectorColor : 
				!con.ConnectedTo.Any() ? 
				con.Foregraund : 
				AppController.Instance.Config.ConnectedColor;

			if ( c != null) {
				grw.SetSourceRGB (
					c.Red, 
					c.Green, 
					c.Blue);
			}

			grw.Arc (
				con.Center.GeometryX, 
				con.Center.GeometryY, 
				con.GeometryRadius, 
				0, 2 * Math.PI);

			grw.StrokePreserve ();
			grw.Fill ();
		}
开发者ID:jdpillon,项目名称:ArduinoLadder,代码行数:23,代码来源:ConnectorBrush.cs

示例14: ShapeSurface

        protected virtual void ShapeSurface(Context cr, Cairo.Color color)
        {
            cr.Operator = Operator.Source;
            Cairo.Pattern p = new Cairo.SolidPattern (new Cairo.Color (0, 0, 0, 0));
            cr.Source = p;
            p.Destroy ();
            cr.Paint ();
            cr.Operator = Operator.Over;

            Cairo.Pattern r = new SolidPattern (color);
            cr.Source = r;
            r.Destroy ();
            cr.MoveTo (round, 0);
            if (x_align == 1.0)
                cr.LineTo (Allocation.Width, 0);
            else
                cr.Arc (Allocation.Width - round, round, round, - Math.PI * 0.5, 0);
            if (x_align == 1.0 || y_align == 1.0)
                cr.LineTo (Allocation.Width, Allocation.Height);
            else
                cr.Arc (Allocation.Width - round, Allocation.Height - round, round, 0, Math.PI * 0.5);
            if (y_align == 1.0)
                cr.LineTo (0, Allocation.Height);
            else
                cr.Arc (round, Allocation.Height - round, round, Math.PI * 0.5, Math.PI);
            cr.Arc (round, round, round, Math.PI, Math.PI * 1.5);
            cr.ClosePath ();
            cr.Fill ();
        }
开发者ID:GNOME,项目名称:f-spot,代码行数:29,代码来源:ControlOverlay.cs

示例15: DrawCloseButton

		static void DrawCloseButton (Context context, Gdk.Point center, bool hovered, double opacity, double animationProgress)
		{
			if (hovered) {
				const double radius = 6;
				context.Arc (center.X, center.Y, radius, 0, Math.PI * 2);
				context.SetSourceRGBA (.6, .6, .6, opacity);
				context.Fill ();

				context.SetSourceRGBA (0.95, 0.95, 0.95, opacity);
				context.LineWidth = 2;

				context.MoveTo (center.X - 3, center.Y - 3);
				context.LineTo (center.X + 3, center.Y + 3);
				context.MoveTo (center.X - 3, center.Y + 3);
				context.LineTo (center.X + 3, center.Y - 3);
				context.Stroke ();
			} else {
				double lineColor = .63 - .1 * animationProgress;
				const double fillColor = .74;

				double heightMod = Math.Max (0, 1.0 - animationProgress * 2);
				context.MoveTo (center.X - 3, center.Y - 3 * heightMod);
				context.LineTo (center.X + 3, center.Y + 3 * heightMod);
				context.MoveTo (center.X - 3, center.Y + 3 * heightMod);
				context.LineTo (center.X + 3, center.Y - 3 * heightMod);

				context.LineWidth = 2;
				context.SetSourceRGBA (lineColor, lineColor, lineColor, opacity);
				context.Stroke ();

				if (animationProgress > 0.5) {
					double partialProg = (animationProgress - 0.5) * 2;
					context.MoveTo (center.X - 3, center.Y);
					context.LineTo (center.X + 3, center.Y);

					context.LineWidth = 2 - partialProg;
					context.SetSourceRGBA (lineColor, lineColor, lineColor, opacity);
					context.Stroke ();

					double radius = partialProg * 3.5;

					// Background
					context.Arc (center.X, center.Y, radius, 0, Math.PI * 2);
					context.SetSourceRGBA (fillColor, fillColor, fillColor, opacity);
					context.Fill ();

					// Inset shadow
					using (var lg = new LinearGradient (0, center.Y - 5, 0, center.Y)) {
						context.Arc (center.X, center.Y + 1, radius, 0, Math.PI * 2);
						lg.AddColorStop (0, new Cairo.Color (0, 0, 0, 0.2 * opacity));
						lg.AddColorStop (1, new Cairo.Color (0, 0, 0, 0));
						context.SetSource (lg);
						context.Stroke ();
					}

					// Outline
					context.Arc (center.X, center.Y, radius, 0, Math.PI * 2);
					context.SetSourceRGBA (lineColor, lineColor, lineColor, opacity);
					context.Stroke ();

				}
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:63,代码来源:TabStrip.cs


注:本文中的Cairo.Context.Arc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。