Example #1
0
 protected function getValuesArea(Boundary $b)
 {
     $dy = $this->getD()->width;
     $dx = $this->getD()->height;
     $h = $this->axis['font_x']->getTextExtent($this->maxleg)->height;
     $dbottom = $b->bottom() - ($h < $dx * 4 ? $dx * 4 : $h);
     $dleft = $b->left() + $this->axis['font_y']->getTextExtent($this->max)->width + $dy * 2;
     $dtop = $b->top() + $this->depth;
     $dright = $b->right() + $this->depth;
     return new Boundary($dleft, $dtop, $dright, $dbottom);
 }
Example #2
0
 /**
  * Обрезает изображение
  * @param Boundary $s Границы области обрезки
  * @throws GDException 
  * @return GDImage
  */
 function crop(Boundary $s)
 {
     if (($r = @imagecreatetruecolor($s->width(), $s->height())) === FALSE) {
         throw new GDException('Невозможно инициализировать GD поток');
     }
     @imagealphablending($r, false);
     if (!@imagecopy($r, $this->handle, 0, 0, $s->left(), $s->top(), $s->width(), $s->height())) {
         @imagedestroy($r);
         throw new GDException("Не удалось растянуть изображение.");
     }
     @imagealphablending($r, true);
     @imagedestroy($this->handle);
     $this->handle = $r;
     return $this;
 }