예제 #1
0
 /**
  * Create a new awimage
  */
 function create()
 {
     if ($this->resource === NULL) {
         // Create image
         $this->resource = imagecreatetruecolor($this->width, $this->height);
         if (!$this->resource) {
             trigger_error("Unable to create a graph", E_USER_ERROR);
         }
         imagealphablending($this->resource, TRUE);
         if ($this->antiAliasing and function_exists('imageantialias')) {
             imageantialias($this->resource, TRUE);
         }
         $this->drawer = new awDrawer($this->resource);
         $this->drawer->setImageSize($this->width, $this->height);
         // Original color
         $this->drawer->filledRectangle(new awWhite(), new awLine(new awPoint(0, 0), new awPoint($this->width, $this->height)));
         $shadow = $this->shadow->getSpace();
         $p1 = new awPoint($shadow->left, $shadow->top);
         $p2 = new awPoint($this->width - $shadow->right - 1, $this->height - $shadow->bottom - 1);
         // Draw image background
         $this->drawer->filledRectangle($this->background, new awLine($p1, $p2));
         $this->background->free();
         // Draw image border
         $this->border->rectangle($this->drawer, $p1, $p2);
     }
 }