Exemplo n.º 1
0
 /**
  * Draw a rectangle
  *
  * Parameter array:
  * 'x0': int X start point
  * 'y0': int Y start point
  * 'x1': int X end point
  * 'y1': int Y end point
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function rectangle($params)
 {
     if (isset($this->_imageMap)) {
         $this->_imageMap->rectangle($params);
     }
     parent::rectangle($params);
 }
Exemplo n.º 2
0
 /**
  * Draw a rectangle
  *
  * Parameter array:
  * 'x0': int X start point
  * 'y0': int Y start point
  * 'x1': int X end point
  * 'y1': int Y end point
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function rectangle($params)
 {
     $x0 = $this->_getX($params['x0']);
     $y0 = $this->_getY($params['y0']);
     $x1 = $this->_getX($params['x1']);
     $y1 = $this->_getY($params['y1']);
     $fillColor = isset($params['fill']) ? $params['line'] : false;
     $lineColor = isset($params['line']) ? $params['line'] : false;
     $line = $this->_setLineStyle($lineColor);
     $fill = $this->_setFillStyle($fillColor);
     if ($line || $fill) {
         pdf_rect($this->_pdf, $this->_getX(min($x0, $x1)), $this->_getY(max($y0, $y1)), abs($x1 - $x0), abs($y1 - $y0));
         if ($line && $fill) {
             pdf_fill_stroke($this->_pdf);
         } elseif ($line) {
             pdf_stroke($this->_pdf);
         } elseif ($fill) {
             pdf_fill($this->_pdf);
         }
     }
     parent::rectangle($params);
 }
Exemplo n.º 3
0
 /**
  * Draw a rectangle
  *
  * Parameter array:
  * 'x0': int X start point
  * 'y0': int Y start point
  * 'x1': int X end point
  * 'y1': int Y end point
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function rectangle($params)
 {
     if (isset($params['url'])) {
         $this->_addMapTag('rect', $this->_getX($params['x0']) . ',' . $this->_getY($params['y0']) . ',' . $this->_getX($params['x1']) . ',' . $this->_getY($params['y1']), $params);
     }
     parent::rectangle($params);
 }
Exemplo n.º 4
0
 /**
  * Draw a rectangle
  *
  * Parameter array:
  * 'x0': int X start point
  * 'y0': int Y start point
  * 'x1': int X end point
  * 'y1': int Y end point
  * 'fill': mixed [optional] The fill color
  * 'line': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function rectangle($params)
 {
     $x0 = min($this->_getX($params['x0']), $this->_getX($params['x1']));
     $y0 = min($this->_getY($params['y0']), $this->_getY($params['y1']));
     $x1 = max($this->_getX($params['x0']), $this->_getX($params['x1']));
     $y1 = max($this->_getY($params['y0']), $this->_getY($params['y1']));
     $fillColor = isset($params['fill']) ? $params['line'] : false;
     $lineColor = isset($params['line']) ? $params['line'] : false;
     $style = $this->_getLineStyle($lineColor) . $this->_getFillStyle($fillColor);
     if ($style != '') {
         $this->_addElement('<rect ' . 'x="' . round($x0) . '" ' . 'y="' . round($y0) . '" ' . 'width="' . round(abs($x1 - $x0)) . '" ' . 'height="' . round(abs($y1 - $y0)) . '" ' . 'style="' . $style . '"' . '/>', $params);
     }
     parent::rectangle($params);
 }
Exemplo n.º 5
0
Arquivo: SWF.php Projeto: roojs/pear
 /**
  * Draw a rectangle
  *
  * Parameter array:
  * 'x0'   : int X start point
  * 'y0'   : int Y start point
  * 'x1'   : int X end point
  * 'y1'   : int Y end point
  * 'fill' : The fill style
  * 'line' : The line style
  * 'url'  : string [optional] Target URL
  *
  * @param array $params Parameter array
  *
  * @return void
  */
 function rectangle($params)
 {
     $x0 = min($this->_getX($params['x0']), $this->_getX($params['x1']));
     $y0 = min($this->_getY($params['y0']), $this->_getY($params['y1']));
     $x1 = max($this->_getX($params['x0']), $this->_getX($params['x1']));
     $y1 = max($this->_getY($params['y0']), $this->_getY($params['y1']));
     $fillColor = isset($params['fill']) ? $params['fill'] : false;
     $lineColor = isset($params['line']) ? $params['line'] : false;
     $fillColor = $this->_getFillStyle($fillColor);
     $lineColor = $this->_getLineStyle($lineColor);
     // use fill color if no line color is set or transparent
     if (count($lineColor) === 0) {
         $lineColor = $fillColor;
     }
     $shape = new SWFShape();
     $shape->setLine(1, $lineColor[0], $lineColor[1], $lineColor[2]);
     if (count($fillColor)) {
         $shape->setRightFill($fillColor[0], $fillColor[1], $fillColor[2]);
     }
     $shape->movePenTo($x0, $y0);
     $shape->drawLine($x1 - $x0, 0);
     $shape->drawLine(0, $y1 - $y0);
     $shape->drawLine($x0 - $x1, 0);
     $shape->drawLine(0, $y0 - $y1);
     if (isset($params['url'])) {
         $button = new SWFButton();
         $button->addShape($shape, SWFBUTTON_HIT | SWFBUTTON_UP | SWFBUTTON_DOWN | SWFBUTTON_OVER);
         $button->addAction(new SWFAction("getURL('{$params['url']}');"), SWFBUTTON_MOUSEUP);
         $this->_canvas->add($button);
     } else {
         $this->_canvas->add($shape);
     }
     parent::rectangle($params);
 }