Example #1
0
 public function _strokeBackgroundImage()
 {
     if ($this->background_image == '') {
         return;
     }
     $bkgimg = Graph::LoadBkgImage('', $this->background_image);
     // Background width & Heoght
     $bw = imagesx($bkgimg);
     $bh = imagesy($bkgimg);
     // Canvas width and height
     $cw = imagesx($this->img);
     $ch = imagesy($this->img);
     if ($this->doshadow) {
         $cw -= $this->shadow_width;
         $ch -= $this->shadow_width;
     }
     if ($this->background_image_x === null || $this->background_image_y === null) {
         if ($this->background_image_center) {
             // Center original image in the plot area
             $x = round($cw / 2 - $bw / 2);
             $y = round($ch / 2 - $bh / 2);
         } else {
             // Just copy the image from left corner, no resizing
             $x = 0;
             $y = 0;
         }
     } else {
         $x = $this->background_image_x;
         $y = $this->background_image_y;
     }
     imagecopymerge($this->img, $bkgimg, $x, $y, 0, 0, $bw, $bh, $this->background_image_mix);
 }