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

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

Add a clipping ellipse.
public drawClippingEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Svg
$x integer
$y integer
$w integer
$h integer
Результат Svg
    public function drawClippingEllipse($x, $y, $w, $h = null)
    {
        $this->curClippingPath = count($this->clippingPaths);
        $defs = $this->resource->addChild('defs');
        $clip = $defs->addChild('clipPath');
        $clip->addAttribute('id', 'clip' . $this->curClippingPath);
        $ellipse = $clip->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);
        return $this;
    }

Usage Example

Пример #1
0
 public function testAddClippingEllipse()
 {
     $s = new Svg('graph.svg', '640px', '480px');
     $s->drawClippingEllipse(10, 10, 320, 240)->setClippingPath(0);
     $this->assertEquals(640, $s->getWidth());
 }