Example #1
0
 /**
  * Renders the image
  * 
  * Starts rendering an image with given size into the given file.
  *
  * @param   integer     $x          Width
  * @param   integer     $y          Height
  * @param   string      $file       Filename
  * @return  boolean                 Success
  */
 public function render($x, $y, $file)
 {
     if ((is_file($file) || !is_writeable(dirname($file))) && (!is_file($file) || !is_writeable($file)) && !preg_match('/^\\s*php:\\/\\/(stdout|output)\\s*$/i', $file)) {
         // Hack because stdout is not writeable
         throw new Exception('Cannot write outputfile.');
     }
     $x = min(1280, max(0, (int) $x));
     $y = min(1280, max(0, (int) $y));
     $this->_renderer->setSize($x, $y);
     $this->_renderer->setBackgroundColor($this->_color);
     $this->_renderer->addObjects($this->_objects);
     $this->_renderer->addLights($this->_lights);
     $this->_renderer->setDriver($this->_driver);
     return $this->_renderer->render($file);
 }