class_PngImage.php

Go to the documentation of this file.
00001 <?php
00024 class PngImage extends BaseImage {
00030         protected function __construct () {
00031                 // Call parent constructor
00032                 parent::__construct(__CLASS__);
00033         }
00034 
00041         public final static function createPngImage(CompileableTemplate $templateInstance) {
00042                 // Get a new instance
00043                 $imageInstance = new PngImage();
00044 
00045                 // Set template instance
00046                 $imageInstance->setTemplateInstance($templateInstance);
00047 
00048                 // Set image type
00049                 $imageInstance->setImageType('png');
00050 
00051                 // Return the instance
00052                 return $imageInstance;
00053         }
00054 
00060         public function finishImage () {
00061                 // Call parent method
00062                 parent::finishImage();
00063 
00064                 // Get a file name for our image
00065                 $cacheFile = $this->getTemplateInstance()->getImageCacheFqfn();
00066 
00067                 // Does it exist?
00068                 if (file_exists($cacheFile)) {
00069                         // Remove it
00070                         @unlink($cacheFile);
00071                 } // END - if
00072 
00073                 // Finish the image and send it to a cache file
00074                 imagepng($this->getImageResource(), $cacheFile, 9, PNG_ALL_FILTERS);
00075         }
00076 }
00077 
00078 // [EOF]
00079 ?>

Generated on Mon Dec 8 01:06:46 2008 for Ship-Simulator by  doxygen 1.5.6