Esempio n. 1
0
 /**
  * Render the image
  *
  * Render the image into the metioned file
  *
  * @param string $file Filename
  *
  * @return  void
  */
 public function render($file)
 {
     // Render image...
     $canvas = $this->_raytrace();
     // Write canvas to file
     $this->_image = imagecreatetruecolor($this->_size[0] * 2, $this->_size[1] * 2);
     $bg = $this->_getColor($this->_background);
     imagefill($this->_image, 1, 1, $bg);
     $x = 0;
     foreach ($canvas as $row) {
         $y = 0;
         foreach ($row as $pixel) {
             if (count($pixel)) {
                 $color = new Image_3D_Color();
                 $color->merge($pixel);
                 imagesetpixel($this->_image, $x, $y, $this->_getColor($color));
             }
             ++$y;
         }
         ++$x;
     }
     imagepng($this->_image, $file);
 }