Beispiel #1
0
 /**
  * Rectangle [Construcor]
  *
  * @param int $x The leftmost pixel of the box on the canvas
  * @param int $y The topmost pixel of the box on the canvas
  * @param int $width The width in pixels of the box on the canvas
  * @param int $height The height in pixels of the box on the canvas
  */
 function Image_Graph_Figure_Rectangle($x, $y, $width, $height)
 {
     parent::Image_Graph_Element();
     $this->_setCoords($x, $y, $x + $width, $y + $height);
 }
Beispiel #2
0
 /**
  * Image_Graph [Constructor].
  *
  * If passing the 3 parameters they are defined as follows:'
  * 
  * Fx.:
  * 
  * $Graph =& new Image_Graph(400, 300);
  * 
  * or using the factory method:
  * 
  * $Graph =& Image_Graph::factory('graph', array(400, 300));
  * 
  * This causes a 'png' canvas to be created by default. 
  * 
  * Otherwise use a single parameter either as an associated array or passing
  * the canvas along to the constructor:
  *
  * 1) Create a new canvas with the following parameters:
  *
  * 'canvas' - The canvas type, can be any of 'gd', 'jpg', 'png' or 'svg'
  * (more to come) - if omitted the default is 'gd'
  *
  * 'width' - The width of the graph
  *
  * 'height' - The height of the graph
  * 
  * An example of this usage:
  * 
  * $Graph =& Image_Graph::factory('graph', array(array('width' => 400,
  * 'height' => 300, 'canvas' => 'jpg')));
  * 
  * NB! In thïs case remember the "double" array (see {@link Image_Graph::
  * factory()})
  * 
  * 2) Use the canvas specified, pass a valid Image_Canvas as
  * parameter. Remember to pass by reference, i. e. &$canvas, fx.:
  *
  * $Graph =& new Image_Graph($Canvas);
  *
  * or using the factory method:
  *
  * $Graph =& Image_Graph::factory('graph', $Canvas));
  *
  * @param mixed $params The width of the graph, an indexed array
  * describing a new canvas or a valid {@link Image_Canvas} object
  * @param int $height The height of the graph in pixels
  * @param bool $createTransparent Specifies whether the graph should be
  *   created with a transparent background (fx for PNG's - note: transparent
  *   PNG's is not supported by Internet Explorer!)
  */
 function Image_Graph($params, $height = false, $createTransparent = false)
 {
     parent::Image_Graph_Element();
     $this->setFont(Image_Graph::factory('Image_Graph_Font'));
     if (defined('IMAGE_GRAPH_DEFAULT_CANVAS_TYPE')) {
         $canvasType = IMAGE_GRAPH_DEFAULT_CANVAS_TYPE;
     } else {
         $canvasType = 'png';
         // use GD as default, if nothing else is specified
     }
     if (is_array($params)) {
         if (isset($params['canvas'])) {
             $canvasType = $params['canvas'];
         }
         $width = 0;
         $height = 0;
         if (isset($params['width'])) {
             $width = $params['width'];
         }
         if (isset($params['height'])) {
             $height = $params['height'];
         }
     } elseif (is_a($params, 'Image_Canvas')) {
         $this->_canvas =& $params;
         $width = $this->_canvas->getWidth();
         $height = $this->_canvas->getHeight();
     } elseif (is_numeric($params)) {
         $width = $params;
     }
     if ($this->_canvas == null) {
         include_once 'Image/Canvas.php';
         $this->_canvas =& Image_Canvas::factory($canvasType, array('width' => $width, 'height' => $height));
     }
     $this->_setCoords(0, 0, $width - 1, $height - 1);
 }
Beispiel #3
0
 /**
  * Ellipse [Constructor]
  *
  * @param int $x The center pixel of the ellipse on the canvas
  * @param int $y The center pixel of the ellipse on the canvas
  * @param int $radiusX The width in pixels of the box on the canvas
  * @param int $radiusY The height in pixels of the box on the canvas
  */
 function Image_Graph_Figure_Ellipse($x, $y, $radiusX, $radiusY)
 {
     parent::Image_Graph_Element();
     $this->_setCoords($x - $radiusX, $y - $radiusY, $x + $radiusX, $y + $radiusY);
 }
Beispiel #4
0
 /**
  * Logo [Constructor]
  *
  * @param string $filename The filename and path of the image to use for logo
  */
 function Image_Graph_Logo($filename, $alignment = IMAGE_GRAPH_ALIGN_TOP_RIGHT)
 {
     parent::Image_Graph_Element();
     $this->_filename = $filename;
     $this->_alignment = $alignment;
 }