Exemplo n.º 1
0
 /**
  * Create the SVG representation from this Drawable
  *
  * @param   RenderContext $ctx  The context to use for rendering
  *
  * @return  DOMElement          The SVG Element
  */
 public function toSvg(RenderContext $ctx)
 {
     $doc = $ctx->getDocument();
     $rect = $doc->createElement('rect');
     list($x, $y) = $ctx->toAbsolute($this->x, $this->y);
     if ($this->keepRatio) {
         $ctx->keepRatio();
     }
     list($width, $height) = $ctx->toAbsolute($this->width, $this->height);
     if ($this->keepRatio) {
         $ctx->ignoreRatio();
     }
     $rect->setAttribute('x', Format::formatSVGNumber($x));
     $rect->setAttribute('y', Format::formatSVGNumber($y));
     $rect->setAttribute('width', Format::formatSVGNumber($width));
     $rect->setAttribute('height', Format::formatSVGNumber($height));
     $rect->setAttribute('style', $this->getStyle());
     $this->applyAttributes($rect);
     $this->appendAnimation($rect, $ctx);
     return $rect;
 }