NewSubPath() public method

public NewSubPath ( ) : void
return void
Example #1
0
        public void DrawArc(Coordinate point, double radius, double startAngle, double sweepAngle)
        {
            var pt = ToCairoPoint(point);
            var r  = transformer.ScaleOnX(radius);

            context.NewSubPath();
            context.LineWidth = 1.0;
            context.SetSourceColor(currentLineColor);
            context.Arc(pt.X, pt.Y, r, startAngle, startAngle + sweepAngle);
            context.Stroke();
        }
Example #2
0
			void RoundRectangle (Context ctx, Rectangle rect, double radius)
			{
				double degrees = Math.PI / 180;
				var x = rect.X;
				var y = rect.Y;
				var height = rect.Height;
				var width = rect.Width;
				
				ctx.NewSubPath ();
				ctx.Arc (x + width - radius, y + radius, radius, -90 * degrees, 0 * degrees);
				ctx.Arc (x + width - radius, y + height - radius, radius, 0 * degrees, 90 * degrees);
				ctx.Arc (x + radius, y + height - radius, radius, 90 * degrees, 180 * degrees);
				ctx.Arc (x + radius, y + radius, radius, 180 * degrees, 270 * degrees);
				ctx.ClosePath ();
			}
 private void paintNodes(Context ctx, int w, int h, IEnumerable<Node> nodes)
 {
     ctx.LineWidth = 2.0d;
     foreach(Node node in nodes) {
         PointD abs = new PointD(node.Item2.X*w, node.Item2.Y*h);
         ctx.Arc(abs.X, abs.Y, AlgorithmRadius, 0.0d, 2.0d*Math.PI);
         ctx.ClosePath();
         ctx.NewSubPath();
         ctx.Arc(abs.X, abs.Y, AlgorithmRadius-BlueprintStyle.Thickness, 0.0d, 2.0d*Math.PI);
         ctx.ClosePath();
         ctx.NewSubPath();
     }
     ctx.Pattern = BlueprintStyle.FillPattern;
     ctx.FillPreserve();
     ctx.Color = BlueprintStyle.HardWhite;
     ctx.Stroke();
     double r_2, dx, dy;
     this.nodeCenters.Clear();
     foreach(Node node in nodes) {
         PointD abs = new PointD(node.Item2.X*w, node.Item2.Y*h);
         this.nodeCenters.Add(abs);
         TextExtents te = ctx.TextExtents(node.Item1);
         r_2 = (AlgorithmRadius-BlueprintStyle.Thickness)/Math.Sqrt(te.Width*te.Width+te.Height*te.Height);
         ctx.Save();
         ctx.MoveTo(abs.X-r_2*te.Width, abs.Y+r_2*te.Height);
         ctx.Scale(2.0d*r_2, 2.0d*r_2);
         ctx.ShowText(node.Item1);
         ctx.Restore();
     }
 }