Exemplo n.º 1
0
 protected function prepareRenderParams(SVGRasterizer $rasterizer, array $options)
 {
     $scaleX = $rasterizer->getScaleX();
     $scaleY = $rasterizer->getScaleY();
     $points = array();
     foreach ($options['points'] as $point) {
         $points[] = $point[0] * $scaleX;
         $points[] = $point[1] * $scaleY;
     }
     return array('open' => isset($options['open']) ? $options['open'] : false, 'points' => $points, 'numpoints' => count($options['points']));
 }
Exemplo n.º 2
0
 public function rasterize(SVGRasterizer $rasterizer)
 {
     if ($this->getComputedStyle('display') === 'none') {
         return;
     }
     $visibility = $this->getComputedStyle('visibility');
     if ($visibility === 'hidden' || $visibility === 'collapse') {
         return;
     }
     $rasterizer->render('polygon', array('open' => false, 'points' => $this->getPoints()), $this);
 }
Exemplo n.º 3
0
 public function rasterize(SVGRasterizer $rasterizer)
 {
     if ($this->getComputedStyle('display') === 'none') {
         return;
     }
     $visibility = $this->getComputedStyle('visibility');
     if ($visibility === 'hidden' || $visibility === 'collapse') {
         return;
     }
     $d = $this->getDescription();
     if (!isset($d)) {
         return;
     }
     $commands = $rasterizer->getPathParser()->parse($d);
     $subpaths = $rasterizer->getPathApproximator()->approximate($commands);
     foreach ($subpaths as $subpath) {
         $rasterizer->render('polygon', array('open' => true, 'points' => $subpath), $this);
     }
 }
Exemplo n.º 4
0
 public function rasterize(SVGRasterizer $rasterizer)
 {
     if ($this->getComputedStyle('display') === 'none') {
         return;
     }
     $visibility = $this->getComputedStyle('visibility');
     if ($visibility === 'hidden' || $visibility === 'collapse') {
         return;
     }
     $r = $this->getRadius();
     $rasterizer->render('ellipse', array('cx' => $this->getCenterX(), 'cy' => $this->getCenterY(), 'rx' => $r, 'ry' => $r), $this);
 }
Exemplo n.º 5
0
 public function rasterize(SVGRasterizer $rasterizer)
 {
     if ($this->getComputedStyle('display') === 'none') {
         return;
     }
     $visibility = $this->getComputedStyle('visibility');
     if ($visibility === 'hidden' || $visibility === 'collapse') {
         return;
     }
     $rasterizer->render('line', array('x1' => $this->getX1(), 'y1' => $this->getY1(), 'x2' => $this->getX2(), 'y2' => $this->getY2()), $this);
 }
Exemplo n.º 6
0
 /**
  * Parses the length string in relation to the rasterizer's Y dimension.
  *
  * @param string        $len The CSS length string.
  * @param SVGRasterizer $ras The rasterizer for scaling the length.
  *
  * @return float The parsed and scaled length, in pixels.
  */
 protected static function prepareLengthY($len, SVGRasterizer $ras)
 {
     $doc = $ras->getDocumentWidth();
     $scale = $ras->getScaleY();
     return SVG::convertUnit($len, $doc) * $scale;
 }
Exemplo n.º 7
0
 public function rasterize(SVGRasterizer $rasterizer)
 {
     if ($this->getComputedStyle('display') === 'none') {
         return;
     }
     $visibility = $this->getComputedStyle('visibility');
     if ($visibility === 'hidden' || $visibility === 'collapse') {
         return;
     }
     $rasterizer->render('rect', array('x' => $this->getX(), 'y' => $this->getY(), 'width' => $this->getWidth(), 'height' => $this->getHeight()), $this);
 }