当前位置: 首页>>代码示例>>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;未经允许,请勿转载。