draw a line from one set of coordinates to another

@param $x1
@param $y1
@param $x2
@param $y2
@param bool $stroke
546878
function line($x1, $y1, $x2, $y2, $stroke = true)
    {
        $this->addContent(sprintf("\n%.3F %.3F m %.3F %.3F l", $x1, $y1, $x2, $y2));

        if ($stroke) {
            $this->addContent(' S');
        }
    }
718689
public void setLine (float x1, float y1, float x2, float y2) {
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;
    }
1351741
def line(coord, draw)
      line_xy(coord.x1, coord.y1, coord.x2, coord.y2, draw)
    end
410814
public static void drawRectangle( Rectangle2D_I32 rect , Graphics2D g2 ) {
		g2.drawLine(rect.x0, rect.y0, rect.x1, rect.y0);
		g2.drawLine(rect.x1, rect.y0, rect.x1, rect.y1);
		g2.drawLine(rect.x0, rect.y1, rect.x1, rect.y1);
		g2.drawLine(rect.x0, rect.y1, rect.x0, rect.y0);
	}
892580
function line($x1, $y1, $x2, $y2, $color, $width, $style = null) {
    $this->_set_line_style($width, "butt", "", $style);
    $this->_set_stroke_color($color);

    $y1 = $this->y($y1);
    $y2 = $this->y($y2);

    $this->_pdf->moveto($x1,$y1);
    $this->_pdf->lineto($x2, $y2);
    $this->_pdf->stroke();
  }
744131
public function svgLine($x1, $y1, $x2, $y2)
    {
        // get the Closing operator
        $op='S';

        // drawing
        $this->_Point($x1, $y1, true);
        $this->_Line($x2, $y2, true);
        $this->_out($op);
    }
870943
public function createLine(float $x1, float $y1, float $x2, float $y2): ReportBaseLine
    {
        return new ReportPdfLine($x1, $y1, $x2, $y2);
    }
1321466
public void setCurve (XY p1, XY cp, XY p2) {
        setCurve(p1.x(), p1.y(), cp.x(), cp.y(), p2.x(), p2.y());
    }
1343218
public function createLine(float $x1, float $y1, float $x2, float $y2): ReportBaseLine
    {
        return new ReportHtmlLine($x1, $y1, $x2, $y2);
    }
1103685
public final void set(Point p1, Point p2)
    {
        set(p1.getX(), p1.getY(), p2.getX(), p2.getY());
    }
273829
public function setGraphArea($X1, $Y1, $X2, $Y2)
    {
        if ($X2 < $X1 || $X1 == $X2 || $Y2 < $Y1 || $Y1 == $Y2) {
            return -1;
        }

        $this->GraphAreaX1 = $X1;
        $this->DataSet->Data["GraphArea"]["X1"] = $X1;
        $this->GraphAreaY1 = $Y1;
        $this->DataSet->Data["GraphArea"]["Y1"] = $Y1;
        $this->GraphAreaX2 = $X2;
        $this->DataSet->Data["GraphArea"]["X2"] = $X2;
        $this->GraphAreaY2 = $Y2;
        $this->DataSet->Data["GraphArea"]["Y2"] = $Y2;
    }
724969
public static void drawLine(int x0, int y0, int x1, int y1, PlotOperator plot)
    {
        if (x0 > x1)
        {
            drawLine(x1, y1, x0, y0, plot);
        }
        else
        {
            if (y0 > y1)
            {
                drawLine(x0, -y0, x1, -y1, (x, y) -> plot.plot(x, -y));
            }
            else
            {
                drawLine1(x0, y0, x1, y1, plot);    // ok to go ahead
            }
        }
    }
1364435
function drawLinearTickStroke(context, sX, sY, eX, eY) {
    context.beginPath();
    context.moveTo(sX, sY);
    context.lineTo(eX, eY);
    context.stroke();
    context.closePath();
}
602230
public void drawLine(float x1, float y1, float x2, float y2) {
		float lineWidth = this.lineWidth - 1;
		
		if (LSR.applyGLLineFixes()) {
			if (x1 == x2) {
				if (y1 > y2) {
					float temp = y2;
					y2 = y1;
					y1 = temp;
				}
				float step = 1 / sy;
				lineWidth = lineWidth / sy;
				fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),lineWidth+step,(y2-y1)+lineWidth+step);
				return;
			} else if (y1 == y2) {
				if (x1 > x2) {
					float temp = x2;
					x2 = x1;
					x1 = temp;
				}
				float step = 1 / sx;
				lineWidth = lineWidth / sx;
				fillRect(x1-(lineWidth/2.0f),y1-(lineWidth/2.0f),(x2-x1)+lineWidth+step,lineWidth+step);
				return;
			}
		}
		
		predraw();
		currentColor.bind();
		TextureImpl.bindNone();

		LSR.start();
		LSR.vertex(x1,y1);
		LSR.vertex(x2,y2);
		LSR.end();
		
		postdraw();
	}
34190
public function drawFilledRectangle($X1, $Y1, $X2, $Y2, array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : 0;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
        $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
        $BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
        $BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
        $BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha;
        $Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : null;
        $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : null;
        $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : null;
        $Dash = isset($Format["Dash"]) ? $Format["Dash"] : false;
        $DashStep = isset($Format["DashStep"]) ? $Format["DashStep"] : 4;
        $DashR = isset($Format["DashR"]) ? $Format["DashR"] : 0;
        $DashG = isset($Format["DashG"]) ? $Format["DashG"] : 0;
        $DashB = isset($Format["DashB"]) ? $Format["DashB"] : 0;
        $NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : false;

        if ($Surrounding != null) {
            $BorderR = $R + $Surrounding;
            $BorderG = $G + $Surrounding;
            $BorderB = $B + $Surrounding;
        }

        if ($X1 > $X2) {
            list($X1, $X2) = [$X2, $X1];
        }
        if ($Y1 > $Y2) {
            list($Y1, $Y2) = [$Y2, $Y1];
        }

        $RestoreShadow = $this->Shadow;
        if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) {
            $this->Shadow = false;
            $this->drawFilledRectangle(
                $X1 + $this->ShadowX,
                $Y1 + $this->ShadowY,
                $X2 + $this->ShadowX,
                $Y2 + $this->ShadowY,
                [
                    "R" => $this->ShadowR,
                    "G" => $this->ShadowG,
                    "B" => $this->ShadowB,
                    "Alpha" => $this->Shadowa,
                    "Ticks" => $Ticks,
                    "NoAngle" => $NoAngle
                ]
            );
        }

        $Color = $this->allocateColor($this->Picture, $R, $G, $B, $Alpha);
        if ($NoAngle) {
            imagefilledrectangle($this->Picture, ceil($X1) + 1, ceil($Y1), floor($X2) - 1, floor($Y2), $Color);
            imageline($this->Picture, ceil($X1), ceil($Y1) + 1, ceil($X1), floor($Y2) - 1, $Color);
            imageline($this->Picture, floor($X2), ceil($Y1) + 1, floor($X2), floor($Y2) - 1, $Color);
        } else {
            imagefilledrectangle($this->Picture, ceil($X1), ceil($Y1), floor($X2), floor($Y2), $Color);
        }
        if ($Dash) {
            if ($BorderR != -1) {
                $iX1 = $X1 + 1;
                $iY1 = $Y1 + 1;
                $iX2 = $X2 - 1;
                $iY2 = $Y2 - 1;
            } else {
                $iX1 = $X1;
                $iY1 = $Y1;
                $iX2 = $X2;
                $iY2 = $Y2;
            }

            $Color = $this->allocateColor($this->Picture, $DashR, $DashG, $DashB, $Alpha);
            $Y = $iY1 - $DashStep;
            for ($X = $iX1; $X <= $iX2 + ($iY2 - $iY1); $X = $X + $DashStep) {
                $Y = $Y + $DashStep;
                if ($X > $iX2) {
                    $Xa = $X - ($X - $iX2);
                    $Ya = $iY1 + ($X - $iX2);
                } else {
                    $Xa = $X;
                    $Ya = $iY1;
                }
                if ($Y > $iY2) {
                    $Xb = $iX1 + ($Y - $iY2);
                    $Yb = $Y - ($Y - $iY2);
                } else {
                    $Xb = $iX1;
                    $Yb = $Y;
                }
                imageline($this->Picture, $Xa, $Ya, $Xb, $Yb, $Color);
            }
        }

        if ($this->Antialias && !$NoBorder) {
            if ($X1 < ceil($X1)) {
                $AlphaA = $Alpha * (ceil($X1) - $X1);
                $Color = $this->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
                imageline($this->Picture, ceil($X1) - 1, ceil($Y1), ceil($X1) - 1, floor($Y2), $Color);
            }

            if ($Y1 < ceil($Y1)) {
                $AlphaA = $Alpha * (ceil($Y1) - $Y1);
                $Color = $this->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
                imageline($this->Picture, ceil($X1), ceil($Y1) - 1, floor($X2), ceil($Y1) - 1, $Color);
            }

            if ($X2 > floor($X2)) {
                $AlphaA = $Alpha * (.5 - ($X2 - floor($X2)));
                $Color = $this->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
                imageline($this->Picture, floor($X2) + 1, ceil($Y1), floor($X2) + 1, floor($Y2), $Color);
            }

            if ($Y2 > floor($Y2)) {
                $AlphaA = $Alpha * (.5 - ($Y2 - floor($Y2)));
                $Color = $this->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
                imageline($this->Picture, ceil($X1), floor($Y2) + 1, floor($X2), floor($Y2) + 1, $Color);
            }
        }

        if ($BorderR != -1) {
            $this->drawRectangle(
                $X1,
                $Y1,
                $X2,
                $Y2,
                [
                    "R" => $BorderR,
                    "G" => $BorderG,
                    "B" => $BorderB,
                    "Alpha" => $BorderAlpha,
                    "Ticks" => $Ticks,
                    "NoAngle" => $NoAngle
                ]
            );
        }
        $this->Shadow = $RestoreShadow;
    }
1246061
public function addRectangle($x1, $y1, $x2, $y2, $colors = [0, 0, 0])
    {
        $color = imagecolorallocate($this->image(), $colors[0],  $colors[1],  $colors[2]);
        imagerectangle ( $this->image() , $x1 , $y1 , $x2 , $y2 ,  $color );
    }
1344961
function strokePolygon(poly, fill) {
         if (fill === true) {
           this.fillPolygon(poly);
         } else {
           var len = poly.points.length,
               points = this._glPoints,
               i; // Grow internal points buffer if necessary

           for (i = points.length; i < len; i++) {
             points.push(new me.Vector2d());
           } // calculate and draw all segments


           for (i = 0; i < len; i++) {
             points[i].x = poly.pos.x + poly.points[i].x;
             points[i].y = poly.pos.y + poly.points[i].y;
           }

           this.compositor.drawLine(points, len);
         }
       }