TeeChartPHP
[ class tree: TeeChartPHP ] [ index: TeeChartPHP ] [ all elements ]

Source for file ImageExport.php

Documentation is available at ImageExport.php

  1. <?php
  2.  
  3.  /**
  4.  * ImageExport class
  5.  *
  6.  * Description:
  7.  *
  8.  * @author
  9.  * @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
  10.  * @version 1.0
  11.  * @package TeeChartPHP
  12.  * @subpackage exports
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16.  class ImageExport extends TeeBase /*implements ClipboardOwner*/ {
  17.  
  18.     private $jpegFormat;
  19.     private $gifFormat;
  20.     private $pngFormat;
  21.     private $wbmpFormat;
  22.     private $flexFormat;
  23.  
  24.     // Interceptors
  25.     function __get$property {
  26.       $method ="get{$property}";
  27.       if method_exists$this$method ) ) {
  28.         return $this->$method();
  29.       }
  30.     }
  31.  
  32.     function __set $property,$value {
  33.       $method ="set{$property}";
  34.       if method_exists$this$method ) ) {
  35.         return $this->$method($value);
  36.       }
  37.     }
  38.  
  39.     public function ImageExport($c{
  40.         parent::__construct($c);
  41.     }
  42.  
  43.     public function getJPEG({
  44.         if ($this->jpegFormat == null{
  45.             $this->jpegFormat new JPEGFormat($this->chart);
  46.         }
  47.         return $this->jpegFormat;
  48.     }
  49.  
  50.     public function getGIF({
  51.         if ($this->gifFormat == null{
  52.             $this->gifFormat new GIFFormat($this->chart);
  53.         }
  54.         return $this->gifFormat;
  55.     }
  56.  
  57.     public function getPNG({
  58.         if ($this->pngFormat == null{
  59.             $this->pngFormat new PNGFormat($this->chart);
  60.         }
  61.         return $this->pngFormat;
  62.     }
  63.  
  64.     public function getWBMP({
  65.         if ($this->wbmpFormat == null{
  66.             $this->wbmpFormat new WBMPFormat($this->chart);
  67.         }
  68.         return $this->wbmpFormat;
  69.     }
  70.  
  71.     public function getFlex({
  72.         if ($this->flexFormat == null{
  73.             $this->flexFormat new FlexFormat($this->chart);
  74.         }
  75.         return $this->flexFormat;
  76.     }
  77.  
  78.     /*
  79.     public function image($dimension) {
  80.         return $this->image($dimension->width, $dimension->height);
  81.     }
  82.     */
  83.  
  84.     public function image($width=-1$height=-1{
  85.  
  86.         if ($width == -1{
  87.             $width $this->chart->getWidth();
  88.  
  89.             if ($width <=0{
  90.                $width 400;
  91.             }
  92.         }
  93.         if ($height =-1{
  94.             $height $this->chart->getHeight();
  95.  
  96.             if ($height <=0{
  97.                $height 300;
  98.             }
  99.         }
  100.  
  101.         return $this->chart->getGraphics3D()->img;
  102.     }
  103.  
  104.  
  105.     public function lostOwnership($clipboard$contents{
  106.     }
  107.  
  108.  
  109.     public function copyToClipboard($width=-1$height=-1{
  110.         if ($width==-|| $height==-1{
  111.            $this->Toolkit->getDefaultToolkit()->getSystemClipboard()->setContents(new
  112.                 TransferImage($this->image($this->chart->getWidth(),  $this->chart->getHeight()))$this);
  113.         }
  114.         else
  115.         {
  116.            $this->Toolkit->getDefaultToolkit()->getSystemClipboard()->setContents(new
  117.                 TransferImage($this->image($width$height))$this);
  118.         }
  119.     }
  120.  
  121. }
  122.  
  123.  /**
  124.  * TransferImage class
  125.  *
  126.  * Description:
  127.  *
  128.  * @author
  129.  * @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
  130.  * @version 1.0
  131.  * @package TeeChartPHP
  132.  * @subpackage exports
  133.  * @link http://www.steema.com
  134.  */
  135.  
  136. class TransferImage /*implements Transferable*/ {
  137.  
  138.         private $image;
  139.  
  140.         public function TransferImage($img{
  141.             $this->image $img;
  142.         }
  143.  
  144.         public function /*DataFlavor[]*/ getTransferDataFlavors({
  145.             // TODO return new DataFlavor[] {$this->DataFlavor->imageFlavor};
  146.         }
  147.  
  148.         public function isDataFlavorSupported($flavor{
  149.             return $this->DataFlavor->imageFlavor->equals($flavor);
  150.         }
  151.  
  152.         public function /*Object*/ getTransferData($flavor/* tODO throws
  153.                                 UnsupportedFlavorException, IOException*/ {
  154.             if (!$this->isDataFlavorSupported($flavor)) {
  155.                 throw new UnsupportedFlavorException($flavor);
  156.             }
  157.             return $this->image;
  158.         }
  159. }
  160.  
  161. ?>

Documentation generated on Wed, 16 Jun 2010 12:06:25 +0200 by phpDocumentor 1.4.1