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
|
public function pickColors(int $x, int $y): CollectionInterface
|
||||||
{
|
{
|
||||||
$colors = new Collection();
|
$colors = new Collection();
|
||||||
|
@@ -78,15 +78,11 @@ class Image extends AbstractImage implements ImageInterface, IteratorAggregate
|
|||||||
return imagesy($this->frame()->getCore());
|
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(
|
||||||
return $this->integerToColor(
|
imagecolorat($this->frame($frame_key)->getCore(), $x, $y)
|
||||||
imagecolorat($frame->getCore(), $x, $y)
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -134,16 +134,17 @@ class Image extends AbstractImage implements ImageInterface, Iterator
|
|||||||
return $this->frame()->getCore()->getImageHeight();
|
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(
|
||||||
return $this->pixelToColor(
|
$this->frame($frame_key)->getCore()->getImagePixelColor($x, $y),
|
||||||
$frame->getCore()->getImagePixelColor($x, $y),
|
$this->getColorspace()
|
||||||
$this->getColorspace()
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColorspace(): ColorspaceInterface
|
public function getColorspace(): ColorspaceInterface
|
||||||
|
@@ -137,7 +137,23 @@ interface ImageInterface extends Traversable, Countable
|
|||||||
*/
|
*/
|
||||||
public function toPng(): EncodedImage;
|
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;
|
public function pickColors(int $x, int $y): CollectionInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user