Source for file Image.class.php
Documentation is available at Image.class.php 
 * This work is hereby released into the Public Domain.  
 * To view a copy of the public domain dedication,  
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to  
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.  
 * Register a class with the prefix in configuration file  
  eval ($abstract. " class ". ARTICHOW_PREFIX. $class. " extends aw". $class. " { }"); 
 * Register an interface with the prefix in configuration file  
require_once ARTICHOW. "/Component.class.php";  
require_once ARTICHOW. "/inc/Grid.class.php";  
require_once ARTICHOW. "/inc/Tools.class.php";  
require_once ARTICHOW. "/inc/Driver.class.php";  
require_once ARTICHOW. "/inc/Math.class.php";  
require_once ARTICHOW. "/inc/Tick.class.php";  
require_once ARTICHOW. "/inc/Axis.class.php";  
require_once ARTICHOW. "/inc/Legend.class.php";  
require_once ARTICHOW. "/inc/Mark.class.php";  
require_once ARTICHOW. "/inc/Label.class.php";  
require_once ARTICHOW. "/inc/Text.class.php";  
require_once ARTICHOW. "/inc/Color.class.php";  
require_once ARTICHOW. "/inc/Font.class.php";  
require_once ARTICHOW. "/inc/Gradient.class.php";  
require_once ARTICHOW. "/inc/Shadow.class.php";  
require_once ARTICHOW. "/inc/Border.class.php";  
require_once ARTICHOW. "/common.php";  
 * @package linea21.externals  
   * Get driver of the image  
   * @param int $w Driver width (from 0 to 1) (default to 1)  
   * @param int $h Driver height (from 0 to 1) (default to 1)  
   * @param float $x Position on X axis of the center of the driver (default to 0.5)  
   * @param float $y Position on Y axis of the center of the driver (default to 0.5)  
  function getDriver($w =  1, $h =  1, $x =  0.5, $y =  0.5) {  
    $this->driver->setSize($w, $h);  
    $this->driver->setPosition($x, $y);  
   * Sets the driver that will be used to draw the graph  
   * @param string $driverString   
   * @var int $width Image width  
   * @var int $height Image height  
  function setSize($width, $height) {  
      $this->width = (int) $width;  
   * Change image background  
   * @param mixed $background   
    if(is_a($background, 'awColor')) {  
    } elseif(is_a($background, 'awGradient')) {  
   * Change image background color  
   * Change image background gradient  
   * Return image background, whether a Color or a Gradient  
   * Turn antialiasing on or off  
   * Return the antialiasing setting  
   * @var int $format New image format  
   * Returns the image format as an integer  
   * Returns the image format as a string  
   * Select the correct driver  
   * @param string $driver The desired driver  
        require_once ARTICHOW. '/inc/drivers/gd.class.php';  
        // We should never get here, unless the wrong string is used AND the ARTICHOW_DRIVER  
        // global has been messed with.  
   * Draw a component on the image  
   * @var &$component A component  
    $shadow =  $this->shadow->getSpace(); // Image shadow  
    $border =  $this->border->visible() ?  1 :  0; // Image border size  
    $this->width -  $shadow->left -  $shadow->right -  $border *  2,  
    $this->height -  $shadow->top -  $shadow->bottom -  $border *  2  
    // No absolute size specified  
    if($component->w ===  NULL and $component->h ===  NULL) {  
      list ($width, $height) =  $driver->setSize($component->width, $component->height); 
      // Set component size in pixels  
      $component->setAbsSize($width, $height);  
      $driver->setAbsSize($component->w, $component->h);  
    if($component->top !==  NULL and $component->left !==  NULL) {  
      $border +  $shadow->left +  $component->left,  
      $border +  $shadow->top +  $component->top  
      $driver->setPosition($component->x, $component->y);  
    $driver->movePosition($border +  $shadow->left, $border +  $shadow->top);  
    list ($x1, $y1, $x2, $y2) =  $component->getPosition(); 
    $component->init($driver);  
    $component->drawComponent($driver, $x1, $y1, $x2, $y2, $this->antiAliasing);  
    $component->drawEnvelope($driver, $x1, $y1, $x2, $y2);  
    $component->finalize($driver);  
   * Send the image into a file or to the user browser  
   * Return the image content as binary data  
    return $this->driver->get($this);  
   * Send the correct HTTP header according to the image type  
   * Display an error image and exit  
   * @param string $message Error message  
    $message =  wordwrap($message, 40, "\n", TRUE);  
    $image->setSize($width, $height);  
    $driver =  $image->getDriver();  
    $driver->filledRectangle(  
    $driver->filledRectangle(  
    $driver->string($text, new awPoint(5, 6));  
    new awPoint($width -  90, $height -  1)  
    new awPoint($width -  81, $height -  81),  
    new awPoint($width -  1, $height -  1)  
    $driver->string($text, new awPoint(10, 40));  
   * Display an error image located in a file and exit  
   * @param string $error Error name  
    $file =  ARTICHOW_IMAGE. DIRECTORY_SEPARATOR. 'errors'. DIRECTORY_SEPARATOR. $error. '.png';  
    header("Content-Type: image/png");  
 * Load an image from a file  
 * @package linea21.externals  
   * @param string $file Image file name  
  function awFileImage($file) {  
    $driver->initFromFile($this, $file);  
 
 
        
       |