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

Source for file ImageUtils.php

Documentation is available at ImageUtils.php

  1. <?php
  2.  
  3. /**
  4.  * ImageUtils class
  5.  *
  6.  * Description: Chart utility procedures
  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 misc
  13.  * @link http://www.steema.com
  14.  */
  15.  
  16. class ImageUtils {
  17.  
  18.     // Interceptors
  19.     function __get$property {
  20.       $method ="get{$property}";
  21.       if method_exists$this$method ) ) {
  22.         return $this->$method();
  23.       }
  24.     }
  25.  
  26.     function __set $property,$value {
  27.       $method ="set{$property}";
  28.       if method_exists$this$method ) ) {
  29.         return $this->$method($value);
  30.       }
  31.     }
  32.  
  33.     /**
  34.      * Returns a newly created image using contents read from stream.
  35.      * Might return a null image if the boolean flag cannot be read.
  36.      *
  37.      * @param stream ObjectInputStream
  38.      * @return Image 
  39.      * @throws IOException
  40.      * @throws ClassNotFoundException
  41.      */
  42.  /*   public static Image readImage(ObjectInputStream stream) throws
  43.             IOException, ClassNotFoundException {
  44.         if (stream.readBoolean()) {
  45.             Dimension dim = (Dimension) stream.readObject();
  46.  
  47.             int[] pix = (int[]) stream.readObject();
  48.  
  49.             return Toolkit.getDefaultToolkit().createImage(
  50.                     new MemoryImageSource(dim.width, dim.height,
  51.                                           pix, 0, dim.width));
  52.         } else {
  53.             return null;
  54.         }
  55.     }
  56. */
  57.     /**
  58.      * Stores an image contents to stream.
  59.      *
  60.      * @param stream ObjectOutputStream
  61.      * @param image Image
  62.      */
  63. /*    public static function writeImage(ObjectOutputStream stream, Image image, IGraphics3D g)  throws
  64.             IOException {
  65.         if (image == null) {
  66.             stream.writeBoolean(false);
  67.         } else {
  68.             stream.writeBoolean(true);
  69.  
  70.             stream.writeObject(new Dimension(image.getWidth(null), image.getHeight(null)));
  71.             stream.writeObject(g.getImagePixels(image));
  72.         }
  73.     }
  74. */
  75.     public static function getImage($imagefile$c{
  76.         //Toolkit toolkit = Toolkit.getDefaultToolkit();
  77.         //Image image = toolkit.createImage(imagefile);
  78.         //waitForImage(image, c);
  79.  
  80.         $image imagecreatefrompng($imagefile);
  81.  
  82. /*        imagesavealpha($image, true);
  83.         $trans_colour = imagecolorallocatealpha($image, 0, 0, 0, 127);
  84.         imagefill($image, 0, 0, $trans_colour);
  85.         imagealphablending($image, TRUE);
  86.         imagealphablending($image, TRUE);
  87.  
  88.         $trnprt_indx = imagecolortransparent($image);
  89.         imagecolortransparent($image, $trnprt_indx);
  90. */
  91.         return $image;
  92.     }
  93.  
  94. /*    public static Image getImage(URL imageURL, Component c) {
  95.         Toolkit toolkit = Toolkit.getDefaultToolkit();
  96.         Image image = toolkit.createImage(imageURL);
  97.         waitForImage(image, c);
  98.         return image;
  99.     }
  100.  
  101.     public static boolean waitForImage(Image image, Component c) {
  102.         MediaTracker tracker = new MediaTracker(c);
  103.         tracker.addImage(image, 0);
  104.         try {
  105.             tracker.waitForID(0);
  106.         } catch(InterruptedException ie) {
  107.             System.out.println("loading interrupted");
  108.         }
  109.         return (!tracker.isErrorAny());
  110.     }*/
  111. }
  112.  
  113. ?>

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