當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PointInterface::in方法代碼示例

本文整理匯總了PHP中Imagine\Image\PointInterface::in方法的典型用法代碼示例。如果您正苦於以下問題:PHP PointInterface::in方法的具體用法?PHP PointInterface::in怎麽用?PHP PointInterface::in使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Imagine\Image\PointInterface的用法示例。


在下文中一共展示了PointInterface::in方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: crop

 /**
  * (non-PHPdoc)
  * @see Imagine\ImageInterface::crop()
  */
 public function crop(PointInterface $start, BoxInterface $size)
 {
     if (!$start->in($size)) {
         throw new OutOfBoundsException('Crop coordinates must start at minimum 0, 0 position from ' . 'top left corner, crop height and width must be positive ' . 'integers and must not exceed the current image borders');
     }
     try {
         $this->gmagick->cropimage($size->getWidth(), $size->getHeight(), $start->getX(), $start->getY());
     } catch (\GmagickException $e) {
         throw new RuntimeException('Crop operation failed', $e->getCode(), $e);
     }
     return $this;
 }
開發者ID:nicodmf,項目名稱:Imagine,代碼行數:16,代碼來源:Image.php

示例2: crop

 /**
  * {@inheritdoc}
  */
 public function crop(PointInterface $start, BoxInterface $size)
 {
     if (!$start->in($this->getSize())) {
         throw new OutOfBoundsException('Crop coordinates must start at minimum 0, 0 position from top left corner, crop height and width ' . 'must be positive integers and must not exceed the current image borders');
     }
     $this->fixViewBox();
     $svg = $this->document->documentElement;
     $svg->setAttribute('x', -$start->getX());
     $svg->setAttribute('y', -$start->getY());
     $svgWrap = $this->document->createElementNS('http://www.w3.org/2000/svg', 'svg');
     $svgWrap->setAttribute('version', '1.1');
     $svgWrap->setAttribute('width', $size->getWidth());
     $svgWrap->setAttribute('height', $size->getHeight());
     $svgWrap->appendChild($svg);
     $this->document->appendChild($svgWrap);
     return $this;
 }
開發者ID:contao,項目名稱:imagine-svg,代碼行數:20,代碼來源:Image.php

示例3: getColorAt

 /**
  * {@inheritdoc}
  */
 public function getColorAt(PointInterface $point)
 {
     if (!$point->in($this->getSize())) {
         throw new RuntimeException(sprintf('Error getting color at point [%s,%s]. The point must be inside the image of size [%s,%s]', $point->getX(), $point->getY(), $this->getSize()->getWidth(), $this->getSize()->getHeight()));
     }
     try {
         $pixel = $this->imagick->getImagePixelColor($point->getX(), $point->getY());
     } catch (\ImagickException $e) {
         throw new RuntimeException('Error while getting image pixel color', $e->getCode(), $e);
     }
     return $this->pixelToColor($pixel);
 }
開發者ID:scisahaha,項目名稱:generator-craft,代碼行數:15,代碼來源:Image.php

示例4: getColorAt

 /**
  * {@inheritdoc}
  */
 public function getColorAt(PointInterface $point)
 {
     if (!$point->in($this->getSize())) {
         throw new RuntimeException(sprintf('Error getting color at point [%s,%s]. The point must be inside the image of size [%s,%s]', $point->getX(), $point->getY(), $this->getSize()->getWidth(), $this->getSize()->getHeight()));
     }
     try {
         $cropped = clone $this->gmagick;
         $histogram = $cropped->cropImage(1, 1, $point->getX(), $point->getY())->getImageHistogram();
     } catch (\GmagickException $e) {
         throw new RuntimeException('Unable to get the pixel');
     }
     $pixel = array_shift($histogram);
     unset($histogram, $cropped);
     return $this->pixelToColor($pixel);
 }
開發者ID:luoshulin,項目名稱:falcon,代碼行數:18,代碼來源:Image.php

示例5: getColorAt

 /**
  * {@inheritdoc}
  */
 public function getColorAt(PointInterface $point)
 {
     if (!$point->in($this->getSize())) {
         throw new RuntimeException(sprintf('Error getting color at point [%s,%s]. The point must be inside the image of size [%s,%s]', $point->getX(), $point->getY(), $this->getSize()->getWidth(), $this->getSize()->getHeight()));
     }
     $pixel = $this->imagick->getImagePixelColor($point->getX(), $point->getY());
     return new Color(array($pixel->getColorValue(\Imagick::COLOR_RED) * 255, $pixel->getColorValue(\Imagick::COLOR_GREEN) * 255, $pixel->getColorValue(\Imagick::COLOR_BLUE) * 255), (int) round($pixel->getColorValue(\Imagick::COLOR_ALPHA) * 100));
 }
開發者ID:rachelleannmorales,項目名稱:aboitiz,代碼行數:11,代碼來源:Image.php

示例6: getColorAt

 /**
  * {@inheritdoc}
  */
 public function getColorAt(PointInterface $point)
 {
     if (!$point->in($this->getSize())) {
         throw new RuntimeException(sprintf('Error getting color at point [%s,%s]. The point must be inside the image of size [%s,%s]', $point->getX(), $point->getY(), $this->getSize()->getWidth(), $this->getSize()->getHeight()));
     }
     $index = imagecolorat($this->resource, $point->getX(), $point->getY());
     $info = imagecolorsforindex($this->resource, $index);
     return new Color(array($info['red'], $info['green'], $info['blue']), (int) round($info['alpha'] / 127 * 100));
 }
開發者ID:jewelhuq,項目名稱:fraym,代碼行數:12,代碼來源:Image.php

示例7: getColorAt

 /**
  * (non-PHPdoc)
  * @see Imagine\Image\ImageInterface::getColorAt()
  */
 public function getColorAt(PointInterface $point)
 {
     if (!$point->in($this->getSize())) {
         throw new RuntimeException(sprintf('Error getting color at point [%s,%s]. The point must be inside the image of size [%s,%s]', $point->getX(), $point->getY(), $this->getSize()->getWidth(), $this->getSize()->getHeight()));
     }
     throw new RuntimeException('Not Implemented!');
 }
開發者ID:SerdarSanri,項目名稱:laravel-imagine-bundle,代碼行數:11,代碼來源:Image.php


注:本文中的Imagine\Image\PointInterface::in方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。