コード例 #1
0
ファイル: Imagick.php プロジェクト: jubinpatel/horde
 /**
  * Request a specific image from the collection of images.
  *
  * @param integer $index  The index to return
  *
  * @return Horde_Image_Base
  */
 public function getImageAtIndex($index)
 {
     if ($index >= $this->_imagick->getNumberImages()) {
         throw Horde_Image_Exception('Image index out of bounds.');
     }
     $currentIndex = $this->_imagick->getIteratorIndex();
     $this->_imagick->setIteratorIndex($index);
     $image = $this->current();
     $this->_imagick->setIteratorIndex($currentIndex);
     return $image;
 }
コード例 #2
0
ファイル: Imagick.php プロジェクト: raz0rsdge/horde
 /**
  * Draws a line.
  *
  * @param integer $x0    The x coordinate of the start.
  * @param integer $y0    The y coordinate of the start.
  * @param integer $x1    The x coordinate of the end.
  * @param integer $y1    The y coordinate of the end.
  * @param string $color  The line color.
  * @param string $width  The width of the line.
  */
 public function line($x0, $y0, $x1, $y1, $color = 'black', $width = 1)
 {
     try {
         $draw = new ImagickDraw();
         $draw->setStrokeColor(new ImagickPixel($color));
         $draw->setStrokeWidth($width);
         $draw->line($x0, $y0, $x1, $y1);
     } catch (ImagickDrawException $e) {
         throw new Horde_Image_Exception($e);
     } catch (ImagickPixelException $e) {
         throw new Horde_Image_Exception($e);
     }
     try {
         $this->_imagick->drawImage($draw);
     } catch (ImagickException $e) {
         throw Horde_Image_Exception($e);
     }
     $draw->destroy();
 }