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

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

Method to add an ellipse to the image.
public drawEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Svg
$x integer
$y integer
$w integer
$h integer
Результат Svg
    public function drawEllipse($x, $y, $w, $h = null)
    {
        $ellipse = $this->resource->addChild('ellipse');
        $ellipse->addAttribute('cx', $x . $this->units);
        $ellipse->addAttribute('cy', $y . $this->units);
        $ellipse->addAttribute('rx', $w . $this->units);
        $ellipse->addAttribute('ry', (null === $h ? $w : $h) . $this->units);
        $ellipse = $this->setStyles($ellipse);
        return $this;
    }

Usage Example

Пример #1
0
 public function testAddEllipse()
 {
     $s = new Svg('graph.svg', '640px', '480px');
     $s->setStrokeColor(new Rgb(0, 0, 0))->drawEllipse(10, 10, 100, 100);
     $s->setBackgroundColor(new Rgb(255, 0, 0));
     $s->drawEllipse(10, 10, 100, 100);
     $s->setFillColor(new Rgb(255, 0, 0));
     $s->drawEllipse(10, 10, 100, 100);
     $this->assertEquals(640, $s->getWidth());
 }