Ejemplo n.º 1
0
 /**
  * @see	wcf\system\image\adapter\IImageAdapter::clip()
  */
 public function clip($originX, $originY, $width, $height)
 {
     // validate if coordinates and size are within bounds
     if ($originX < 0 || $originY < 0) {
         throw new SystemException("Clipping an image requires valid offsets, an offset below zero is invalid.");
     }
     if ($width <= 0 || $height <= 0) {
         throw new SystemException("Clipping an image requires valid dimensions, width or height below or equal zero are invalid.");
     }
     if ($originX + $width > $this->getWidth() || $originY + $height > $this->getHeight()) {
         throw new SystemException("Offset and dimension can not exceed image dimensions.");
     }
     $this->adapter->clip($originX, $originY, $width, $height);
 }