Draw a line given a series of coordinates.

Helper function that will use "move" for the first point, "lineto" for the
remaining.

@param x new coordinates
@param y new coordinates
@return path object, for compact syntax.
549627
public SVGPath drawTo(double x, double y) {
    return !isStarted() ? moveTo(x, y) : lineTo(x, y);
  }
832860
public static void drawLine(Point p1, Point p2, PlotOperator plot)
    {
        drawLine(p1.x, p1.y, p2.x, p2.y, plot);
    }
1056168
private static void drawLine(int x0, int y0, int x1, int y1, boolean[][] pic) {
    final int xres = pic.length, yres = pic[0].length;
    // Ensure bounds
    y0 = (y0 < 0) ? 0 : (y0 >= yres) ? (yres - 1) : y0;
    y1 = (y1 < 0) ? 0 : (y1 >= yres) ? (yres - 1) : y1;
    x0 = (x0 < 0) ? 0 : (x0 >= xres) ? (xres - 1) : x0;
    x1 = (x1 < 0) ? 0 : (x1 >= xres) ? (xres - 1) : x1;
    // Default slope
    final int dx = +Math.abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
    final int dy = -Math.abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
    // Error counter
    int err = dx + dy;

    for(;;) {
      pic[x0][y0] = true;
      if(x0 == x1 && y0 == y1) {
        break;
      }

      final int e2 = err << 1;
      if(e2 > dy) {
        err += dy;
        x0 += sx;
      }
      if(e2 < dx) {
        err += dx;
        y0 += sy;
      }
    }
  }
594367
Shape atLocation(float x, float y) {
        start.setLocation(x, y);                              // Store new start
        p.reset();                                            // Erase current path
        createStar();                                         // create new path
        return p;                                             // Return the path
    }
1238018
function(x, y){
            var coords = this.renderer.mouseToTileCoords(x, y),
                tile = this.map.get(coords.x, coords.y);
            if(tile){
                this.renderer.hoveredTileX = tile.x;
                this.renderer.hoveredTileY = tile.y;
            } else {
                this.renderer.hoveredTileX = null;
                this.renderer.hoveredTileY = null;
            }
            this.renderer.draw();
        }
430401
public void lineTo(float x, float y) {
		if (hole != null) {
			hole.add(new float[] {x,y});
		} else {
			localPoints.add(new float[] {x,y});
		}
		cx = x;
		cy = y;
		pointsDirty = true;
	}
633384
public void drawLine(double[]... coord) {
        int[][] sc = new int[coord.length][];
        for (int i = 0; i < sc.length; i++) {
            sc[i] = projection.screenProjection(coord[i]);
        }

        drawLine(sc);
    }
1051409
public function moveTo($x, $y) 
    {
        $p = $this->transform->multiplyPoint($x, $y);
        $this->paths[] = array($p->x, $p->y);
    }
202320
public void setLine(double... points) {
        path = new GeneralPath();
        path.moveTo((float) points[0], (float) points[1]);
        segments = new Shape[points.length / 2 - 1];

        for (int i = 2; i < points.length;) {
            switch (points.length - i) {
            case 2:
                lastPart = new Line2D.Float((float) path.getCurrentPoint().getX(), (float) path
                        .getCurrentPoint().getY(), (float) points[i], (float) points[i + 1]);
                path.append(lastPart, true);
                segments[i / 2 - 1] = lastPart;
                i += 2;
                break;
            case 4:
                lastPart = new QuadCurve2D.Float((float) path.getCurrentPoint().getX(),
                        (float) path.getCurrentPoint().getY(), (float) points[i],
                        (float) points[i + 1], (float) points[i + 2], (float) points[i + 3]);
                path.append(lastPart, true);
                segments[i / 2 - 1] = lastPart;
                segments[i / 2] = lastPart;
                i += 4;
                break;
            case 6:
                lastPart = new CubicCurve2D.Double(path.getCurrentPoint().getX(), path
                        .getCurrentPoint().getY(), points[i], points[i + 1], points[i + 2],
                        points[i + 3], points[i + 4], points[i + 5]);
                path.append(lastPart, true);
                segments[i / 2 - 1] = lastPart;
                segments[i / 2] = lastPart;
                segments[i / 2 + 1] = lastPart;
                i += 6;
                break;
            default: // use two points and add one extra between 2nd and 3rd
                float x = (float) (points[i + 2] + points[i + 4]) / 2F;
                float y = (float) (points[i + 3] + points[i + 5]) / 2F;

                lastPart = new CubicCurve2D.Double(path.getCurrentPoint().getX(), path
                        .getCurrentPoint().getY(), points[i], points[i + 1], points[i + 2],
                        points[i + 3], x, y);

                path.append(lastPart, true);
                segments[i / 2 - 1] = lastPart;
                segments[i / 2] = lastPart;

                i += 4;
            }
        }
    }
1351741
def line(coord, draw)
      line_xy(coord.x1, coord.y1, coord.x2, coord.y2, draw)
    end
13255
function(x, y) {
		if (lang.isValue(x) && lang.isValue(y)) {
			var ctxt = this.getContext();
		
			// Draw the inner bezier curve
			ctxt.lineCap= "round";
			ctxt.strokeStyle="green";
			ctxt.lineWidth="3";

			ctxt.lineTo(x, y);
			ctxt.stroke();
	   }
	}
1299766
def add_moveTo(self, x, y):
        
        moveTo = self._add_moveTo()
        pt = moveTo._add_pt()
        pt.x, pt.y = x, y
        return moveTo
943293
public void vertex(double x, double y) {
        MODE = LINES;
        this.x.add(x);
        this.y.add(y);
        colors.add(this.strokeColor);
        calcG();
    }
376455
def line_xy(x1, y1, x2, y2, draw)
      use_cairo do |cc|
        cc.move_to(x1, y1)
        cc.line_to(x2, y2)
        cc.fancy_stroke(draw)
      end
    end
1295116
protected void drawDashedLine(final Context2D context, double x, double y, final double x2, final double y2, final double[] da, final double plus)
    {
        final int dashCount = da.length;

        final double dx = (x2 - x);

        final double dy = (y2 - y);

        final boolean xbig = (Math.abs(dx) > Math.abs(dy));

        final double slope = (xbig) ? dy / dx : dx / dy;

        context.moveTo(x, y);

        double distRemaining = Math.sqrt((dx * dx) + (dy * dy)) + plus;

        int dashIndex = 0;

        while (distRemaining >= 0.1)
        {
            final double dashLength = Math.min(distRemaining, da[dashIndex % dashCount]);

            double step = Math.sqrt((dashLength * dashLength) / (1 + (slope * slope)));

            if (xbig)
            {
                if (dx < 0)
                {
                    step = -step;
                }
                x += step;

                y += slope * step;
            }
            else
            {
                if (dy < 0)
                {
                    step = -step;
                }
                x += slope * step;

                y += step;
            }
            if ((dashIndex % 2) == 0)
            {
                context.lineTo(x, y);
            }
            else
            {
                context.moveTo(x, y);
            }
            distRemaining -= dashLength;

            dashIndex++;
        }
    }
1361675
function drawStroke (stroke) {
            context.beginPath();
            for (var j = 0; j < stroke.points.length - 1; j++) {
                var start = normalizePoint(stroke.points[j]);
                var end = normalizePoint(stroke.points[j + 1]);

                context.moveTo(start.x, start.y);
                context.lineTo(end.x, end.y);
            }
            context.closePath();

            context.strokeStyle = stroke.color;
            context.lineWidth = normalizeLineSize(stroke.size);
            context.lineJoin = stroke.join;
            context.lineCap = stroke.cap;
            context.miterLimit = stroke.miterLimit;

            context.stroke();
        }
263046
public function lineTo($x,$y)
	{
		
		$imageResource = $this->_imageResource;
		
		$_x = (int)$x;
		$_y = (int)$y;
		if($this->_beganFill){
			$this->_polygonPath[] = $_x;
			$this->_polygonPath[] = $_y;
		}else{
			imageline(
				$imageResource,
				$this->_oldX,
				$this->_oldY,
				$_x,
				$_y,
				$this->_lineDmColor->imagecolorallocatealpha($imageResource)
			);
		}
		$this->_oldX = $_x;
		$this->_oldY = $_y;
		return $this;
	}