Source of file Image.php
Size: 1,548 Bytes - Last Modified: 2021-12-23T10:11:59+00:00
/var/www/docs.ssmods.com/process/src/ext/phenx/php-svg-lib/src/Svg/Tag/Image.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | <?php /** * @package php-svg-lib * @link http://github.com/PhenX/php-svg-lib * @author Fabien Ménager <fabien.menager@gmail.com> * @license GNU LGPLv3+ http://www.gnu.org/copyleft/lesser.html */ namespace Svg\Tag; class Image extends AbstractTag { protected $x = 0; protected $y = 0; protected $width = 0; protected $height = 0; protected $href = null; protected function before($attributes) { parent::before($attributes); $surface = $this->document->getSurface(); $surface->save(); $this->applyTransform($attributes); } public function start($attributes) { $document = $this->document; $height = $this->document->getHeight(); $this->y = $height; if (isset($attributes['x'])) { $this->x = $attributes['x']; } if (isset($attributes['y'])) { $this->y = $height - $attributes['y']; } if (isset($attributes['width'])) { $this->width = $attributes['width']; } if (isset($attributes['height'])) { $this->height = $attributes['height']; } if (isset($attributes['xlink:href'])) { $this->href = $attributes['xlink:href']; } $document->getSurface()->transform(1, 0, 0, -1, 0, $height); $document->getSurface()->drawImage($this->href, $this->x, $this->y, $this->width, $this->height); } protected function after() { $this->document->getSurface()->restore(); } } |