Source for file Shadow.class.php
Documentation is available at Shadow.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.  
 * @package linea21.externals  
require_once dirname(__FILE__ ). "/../Graph.class.php";  
define("SHADOW_LEFT_BOTTOM", 2);  
define("SHADOW_RIGHT_TOP", 3);  
define("SHADOW_RIGHT_BOTTOM", 4);  
   * Shadow on left and top sides  
   * Shadow on left and bottom sides  
   * Shadow on right and top sides  
   * Shadow on right and bottom sides  
   * @param int $position Shadow position  
  public function hide($hide =  TRUE) {  
    $this->hide = (bool) $hide;  
  public function show($show =  TRUE) {  
    $this->hide = (bool) !$show;  
   * @param bool $smooth Smooth the shadow (facultative argument)  
  public function setSize($size, $smooth =  NULL) {  
    $this->size = (int) $size;  
  public function setColor(awColor $color) {  
    $this->position = (int) $position;  
  public function smooth($smooth) {  
    $this->smooth = (bool) $smooth;  
   * Get the space taken by the shadow  
    ($this->position ===  awShadow::LEFT_TOP or $this->position ===  awShadow::LEFT_BOTTOM) ?  $this->size :  0,  
    ($this->position ===  awShadow::RIGHT_TOP or $this->position ===  awShadow::RIGHT_BOTTOM) ?  $this->size :  0,  
    ($this->position ===  awShadow::LEFT_TOP or $this->position ===  awShadow::RIGHT_TOP) ?  $this->size :  0,  
    ($this->position ===  awShadow::LEFT_BOTTOM or $this->position ===  awShadow::RIGHT_BOTTOM) ?  $this->size :  0  
   * @param awDriver $driver   
   * @param awPoint $p1 Top-left point  
   * @param awPoint $p2 Right-bottom point  
   * @param int Drawing mode  
  public function draw(awDriver $driver, awPoint $p1, awPoint $p2, $mode) {  
    $color =  ($this->color instanceof  awColor) ?  $this->color :  new awColor(125, 125, 125);  
    switch($this->position) {  
          $t2 =  $p2->move($this->size +  1, $this->size +  1);  
        } else { // PHP 4 compatibility  
        $width =  $t2->x -  $t1->x;  
        $height =  $t2->y -  $t1->y;  
        $driver->setAbsPosition($t1->x +  $driver->x, $t1->y +  $driver->y);  
        $driver->filledRectangle(  
        new awPoint($width -  $this->size, $this->size),  
        new awPoint($width -  1, $height -  1)  
        $driver->filledRectangle(  
        new awPoint($this->size, $height -  $this->size),  
        new awPoint($width -  $this->size -  1, $height -  1)  
        $this->smoothPast($driver, $color, $width, $height);  
          $t1 =  $p1->move(-  $this->size, -  $this->size);  
        } else { // PHP 4 compatibility  
        $width =  $t2->x -  $t1->x;  
        $height =  $t2->y -  $t1->y;  
        $driver->setAbsPosition($t1->x +  $driver->x, $t1->y +  $driver->y);  
        $height =  max($height +  1, $this->size);  
        $driver->filledRectangle(  
        new awPoint($this->size -  1, $height -  $this->size -  1)  
        $driver->filledRectangle(  
        new awPoint($width -  $this->size -  1, $this->size -  1)  
        $this->smoothPast($driver, $color, $width, $height);  
          $t1 =  $p1->move(0, -  $this->size);  
          $t2 =  $p2->move($this->size +  1, 0);  
        } else { // PHP 4 compatibility  
        $width =  $t2->x -  $t1->x;  
        $height =  $t2->y -  $t1->y;  
        $driver->setAbsPosition($t1->x +  $driver->x, $t1->y +  $driver->y);  
        $height =  max($height +  1, $this->size);  
        $driver->filledRectangle(  
        new awPoint($width -  $this->size, 0),  
        new awPoint($width -  1, $height -  $this->size -  1)  
        $driver->filledRectangle(  
        new awPoint($width -  $this->size -  1, $this->size -  1)  
        $this->smoothFuture($driver, $color, $width, $height);  
          $t1 =  $p1->move(-  $this->size, 0);  
          $t2 =  $p2->move(0, $this->size +  1);  
        } else { // PHP 4 compatibility  
        $width =  $t2->x -  $t1->x;  
        $height =  $t2->y -  $t1->y;  
        $driver->setAbsPosition($t1->x +  $driver->x, $t1->y +  $driver->y);  
        $driver->filledRectangle(  
        new awPoint($this->size -  1, $height -  1)  
        $driver->filledRectangle(  
        new awPoint($this->size, $height -  $this->size),  
        new awPoint($width -  $this->size -  1, $height -  1)  
        $this->smoothFuture($driver, $color, $width, $height);  
  private function smoothPast(awDriver $driver, awColor $color, $width, $height) {  
      for($i =  0; $i <  $this->size; $i++ ) {  
        for($j =  0; $j <=  $i; $j++ ) {  
          new awPoint($i, $j +  $height -  $this->size)  
      for($i =  0; $i <  $this->size; $i++ ) {  
        for($j =  0; $j <=  $i; $j++ ) {  
          new awPoint($width -  $this->size +  $j, $i)  
  private function smoothFuture(awDriver $driver, awColor $color, $width, $height) {  
      for($i =  0; $i <  $this->size; $i++ ) {  
        for($j =  0; $j <=  $i; $j++ ) {  
          new awPoint($i, $this->size -  $j -  1)  
      for($i =  0; $i <  $this->size; $i++ ) {  
        for($j =  0; $j <=  $i; $j++ ) {  
          new awPoint($width -  $this->size +  $j, $height -  $i -  1)  
 
 
        
       |