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 / Polygon.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 class Polygon extends Shape
12 {
13 public function start($attribs)
14 {
15 $tmp = array();
16 preg_match_all('/([\-]*[0-9\.]+)/', $attribs['points'], $tmp);
17
18 $points = $tmp[0];
19 $count = count($points);
20
21 $surface = $this->document->getSurface();
22 list($x, $y) = $points;
23 $surface->moveTo($x, $y);
24
25 for ($i = 2; $i < $count; $i += 2) {
26 $x = $points[$i];
27 $y = $points[$i + 1];
28 $surface->lineTo($x, $y);
29 }
30
31 $surface->closePath();
32 }
33 }