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

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

Method to add a line to the image.
public drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : Imagick
$x1 integer
$y1 integer
$x2 integer
$y2 integer
Результат Imagick
    public function drawLine($x1, $y1, $x2, $y2)
    {
        $draw = new \ImagickDraw();
        $draw->setStrokeColor($this->setColor($this->strokeColor));
        $draw->setStrokeWidth(null === $this->strokeWidth ? 1 : $this->strokeWidth);
        $draw->line($x1, $y1, $x2, $y2);
        $this->resource->drawImage($draw);
        return $this;
    }

Usage Example

Пример #1
0
 public function testAddLine()
 {
     $i = new Imagick(__DIR__ . '/../tmp/test.jpg');
     $i->drawLine(10, 10, 100, 100);
     $this->assertEquals(640, $i->getWidth());
 }