public drawPolygon ( array $points ) : |
||
$points | array | |
Результат |
public function drawPolygon($points)
{
$draw = new \ImagickDraw();
$draw->setFillColor($this->setColor($this->fillColor));
if (null !== $this->strokeWidth) {
$draw->setStrokeColor($this->setColor($this->strokeColor));
$draw->setStrokeWidth(null === $this->strokeWidth ? 1 : $this->strokeWidth);
}
$draw->polygon($points);
$this->resource->drawImage($draw);
return $this;
}
public function testAddPolygon() { $i = new Imagick(__DIR__ . '/../tmp/test.jpg'); $points = array(array('x' => 320, 'y' => 50), array('x' => 400, 'y' => 100), array('x' => 420, 'y' => 200), array('x' => 280, 'y' => 320), array('x' => 200, 'y' => 180)); $i->setStrokeColor(new Rgb(0, 0, 0))->setStrokeWidth(5)->drawPolygon($points); $i->setBackgroundColor(new Rgb(255, 0, 0)); $i->drawPolygon($points); $i->setFillColor(new Rgb(255, 0, 0)); $i->drawPolygon($points); $this->assertEquals(640, $i->getWidth()); }