[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Image/Graph/Fill/ -> Gradient.php (source)

   1  <?php
   2  
   3  /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
   4  
   5  /**
   6   * Image_Graph - PEAR PHP OO Graph Rendering Utility.
   7   *
   8   * PHP versions 4 and 5
   9   *
  10   * LICENSE: This library is free software; you can redistribute it and/or modify
  11   * it under the terms of the GNU Lesser General Public License as published by
  12   * the Free Software Foundation; either version 2.1 of the License, or (at your
  13   * option) any later version. This library is distributed in the hope that it
  14   * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  15   * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
  16   * General Public License for more details. You should have received a copy of
  17   * the GNU Lesser General Public License along with this library; if not, write
  18   * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  19   * 02111-1307 USA
  20   *
  21   * @category   Images
  22   * @package    Image_Graph
  23   * @subpackage Fill
  24   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  25   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  26   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  27   * @version    CVS: $Id: Gradient.php,v 1.15 2005/08/24 20:36:03 nosey Exp $
  28   * @link       http://pear.php.net/package/Image_Graph
  29   */
  30  
  31  /**
  32   * Include file Image/Graph/Fill/Image.php
  33   */
  34  require_once  'Image/Graph/Fill/Image.php';
  35  
  36  /**
  37   * Fill using a gradient color.
  38   * This creates a scaled fillstyle with colors flowing gradiently between 2
  39   * specified RGB values. Several directions are supported:
  40   *
  41   * 1 Vertically (IMAGE_GRAPH_GRAD_VERTICAL)
  42   *
  43   * 2 Horizontally (IMAGE_GRAPH_GRAD_HORIZONTAL)
  44   *
  45   * 3 Mirrored vertically (the color grades from a- b-a vertically)
  46   * (IMAGE_GRAPH_GRAD_VERTICAL_MIRRORED)
  47   *
  48   * 4 Mirrored horizontally (the color grades from a-b-a horizontally)
  49   * IMAGE_GRAPH_GRAD_HORIZONTAL_MIRRORED
  50   *
  51   * 5 Diagonally from top-left to right-bottom
  52   * (IMAGE_GRAPH_GRAD_DIAGONALLY_TL_BR)
  53   *
  54   * 6 Diagonally from bottom-left to top-right
  55   * (IMAGE_GRAPH_GRAD_DIAGONALLY_BL_TR)
  56   *
  57   * 7 Radially (concentric circles in the center) (IMAGE_GRAPH_GRAD_RADIAL)
  58   *
  59   * @category   Images
  60   * @package    Image_Graph
  61   * @subpackage Fill
  62   * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  63   * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  64   * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  65   * @version    Release: 0.7.2
  66   * @link       http://pear.php.net/package/Image_Graph
  67   */
  68  class Image_Graph_Fill_Gradient extends Image_Graph_Fill //Image_Graph_Fill_Image
  69  {
  70  
  71      /**
  72       * The direction of the gradient
  73       * @var int
  74       * @access private
  75       */
  76      var $_direction;
  77  
  78      /**
  79       * The first color to gradient
  80       * @var mixed
  81       * @access private
  82       */
  83      var $_startColor;
  84  
  85      /**
  86       * The last color to gradient
  87       * @var mixed
  88       * @access private
  89       */
  90      var $_endColor;
  91  
  92      /**
  93       * Image_Graph_GradientFill [Constructor]
  94       *
  95       * @param int $direction The direction of the gradient
  96       * @param mixed $startColor The value of the starting color
  97       * @param mixed $endColor The value of the ending color
  98       */
  99      function Image_Graph_Fill_Gradient($direction, $startColor, $endColor)
 100      {
 101          parent::Image_Graph_Fill();
 102          $this->_direction = $direction;
 103          $this->_startColor = $startColor;
 104          $this->_endColor = $endColor;
 105      }
 106  
 107      /**
 108       * Return the fillstyle
 109       *
 110       * @return int A GD fillstyle
 111       * @access private
 112       */
 113      function _getFillStyle($ID = false)
 114      {
 115          switch ($this->_direction) {
 116              case IMAGE_GRAPH_GRAD_HORIZONTAL:
 117                  $direction = 'horizontal';
 118                  break;
 119              case IMAGE_GRAPH_GRAD_VERTICAL:
 120                  $direction = 'vertical';
 121                  break;
 122              case IMAGE_GRAPH_GRAD_HORIZONTAL_MIRRORED:
 123                  $direction = 'horizontal_mirror';
 124                  break;
 125              case IMAGE_GRAPH_GRAD_VERTICAL_MIRRORED:
 126                  $direction = 'vertical_mirror';
 127                  break;
 128              case IMAGE_GRAPH_GRAD_DIAGONALLY_TL_BR:
 129                  $direction = 'diagonal_tl_br';
 130                  break;
 131              case IMAGE_GRAPH_GRAD_DIAGONALLY_BL_TR:
 132                  $direction = 'diagonal_bl_tr';
 133                  break;
 134              case IMAGE_GRAPH_GRAD_RADIAL:
 135                  $direction = 'radial';
 136                  break;
 137          }
 138          
 139          return array(
 140              'type' => 'gradient',
 141              'start' => $this->_startColor,
 142              'end' => $this->_endColor,
 143              'direction' => $direction
 144          );
 145      }
 146  
 147  }
 148  
 149  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7