mirror of
https://github.com/Intervention/image.git
synced 2025-08-12 00:43:59 +02:00
Merge branch 'next' into next-method-renaming
This commit is contained in:
@@ -219,6 +219,11 @@ abstract class AbstractImage implements ImageInterface
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ImageInterface::pickColors()
|
||||
*/
|
||||
public function pickColors(int $x, int $y): CollectionInterface
|
||||
{
|
||||
$colors = new Collection();
|
||||
|
@@ -78,15 +78,11 @@ class Image extends AbstractImage implements ImageInterface, IteratorAggregate
|
||||
return imagesy($this->frame()->getCore());
|
||||
}
|
||||
|
||||
public function pickColor(int $x, int $y, int $frame_key = 0): ?ColorInterface
|
||||
public function pickColor(int $x, int $y, int $frame_key = 0): ColorInterface
|
||||
{
|
||||
if ($frame = $this->frame($frame_key)) {
|
||||
return $this->integerToColor(
|
||||
imagecolorat($frame->getCore(), $x, $y)
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
return $this->integerToColor(
|
||||
imagecolorat($this->frame($frame_key)->getCore(), $x, $y)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -134,16 +134,17 @@ class Image extends AbstractImage implements ImageInterface, Iterator
|
||||
return $this->frame()->getCore()->getImageHeight();
|
||||
}
|
||||
|
||||
public function pickColor(int $x, int $y, int $frame_key = 0): ?ColorInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see ImageInterface::pickColor()
|
||||
*/
|
||||
public function pickColor(int $x, int $y, int $frame_key = 0): ColorInterface
|
||||
{
|
||||
if ($frame = $this->frame($frame_key)) {
|
||||
return $this->pixelToColor(
|
||||
$frame->getCore()->getImagePixelColor($x, $y),
|
||||
$this->getColorspace()
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
return $this->pixelToColor(
|
||||
$this->frame($frame_key)->getCore()->getImagePixelColor($x, $y),
|
||||
$this->getColorspace()
|
||||
);
|
||||
}
|
||||
|
||||
public function getColorspace(): ColorspaceInterface
|
||||
|
@@ -137,7 +137,23 @@ interface ImageInterface extends Traversable, Countable
|
||||
*/
|
||||
public function toPng(): EncodedImage;
|
||||
|
||||
public function pickColor(int $x, int $y, int $frame_key = 0): ?ColorInterface;
|
||||
/**
|
||||
* Return color of pixel at given position on given frame position
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @param int $frame_key
|
||||
* @return ColorInterface
|
||||
*/
|
||||
public function pickColor(int $x, int $y, int $frame_key = 0): ColorInterface;
|
||||
|
||||
/**
|
||||
* Return all colors of pixel at given position for all frames of image
|
||||
*
|
||||
* @param int $x
|
||||
* @param int $y
|
||||
* @return ColorInterface
|
||||
*/
|
||||
public function pickColors(int $x, int $y): CollectionInterface;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user