Пример #1
0
 /**
  * Image_Graph_ImageFill [Constructor]
  * @param string $filename The filename and path of the image to use for filling 
  */
 function &Image_Graph_Fill_Image($fileName)
 {
     parent::__construct();
     if (file_exists($fileName)) {
         if (strtolower(substr($fileName, -4)) == ".png") {
             $this->_image = ImageCreateFromPNG($this->_fileName = $fileName);
         } else {
             $this->_image = ImageCreateFromJPEG($this->_fileName = $fileName);
         }
     } else {
         $this->_image = false;
     }
 }
Пример #2
0
 /**
  * Image_Graph_GradientFill [Constructor]
  *
  * @param int $direction The direction of the gradient
  * @param mixed $startColor The value of the starting color
  * @param mixed $endColor The value of the ending color
  */
 function Image_Graph_Fill_Gradient($direction, $startColor, $endColor)
 {
     parent::Image_Graph_Fill();
     $this->_direction = $direction;
     $this->_startColor = $startColor;
     $this->_endColor = $endColor;
 }
Пример #3
0
 /**
  * Image_Graph_ImageFill [Constructor]
  *
  * @param string $filename The filename and path of the image to use for filling
  */
 function Image_Graph_Fill_Image($filename)
 {
     parent::Image_Graph_Fill();
     $this->_filename = $filename;
 }
Пример #4
0
 /**
  * Return the fillstyle
  *
  * @return int A GD fillstyle
  * @access private
  */
 function _getFillStyle($ID = false)
 {
     if ($ID === false || !isset($this->_fillStyles[$ID])) {
         $ID = key($this->_fillStyles);
         if (!next($this->_fillStyles)) {
             reset($this->_fillStyles);
         }
     }
     $fillStyle =& $this->_fillStyles[$ID];
     if (is_object($fillStyle)) {
         return $fillStyle->_getFillStyle($ID);
     } elseif ($fillStyle !== null) {
         return $fillStyle;
     } else {
         return parent::_getFillStyle($ID);
     }
 }
Пример #5
0
 /**
  * Draw the ranges
  *
  * @access private
  */
 function _drawRange()
 {
     if ($this->_range) {
         $radius0 = $this->_radius * (1 - $this->_radiusPercent / 100);
         foreach ($this->_range as $range) {
             $angle1 = $this->_value2angle($range['min']);
             $angle2 = $this->_value2angle($range['max']);
             if (is_object($this->_rangeFillStyle)) {
                 $this->_canvas->setFill($this->_rangeFillStyle->_getFillStyle($range['id']));
             } elseif ($this->_rangeFillStyle != null) {
                 $this->_canvas->setFill($this->_rangeFillStyle);
             }
             $this->_getLineStyle();
             $this->_canvas->Pieslice(array('x' => $this->_centerX, 'y' => $this->_centerY, 'rx' => $this->_radius, 'ry' => $this->_radius, 'v1' => $angle1, 'v2' => $angle2, 'srx' => $radius0, 'sry' => $radius0));
         }
     }
 }
Пример #6
0
    /**
    * Return the fillstyle at positions X, Y 
    * @param int $x The X position
    * @param int $y The Y position
    * @param int $w The Width
    * @param int $h The Height
    * @return int A GD fillstyle 
    * @access private
    */
    function _getFillStyleAt($x, $y, $w, $h, $ID = false)
    {
        if (($ID === false) and (!(list ($ID, $fillStyle) = each($this->_fillStyles)))) {
            reset($this->_fillStyles);
            list ($ID, $fillStyle) = each($this->_fillStyles);
        }
        $fillStyle = & $this->_fillStyles[$ID];

        if ($fillStyle != null) {
            if (is_numeric($fillStyle)) {
                return $this->_color($fillStyle);
            }
            elseif (is_a($fillStyle, "Image_Graph_Color")) {
                return $fillStyle->_index;
            } else {
                return $fillStyle->_getFillStyleAt($x, $y, $w, $h, $ID);
            }
        } else {
            return parent::_getFillStyle($ID);
        }
    }
Пример #7
0
 /**
  * Image_Graph_ImageFill [Constructor]
  *
  * @param string $filename The filename and path of the image to use for filling
  */
 function Image_Graph_Fill_Image($filename)
 {
     parent::__construct();
     $this->_filename = $filename;
 }
Пример #8
0
 /**
  * Image_Graph_GradientFill [Constructor]
  *
  * @param int $direction The direction of the gradient
  * @param mixed $startColor The value of the starting color
  * @param mixed $endColor The value of the ending color
  */
 function __construct($direction, $startColor, $endColor)
 {
     parent::__construct();
     $this->_direction = $direction;
     $this->_startColor = $startColor;
     $this->_endColor = $endColor;
 }
Пример #9
0
 /**
  * Image_Graph_ImageFill [Constructor]
  *
  * @param string $filename The filename and path of the image to use for filling
  */
 function __construct($filename)
 {
     parent::__construct();
     $this->_filename = $filename;
 }