public function drawEllipse($x, $y, $w, $h = null)
{
$wid = $w;
$hgt = null === $h ? $w : $h;
$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->ellipse($x, $y, $wid, $hgt, 0, 360);
$this->resource->drawImage($draw);
return $this;
}
public function testAddEllipse() { $i = new Imagick(__DIR__ . '/../tmp/test.jpg'); $i->setStrokeColor(new Rgb(0, 0, 0))->setStrokeWidth(5)->drawEllipse(10, 10, 100, 100); $i->setBackgroundColor(new Rgb(255, 0, 0)); $i->drawEllipse(10, 10, 100, 100); $i->setFillColor(new Rgb(255, 0, 0)); $i->drawEllipse(10, 10, 100, 100); $this->assertEquals(640, $i->getWidth()); }