home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Image / Graph / Figure / Ellipse.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  3.1 KB  |  97 lines

  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 Figure
  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: Ellipse.php,v 1.9 2005/08/24 20:36:00 nosey Exp $
  28.  * @link       http://pear.php.net/package/Image_Graph
  29.  */
  30.  
  31. /**
  32.  * Include file Image/Graph/Element.php
  33.  */
  34. require_once 'Image/Graph/Element.php';
  35.  
  36. /**
  37.  * Ellipse to draw on the canvas
  38.  *
  39.  * @category   Images
  40.  * @package    Image_Graph
  41.  * @subpackage Figure
  42.  * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
  43.  * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
  44.  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  45.  * @version    Release: 0.7.2
  46.  * @link       http://pear.php.net/package/Image_Graph
  47.  */
  48. class Image_Graph_Figure_Ellipse extends Image_Graph_Element
  49. {
  50.  
  51.     /**
  52.      * Ellipse [Constructor]
  53.      *
  54.      * @param int $x The center pixel of the ellipse on the canvas
  55.      * @param int $y The center pixel of the ellipse on the canvas
  56.      * @param int $radiusX The width in pixels of the box on the canvas
  57.      * @param int $radiusY The height in pixels of the box on the canvas
  58.      */
  59.     function Image_Graph_Figure_Ellipse($x, $y, $radiusX, $radiusY)
  60.     {
  61.         parent::Image_Graph_Element();
  62.         $this->_setCoords($x - $radiusX, $y - $radiusY, $x + $radiusX, $y + $radiusY);
  63.     }
  64.  
  65.     /**
  66.      * Output the ellipse
  67.      *
  68.      * @return bool Was the output 'good' (true) or 'bad' (false).
  69.      * @access private
  70.      */
  71.     function _done()
  72.     {
  73.         if (parent::_done() === false) {
  74.             return false;
  75.         }
  76.         
  77.         $this->_canvas->startGroup(get_class($this));
  78.  
  79.         $this->_getFillStyle();
  80.         $this->_getLineStyle();
  81.         $this->_canvas->ellipse(
  82.             array(
  83.                 'x' => ($this->_left + $this->_right) / 2,
  84.                 'y' => ($this->_top + $this->_bottom) / 2,
  85.                 'rx' => $this->width(),
  86.                 'ry' => $this->height()
  87.             )
  88.         );
  89.         
  90.         $this->_canvas->endGroup();
  91.         
  92.         return true;
  93.     }
  94.  
  95. }
  96.  
  97. ?>