Ejemplo n.º 1
0
 /**
  * Draw a line
  *
  * Parameter array:
  * 'x0': int X start point
  * 'y0': int Y start point
  * 'x1': int X end point
  * 'y1': int Y end point
  * 'end0': string [optional] The end type of end0 (the start)
  * 'end1': string [optional] The end type of end1 (the end)
  * 'size0': int [optional] The size of end0
  * 'size1': int [optional] The size of end1
  * 'color': mixed [optional] The line color
  * @param array $params Parameter array
  */
 function line($params)
 {
     $x0 = $this->_getX($params['x0']);
     $y0 = $this->_getY($params['y0']);
     $x1 = $this->_getX($params['x1']);
     $y1 = $this->_getY($params['y1']);
     if (isset($params['end0'])) {
         $angle = Image_Canvas_Tool::getAngle($x1, $y1, $x0, $y0);
         $this->drawEnd(array('end' => $params['end0'], 'x' => $params['x0'], 'y' => $params['y0'], 'angle' => $angle, 'color' => isset($params['color0']) ? $params['color0'] : false, 'size' => $params['size0']));
     }
     if (isset($params['end1'])) {
         $angle = Image_Canvas_Tool::getAngle($x0, $y0, $x1, $y1);
         //print "<pre>"; var_dump($params, $angle); print "</pre>";
         $this->drawEnd(array('end' => $params['end1'], 'x' => $params['x1'], 'y' => $params['y1'], 'angle' => $angle, 'color' => isset($params['color1']) ? $params['color1'] : false, 'size' => $params['size1']));
     }
     $this->_reset();
 }