commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / vendor / phenx / php-svg-lib / src / Svg / Tag / Shape.php
1 <?php
2 /**
3 * @package php-svg-lib
4 * @link http://github.com/PhenX/php-svg-lib
5 * @author Fabien Ménager <fabien.menager@gmail.com>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7 */
8
9 namespace Svg\Tag;
10
11 use Svg\Style;
12
13 class Shape extends AbstractTag
14 {
15 protected function before($attribs)
16 {
17 $surface = $this->document->getSurface();
18
19 $surface->save();
20
21 $style = new Style();
22 $style->inherit($this);
23 $style->fromAttributes($attribs);
24
25 $this->setStyle($style);
26
27 $surface->setStyle($style);
28
29 $this->applyTransform($attribs);
30 }
31
32 protected function after()
33 {
34 $surface = $this->document->getSurface();
35
36 if ($this->hasShape) {
37 $style = $surface->getStyle();
38
39 $fill = $style->fill && $style->fill !== "none";
40 $stroke = $style->stroke && $style->stroke !== "none";
41
42 if ($fill) {
43 if ($stroke) {
44 $surface->fillStroke();
45 } else {
46 $surface->fill();
47 }
48 } elseif ($stroke) {
49 $surface->stroke();
50 }
51 else {
52 $surface->endPath();
53 }
54 }
55
56 $surface->restore();
57 }
58 }