4 * @link http://github.com/PhenX/php-svg-lib
5 * @author Fabien Ménager <fabien.menager@gmail.com>
6 * @license GNU LGPLv3+ http://www.gnu.org/copyleft/lesser.html
11 class Image
extends AbstractTag
16 protected $height = 0;
17 protected $href = null;
19 protected function before($attributes)
21 parent
::before($attributes);
23 $surface = $this->document
->getSurface();
26 $this->applyTransform($attributes);
29 public function start($attributes)
31 $document = $this->document
;
32 $height = $this->document
->getHeight();
35 if (isset($attributes['x'])) {
36 $this->x
= $attributes['x'];
38 if (isset($attributes['y'])) {
39 $this->y
= $height - $attributes['y'];
42 if (isset($attributes['width'])) {
43 $this->width
= $attributes['width'];
45 if (isset($attributes['height'])) {
46 $this->height
= $attributes['height'];
49 if (isset($attributes['xlink:href'])) {
50 $this->href
= $attributes['xlink:href'];
53 $document->getSurface()->transform(1, 0, 0, -1, 0, $height);
55 $document->getSurface()->drawImage($this->href
, $this->x
, $this->y
, $this->width
, $this->height
);
58 protected function after()
60 $this->document
->getSurface()->restore();