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

Source for file Drawing.php

Documentation is available at Drawing.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2009 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel_Shared
  23.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.6.5, 2009-01-05
  26.  */
  27.  
  28.  
  29. /**
  30.  * PHPExcel_Shared_Drawing
  31.  *
  32.  * @category   PHPExcel
  33.  * @package    PHPExcel_Shared
  34.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  35.  */
  36. {
  37.     /**
  38.      * Convert pixels to EMU
  39.      *
  40.      * @param     int $pValue    Value in pixels
  41.      * @return     int            Value in EMU
  42.      */
  43.     public static function pixelsToEMU($pValue 0{
  44.         return round($pValue 9525);
  45.     }
  46.     
  47.     /**
  48.      * Convert EMU to pixels
  49.      *
  50.      * @param     int $pValue    Value in EMU
  51.      * @return     int            Value in pixels
  52.      */
  53.     public static function EMUToPixels($pValue 0{
  54.         if ($pValue != 0{
  55.             return round($pValue 9525);
  56.         else {
  57.             return 0;
  58.         }
  59.     }
  60.     
  61.     /**
  62.      * Convert pixels to cell dimension
  63.      *
  64.      * @param     int $pValue    Value in pixels
  65.      * @return     int            Value in cell dimension
  66.      */
  67.     public static function pixelsToCellDimension($pValue 0{
  68.         return $pValue 12;
  69.     }
  70.     
  71.     /**
  72.      * Convert cell width to pixels
  73.      *
  74.      * @param     int $pValue    Value in cell dimension
  75.      * @return     int            Value in pixels
  76.      */
  77.     public static function cellDimensionToPixels($pValue 0{
  78.         if ($pValue != 0{
  79.             return $pValue 12;
  80.         else {
  81.             return 0;
  82.         }
  83.     }
  84.     
  85.     /**
  86.      * Convert pixels to points
  87.      *
  88.      * @param     int $pValue    Value in pixels
  89.      * @return     int            Value in points
  90.      */
  91.     public static function pixelsToPoints($pValue 0{
  92.         return $pValue 0.67777777;
  93.     }
  94.     
  95.     /**
  96.      * Convert points width to pixels
  97.      *
  98.      * @param     int $pValue    Value in points
  99.      * @return     int            Value in pixels
  100.      */
  101.     public static function pointsToPixels($pValue 0{
  102.         if ($pValue != 0{
  103.             return $pValue 1.333333333;
  104.         else {
  105.             return 0;
  106.         }
  107.     }
  108.  
  109.     /**
  110.      * Convert degrees to angle
  111.      *
  112.      * @param     int $pValue    Degrees
  113.      * @return     int            Angle
  114.      */
  115.     public static function degreesToAngle($pValue 0{
  116.         return (int)round($pValue 60000);
  117.     }
  118.     
  119.     /**
  120.      * Convert angle to degrees
  121.      *
  122.      * @param     int $pValue    Angle
  123.      * @return     int            Degrees
  124.      */
  125.     public static function angleToDegrees($pValue 0{
  126.         if ($pValue != 0{
  127.             return round($pValue 60000);
  128.         else {
  129.             return 0;
  130.         }
  131.     }
  132. }

Documentation generated on Mon, 05 Jan 2009 20:36:49 +0100 by phpDocumentor 1.4.1