Pop\Image\Svg::drawLine PHP Метод

drawLine() публичный Метод

Method to add a line to the image.
public drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : void
$x1 integer
$y1 integer
$x2 integer
$y2 integer
Результат void
    public function drawLine($x1, $y1, $x2, $y2)
    {
        $line = $this->resource->addChild('line');
        $line->addAttribute('x1', $x1 . $this->units);
        $line->addAttribute('y1', $y1 . $this->units);
        $line->addAttribute('x2', $x2 . $this->units);
        $line->addAttribute('y2', $y2 . $this->units);
        $line = $this->setStyles($line);
        return $this;
    }

Usage Example

Пример #1
0
 public function testAddLine()
 {
     $s = new Svg('graph.svg', '640px', '480px');
     $s->drawLine(10, 10, 100, 100);
     $this->assertEquals(640, $s->getWidth());
 }