Example #1
0
 public function draw(SVGRenderingHelper $rh, $scaleX, $scaleY, $offsetX = 0, $offsetY = 0)
 {
     $rh->push();
     $opacity = $this->getStyle('opacity');
     if (isset($opacity) && is_numeric($opacity)) {
         $opacity = floatval($opacity);
         $rh->scaleOpacity($opacity);
     }
     // original (document fragment) width for unit parsing
     $ow = $rh->getWidth() / $scaleX;
     $cx = ($offsetX + $this->cx) * $scaleX;
     $cy = ($offsetY + $this->cy) * $scaleY;
     $rx = $this->rx * $scaleX;
     $ry = $this->ry * $scaleY;
     $fill = $this->getComputedStyle('fill');
     if (isset($fill) && $fill !== 'none') {
         $fillColor = SVG::parseColor($fill, true);
         $rh->fillEllipse($cx, $cy, $rx, $ry, $fillColor);
     }
     $stroke = $this->getComputedStyle('stroke');
     if (isset($stroke) && $stroke !== 'none') {
         $strokeColor = SVG::parseColor($stroke, true);
         $rh->setStrokeWidth(SVG::convertUnit($this->getComputedStyle('stroke-width'), $ow) * $scaleX);
         $rh->drawEllipse($cx, $cy, $rx, $ry, $strokeColor);
     }
     $rh->pop();
 }