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

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

Method to add an ellipse to the image.
public drawEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Imagick
$x integer
$y integer
$w integer
$h integer
Результат Imagick
    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;
    }

Usage Example

Пример #1
0
 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());
 }