本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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!');
}