diff --git a/src/Drivers/Abstract/AbstractImage.php b/src/Drivers/Abstract/AbstractImage.php index cc3ac4883..3b46865fa 100644 --- a/src/Drivers/Abstract/AbstractImage.php +++ b/src/Drivers/Abstract/AbstractImage.php @@ -217,11 +217,11 @@ public function sharpen(int $amount = 10): ImageInterface ); } - public function getColors(int $x, int $y): CollectionInterface + public function pickColors(int $x, int $y): CollectionInterface { $colors = new Collection(); foreach ($this as $key => $frame) { - $colors->push($this->getColor($x, $y, $key)); + $colors->push($this->pickColor($x, $y, $key)); } return $colors; diff --git a/src/Drivers/Gd/Image.php b/src/Drivers/Gd/Image.php index 52a29f1ca..ad9b3754d 100644 --- a/src/Drivers/Gd/Image.php +++ b/src/Drivers/Gd/Image.php @@ -66,7 +66,7 @@ public function getHeight(): int return imagesy($this->getFrame()->getCore()); } - public function getColor(int $x, int $y, int $frame_key = 0): ?ColorInterface + public function pickColor(int $x, int $y, int $frame_key = 0): ?ColorInterface { if ($frame = $this->getFrame($frame_key)) { return new Color(imagecolorat($frame->getCore(), $x, $y)); diff --git a/src/Drivers/Imagick/Image.php b/src/Drivers/Imagick/Image.php index 0ef864e63..4dc8ca6a5 100644 --- a/src/Drivers/Imagick/Image.php +++ b/src/Drivers/Imagick/Image.php @@ -121,7 +121,7 @@ public function getHeight(): int return $this->getFrame()->getCore()->getImageHeight(); } - public function getColor(int $x, int $y, int $frame_key = 0): ?ColorInterface + public function pickColor(int $x, int $y, int $frame_key = 0): ?ColorInterface { if ($frame = $this->getFrame($frame_key)) { return new Color($frame->getCore()->getImagePixelColor($x, $y)); diff --git a/src/Interfaces/ImageInterface.php b/src/Interfaces/ImageInterface.php index 6020f963a..45b257db5 100644 --- a/src/Interfaces/ImageInterface.php +++ b/src/Interfaces/ImageInterface.php @@ -3,6 +3,7 @@ namespace Intervention\Image\Interfaces; use Countable; +use Intervention\Image\Collection; use Intervention\Image\EncodedImage; use Traversable; @@ -137,26 +138,8 @@ public function toAvif(): EncodedImage; */ public function toPng(): EncodedImage; - /** - * Return color of pixel at the given position of the image - * For animated image pass the key of the animation frame. - * - * @param int $x - * @param int $y - * @param int $frame_key - * @return null|ColorInterface - */ - public function getColor(int $x, int $y, int $frame_key = 0): ?ColorInterface; - - /** - * Return a collection with the color of the pixel at the given position - * For animated images all pixel colors for all frames are returned. - * - * @param int $x - * @param int $y - * @return CollectionInterface - */ - public function getColors(int $x, int $y): CollectionInterface; + public function pickColor(int $x, int $y, int $frame_key = 0): ?ColorInterface; + public function pickColors(int $x, int $y): CollectionInterface; /** * Draw text on image diff --git a/tests/Drivers/Abstract/AbstractImageTest.php b/tests/Drivers/Abstract/AbstractImageTest.php index 54092d3fc..e4f64cd29 100644 --- a/tests/Drivers/Abstract/AbstractImageTest.php +++ b/tests/Drivers/Abstract/AbstractImageTest.php @@ -297,12 +297,12 @@ public function testSharpen(): void $this->assertInstanceOf(ImageInterface::class, $result); } - public function testGetColors(): void + public function testPickColors(): void { $color = Mockery::mock(ColorInterface::class); $img = $this->abstractImageMock(); - $img->shouldReceive('getColor')->times(3)->andReturn($color); - $result = $img->getColors(1, 2); + $img->shouldReceive('pickColor')->times(3)->andReturn($color); + $result = $img->pickColors(1, 2); $this->assertInstanceOf(Collection::class, $result); } diff --git a/tests/Drivers/Gd/ImageTest.php b/tests/Drivers/Gd/ImageTest.php index 07cc42335..927450fd2 100644 --- a/tests/Drivers/Gd/ImageTest.php +++ b/tests/Drivers/Gd/ImageTest.php @@ -92,33 +92,33 @@ public function testGetSize(): void $this->assertInstanceOf(Rectangle::class, $this->image->getSize()); } - public function testGetColor(): void + public function testPickColor(): void { - $color = $this->image->getColor(0, 0); + $color = $this->image->pickColor(0, 0); $this->assertInstanceOf(Color::class, $color); $this->assertEquals(255, $color->red()); $this->assertEquals(0, $color->green()); $this->assertEquals(0, $color->blue()); - $color = $this->image->getColor(0, 0, 1); + $color = $this->image->pickColor(0, 0, 1); $this->assertInstanceOf(Color::class, $color); $this->assertEquals(0, $color->red()); $this->assertEquals(255, $color->green()); $this->assertEquals(0, $color->blue()); - $color = $this->image->getColor(0, 0, 2); + $color = $this->image->pickColor(0, 0, 2); $this->assertInstanceOf(Color::class, $color); $this->assertEquals(0, $color->red()); $this->assertEquals(0, $color->green()); $this->assertEquals(255, $color->blue()); - $color = $this->image->getColor(0, 0, 3); + $color = $this->image->pickColor(0, 0, 3); $this->assertNull($color); } - public function testGetColors(): void + public function testPickColors(): void { - $colors = $this->image->getColors(0, 0); + $colors = $this->image->pickColors(0, 0); $this->assertInstanceOf(Collection::class, $colors); $this->assertCount(3, $colors); diff --git a/tests/Drivers/Gd/Modifiers/BlurModifierTest.php b/tests/Drivers/Gd/Modifiers/BlurModifierTest.php index 237868c6b..5fa2328a1 100644 --- a/tests/Drivers/Gd/Modifiers/BlurModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/BlurModifierTest.php @@ -17,8 +17,8 @@ class BlurModifierTest extends TestCase public function testColorChange(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new BlurModifier(30)); - $this->assertEquals('4fa68d', $image->getColor(14, 14)->toHex()); + $this->assertEquals('4fa68d', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/BrightnessModifierTest.php b/tests/Drivers/Gd/Modifiers/BrightnessModifierTest.php index 3879a0054..243129789 100644 --- a/tests/Drivers/Gd/Modifiers/BrightnessModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/BrightnessModifierTest.php @@ -17,8 +17,8 @@ class BrightnessModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new BrightnessModifier(30)); - $this->assertEquals('4cfaff', $image->getColor(14, 14)->toHex()); + $this->assertEquals('4cfaff', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/ContrastModifierTest.php b/tests/Drivers/Gd/Modifiers/ContrastModifierTest.php index 74059c1b6..66afbf577 100644 --- a/tests/Drivers/Gd/Modifiers/ContrastModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/ContrastModifierTest.php @@ -17,8 +17,8 @@ class ContrastModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new ContrastModifier(30)); - $this->assertEquals('00ceff', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00ceff', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/DrawEllipseModiferTest.php b/tests/Drivers/Gd/Modifiers/DrawEllipseModiferTest.php index a9dfa0bd3..1c95cd3c6 100644 --- a/tests/Drivers/Gd/Modifiers/DrawEllipseModiferTest.php +++ b/tests/Drivers/Gd/Modifiers/DrawEllipseModiferTest.php @@ -19,10 +19,10 @@ class DrawEllipseModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $drawable = new Ellipse(10, 10); $drawable->background('b53717'); $image->modify(new DrawEllipseModifier(new Point(14, 14), $drawable)); - $this->assertEquals('b53717', $image->getColor(14, 14)->toHex()); + $this->assertEquals('b53717', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/DrawLineModiferTest.php b/tests/Drivers/Gd/Modifiers/DrawLineModiferTest.php index 392db16f6..e726f3117 100644 --- a/tests/Drivers/Gd/Modifiers/DrawLineModiferTest.php +++ b/tests/Drivers/Gd/Modifiers/DrawLineModiferTest.php @@ -19,10 +19,10 @@ class DrawLineModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $line = new Line(new Point(0, 0), new Point(10, 0), 4); $line->background('b53517'); $image->modify(new DrawLineModifier(new Point(0, 0), $line)); - $this->assertEquals('b53517', $image->getColor(0, 0)->toHex()); + $this->assertEquals('b53517', $image->pickColor(0, 0)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/DrawPixelModifierTest.php b/tests/Drivers/Gd/Modifiers/DrawPixelModifierTest.php index 04c44096d..e6ef8f5d0 100644 --- a/tests/Drivers/Gd/Modifiers/DrawPixelModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/DrawPixelModifierTest.php @@ -18,8 +18,8 @@ class DrawPixelModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new DrawPixelModifier(new Point(14, 14), 'ffffff')); - $this->assertEquals('ffffff', $image->getColor(14, 14)->toHex()); + $this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/DrawPolygonModifierTest.php b/tests/Drivers/Gd/Modifiers/DrawPolygonModifierTest.php index eaf7663af..1b62a24ae 100644 --- a/tests/Drivers/Gd/Modifiers/DrawPolygonModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/DrawPolygonModifierTest.php @@ -19,10 +19,10 @@ class DrawPolygonModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]); $drawable->background('b53717'); $image->modify(new DrawPolygonModifier($drawable)); - $this->assertEquals('b53717', $image->getColor(14, 14)->toHex()); + $this->assertEquals('b53717', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/DrawRectangleModifierTest.php b/tests/Drivers/Gd/Modifiers/DrawRectangleModifierTest.php index f5b2d1b6d..2368c6ee5 100644 --- a/tests/Drivers/Gd/Modifiers/DrawRectangleModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/DrawRectangleModifierTest.php @@ -19,10 +19,10 @@ class DrawRectangleModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $rectangle = new Rectangle(300, 200); $rectangle->background('ffffff'); $image->modify(new DrawRectangleModifier(new Point(14, 14), $rectangle)); - $this->assertEquals('ffffff', $image->getColor(14, 14)->toHex()); + $this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/FillModifierTest.php b/tests/Drivers/Gd/Modifiers/FillModifierTest.php index f2263ad98..380b746a5 100644 --- a/tests/Drivers/Gd/Modifiers/FillModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/FillModifierTest.php @@ -19,20 +19,20 @@ class FillModifierTest extends TestCase public function testFloodFillColor(): void { $image = $this->createTestImage('blocks.png'); - $this->assertEquals('0000ff', $image->getColor(420, 270)->toHex()); - $this->assertEquals('ff0000', $image->getColor(540, 400)->toHex()); + $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); + $this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex()); $image->modify(new FillModifier(new Color(13421772), new Point(540, 400))); - $this->assertEquals('0000ff', $image->getColor(420, 270)->toHex()); - $this->assertEquals('cccccc', $image->getColor(540, 400)->toHex()); + $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); + $this->assertEquals('cccccc', $image->pickColor(540, 400)->toHex()); } public function testFillAllColor(): void { $image = $this->createTestImage('blocks.png'); - $this->assertEquals('0000ff', $image->getColor(420, 270)->toHex()); - $this->assertEquals('ff0000', $image->getColor(540, 400)->toHex()); + $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); + $this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex()); $image->modify(new FillModifier(new Color(13421772))); - $this->assertEquals('cccccc', $image->getColor(420, 270)->toHex()); - $this->assertEquals('cccccc', $image->getColor(540, 400)->toHex()); + $this->assertEquals('cccccc', $image->pickColor(420, 270)->toHex()); + $this->assertEquals('cccccc', $image->pickColor(540, 400)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/FitModifierTest.php b/tests/Drivers/Gd/Modifiers/FitModifierTest.php index b6e02fba1..58bd8094d 100644 --- a/tests/Drivers/Gd/Modifiers/FitModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/FitModifierTest.php @@ -22,9 +22,9 @@ public function testModify(): void $image->modify(new FitModifier(100, 100, 'center')); $this->assertEquals(100, $image->getWidth()); $this->assertEquals(100, $image->getHeight()); - $this->assertColor(255, 0, 0, 1, $image->getColor(90, 90)); - $this->assertColor(0, 255, 0, 1, $image->getColor(65, 70)); - $this->assertColor(0, 0, 255, 1, $image->getColor(70, 52)); - $this->assertTransparency($image->getColor(90, 30)); + $this->assertColor(255, 0, 0, 1, $image->pickColor(90, 90)); + $this->assertColor(0, 255, 0, 1, $image->pickColor(65, 70)); + $this->assertColor(0, 0, 255, 1, $image->pickColor(70, 52)); + $this->assertTransparency($image->pickColor(90, 30)); } } diff --git a/tests/Drivers/Gd/Modifiers/FlipFlopModifierTest.php b/tests/Drivers/Gd/Modifiers/FlipFlopModifierTest.php index c4a341369..0305f6a82 100644 --- a/tests/Drivers/Gd/Modifiers/FlipFlopModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/FlipFlopModifierTest.php @@ -19,16 +19,16 @@ class FlipFlopModifierTest extends TestCase public function testFlipImage(): void { $image = $this->createTestImage('tile.png'); - $this->assertEquals('b4e000', $image->getColor(0, 0)->toHex()); + $this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex()); $image->modify(new FlipModifier()); - $this->assertEquals('000000', $image->getColor(0, 0)->toHex()); + $this->assertEquals('000000', $image->pickColor(0, 0)->toHex()); } public function testFlopImage(): void { $image = $this->createTestImage('tile.png'); - $this->assertEquals('b4e000', $image->getColor(0, 0)->toHex()); + $this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex()); $image->modify(new FlopModifier()); - $this->assertEquals('000000', $image->getColor(0, 0)->toHex()); + $this->assertEquals('000000', $image->pickColor(0, 0)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/GammaModifierTest.php b/tests/Drivers/Gd/Modifiers/GammaModifierTest.php index 96fbb1935..dec4de93c 100644 --- a/tests/Drivers/Gd/Modifiers/GammaModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/GammaModifierTest.php @@ -17,8 +17,8 @@ class GammaModifierTest extends TestCase public function testModifier(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(0, 0)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); $image->modify(new GammaModifier(2.1)); - $this->assertEquals('00d5f8', $image->getColor(0, 0)->toHex()); + $this->assertEquals('00d5f8', $image->pickColor(0, 0)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/GreyscaleModifierTest.php b/tests/Drivers/Gd/Modifiers/GreyscaleModifierTest.php index c11f22254..6a9b6380d 100644 --- a/tests/Drivers/Gd/Modifiers/GreyscaleModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/GreyscaleModifierTest.php @@ -17,8 +17,8 @@ class GreyscaleModifierTest extends TestCase public function testColorChange(): void { $image = $this->createTestImage('trim.png'); - $this->assertFalse($image->getColor(0, 0)->isGreyscale()); + $this->assertFalse($image->pickColor(0, 0)->isGreyscale()); $image->modify(new GreyscaleModifier()); - $this->assertTrue($image->getColor(0, 0)->isGreyscale()); + $this->assertTrue($image->pickColor(0, 0)->isGreyscale()); } } diff --git a/tests/Drivers/Gd/Modifiers/InvertModifierTest.php b/tests/Drivers/Gd/Modifiers/InvertModifierTest.php index 35ab7ae12..82a81b590 100644 --- a/tests/Drivers/Gd/Modifiers/InvertModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/InvertModifierTest.php @@ -17,10 +17,10 @@ class InvertModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(0, 0)->toHex()); - $this->assertEquals('ffa601', $image->getColor(25, 25)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); + $this->assertEquals('ffa601', $image->pickColor(25, 25)->toHex()); $image->modify(new InvertModifier()); - $this->assertEquals('ff510f', $image->getColor(0, 0)->toHex()); - $this->assertEquals('0059fe', $image->getColor(25, 25)->toHex()); + $this->assertEquals('ff510f', $image->pickColor(0, 0)->toHex()); + $this->assertEquals('0059fe', $image->pickColor(25, 25)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/PixelateModifierTest.php b/tests/Drivers/Gd/Modifiers/PixelateModifierTest.php index 04dba07b4..427a80802 100644 --- a/tests/Drivers/Gd/Modifiers/PixelateModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/PixelateModifierTest.php @@ -17,10 +17,10 @@ class PixelateModifierTest extends TestCase public function testModify(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(0, 0)->toHex()); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new PixelateModifier(10)); - $this->assertEquals('00aef0', $image->getColor(0, 0)->toHex()); - $this->assertEquals('6aaa8b', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); + $this->assertEquals('6aaa8b', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/PlaceModifierTest.php b/tests/Drivers/Gd/Modifiers/PlaceModifierTest.php index c3ddd2d21..3f3db1e08 100644 --- a/tests/Drivers/Gd/Modifiers/PlaceModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/PlaceModifierTest.php @@ -17,8 +17,8 @@ class PlaceModifierTest extends TestCase public function testColorChange(): void { $image = $this->createTestImage('test.jpg'); - $this->assertEquals('febc44', $image->getColor(300, 25)->toHex()); + $this->assertEquals('febc44', $image->pickColor(300, 25)->toHex()); $image->modify(new PlaceModifier(__DIR__ . '/../../../images/circle.png', 'top-right', 0, 0)); - $this->assertEquals('32250d', $image->getColor(300, 25)->toHex()); + $this->assertEquals('32250d', $image->pickColor(300, 25)->toHex()); } } diff --git a/tests/Drivers/Gd/Modifiers/ResizeModifierTest.php b/tests/Drivers/Gd/Modifiers/ResizeModifierTest.php index ed2ebf2bf..bf7ef2340 100644 --- a/tests/Drivers/Gd/Modifiers/ResizeModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/ResizeModifierTest.php @@ -22,10 +22,10 @@ public function testModify(): void $image->modify(new ResizeModifier(200, 100)); $this->assertEquals(200, $image->getWidth()); $this->assertEquals(100, $image->getHeight()); - $this->assertColor(255, 0, 0, 1, $image->getColor(150, 70)); - $this->assertColor(0, 255, 0, 1, $image->getColor(125, 70)); - $this->assertColor(0, 0, 255, 1, $image->getColor(130, 54)); - $transparent = $image->getColor(170, 30); + $this->assertColor(255, 0, 0, 1, $image->pickColor(150, 70)); + $this->assertColor(0, 255, 0, 1, $image->pickColor(125, 70)); + $this->assertColor(0, 0, 255, 1, $image->pickColor(130, 54)); + $transparent = $image->pickColor(170, 30); $this->assertEquals(2130706432, $transparent->toInt()); $this->assertTransparency($transparent); } diff --git a/tests/Drivers/Gd/Modifiers/SharpenModifierTest.php b/tests/Drivers/Gd/Modifiers/SharpenModifierTest.php index 5a7c9180a..5646bae19 100644 --- a/tests/Drivers/Gd/Modifiers/SharpenModifierTest.php +++ b/tests/Drivers/Gd/Modifiers/SharpenModifierTest.php @@ -17,8 +17,8 @@ class SharpenModifierTest extends TestCase public function testModify(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('60ab96', $image->getColor(15, 14)->toHex()); + $this->assertEquals('60ab96', $image->pickColor(15, 14)->toHex()); $image->modify(new SharpenModifier(10)); - $this->assertEquals('4daba7', $image->getColor(15, 14)->toHex()); + $this->assertEquals('4daba7', $image->pickColor(15, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/BlurModifierTest.php b/tests/Drivers/Imagick/Modifiers/BlurModifierTest.php index 1d9123309..485b8e513 100644 --- a/tests/Drivers/Imagick/Modifiers/BlurModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/BlurModifierTest.php @@ -17,8 +17,8 @@ class BlurModifierTest extends TestCase public function testColorChange(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new BlurModifier(30)); - $this->assertEquals('42acb2', $image->getColor(14, 14)->toHex()); + $this->assertEquals('42acb2', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/BrightnessModifierTest.php b/tests/Drivers/Imagick/Modifiers/BrightnessModifierTest.php index b1da26773..8cb0b3db1 100644 --- a/tests/Drivers/Imagick/Modifiers/BrightnessModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/BrightnessModifierTest.php @@ -17,8 +17,8 @@ class BrightnessModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new BrightnessModifier(30)); - $this->assertEquals('39c9ff', $image->getColor(14, 14)->toHex()); + $this->assertEquals('39c9ff', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/ContrastModifierTest.php b/tests/Drivers/Imagick/Modifiers/ContrastModifierTest.php index e22a36c03..c5232a4c8 100644 --- a/tests/Drivers/Imagick/Modifiers/ContrastModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/ContrastModifierTest.php @@ -17,8 +17,8 @@ class ContrastModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new ContrastModifier(30)); - $this->assertEquals('00fcff', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00fcff', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/DrawEllipseModifierTest.php b/tests/Drivers/Imagick/Modifiers/DrawEllipseModifierTest.php index b12be356c..a2bed0d8a 100644 --- a/tests/Drivers/Imagick/Modifiers/DrawEllipseModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/DrawEllipseModifierTest.php @@ -15,10 +15,10 @@ class DrawEllipseModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $drawable = new Ellipse(10, 10); $drawable->background('b53717'); $image->modify(new DrawEllipseModifier(new Point(14, 14), $drawable)); - $this->assertEquals('b53717', $image->getColor(14, 14)->toHex()); + $this->assertEquals('b53717', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/DrawLineModifierTest.php b/tests/Drivers/Imagick/Modifiers/DrawLineModifierTest.php index 9602ab546..423e27dae 100644 --- a/tests/Drivers/Imagick/Modifiers/DrawLineModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/DrawLineModifierTest.php @@ -15,10 +15,10 @@ class DrawLineModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $line = new Line(new Point(0, 0), new Point(10, 0), 4); $line->background('b53517'); $image->modify(new DrawLineModifier(new Point(0, 0), $line)); - $this->assertEquals('b53517', $image->getColor(0, 0)->toHex()); + $this->assertEquals('b53517', $image->pickColor(0, 0)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/DrawPixelModifierTest.php b/tests/Drivers/Imagick/Modifiers/DrawPixelModifierTest.php index ac5d03dfc..90c076d72 100644 --- a/tests/Drivers/Imagick/Modifiers/DrawPixelModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/DrawPixelModifierTest.php @@ -18,8 +18,8 @@ class DrawPixelModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new DrawPixelModifier(new Point(14, 14), 'ffffff')); - $this->assertEquals('ffffff', $image->getColor(14, 14)->toHex()); + $this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/DrawPolygonModifierTest.php b/tests/Drivers/Imagick/Modifiers/DrawPolygonModifierTest.php index 99796e58c..02ee6b2be 100644 --- a/tests/Drivers/Imagick/Modifiers/DrawPolygonModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/DrawPolygonModifierTest.php @@ -15,10 +15,10 @@ class DrawPolygonModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]); $drawable->background('b53717'); $image->modify(new DrawPolygonModifier($drawable)); - $this->assertEquals('b53717', $image->getColor(14, 14)->toHex()); + $this->assertEquals('b53717', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/DrawRectangleModifierTest.php b/tests/Drivers/Imagick/Modifiers/DrawRectangleModifierTest.php index 99928e81a..876397f81 100644 --- a/tests/Drivers/Imagick/Modifiers/DrawRectangleModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/DrawRectangleModifierTest.php @@ -15,10 +15,10 @@ class DrawRectangleModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $rectangle = new Rectangle(300, 200); $rectangle->background('ffffff'); $image->modify(new DrawRectangleModifier(new Point(14, 14), $rectangle)); - $this->assertEquals('ffffff', $image->getColor(14, 14)->toHex()); + $this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/FillModifierTest.php b/tests/Drivers/Imagick/Modifiers/FillModifierTest.php index bbb53eade..37d9b9d7f 100644 --- a/tests/Drivers/Imagick/Modifiers/FillModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/FillModifierTest.php @@ -20,20 +20,20 @@ class FillModifierTest extends TestCase public function testFloodFillColor(): void { $image = $this->createTestImage('blocks.png'); - $this->assertEquals('0000ff', $image->getColor(420, 270)->toHex()); - $this->assertEquals('ff0000', $image->getColor(540, 400)->toHex()); + $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); + $this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex()); $image->modify(new FillModifier(new Color(new ImagickPixel('#cccccc')), new Point(540, 400))); - $this->assertEquals('0000ff', $image->getColor(420, 270)->toHex()); - $this->assertEquals('cccccc', $image->getColor(540, 400)->toHex()); + $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); + $this->assertEquals('cccccc', $image->pickColor(540, 400)->toHex()); } public function testFillAllColor(): void { $image = $this->createTestImage('blocks.png'); - $this->assertEquals('0000ff', $image->getColor(420, 270)->toHex()); - $this->assertEquals('ff0000', $image->getColor(540, 400)->toHex()); + $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); + $this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex()); $image->modify(new FillModifier(new Color(new ImagickPixel('#cccccc')))); - $this->assertEquals('cccccc', $image->getColor(420, 270)->toHex()); - $this->assertEquals('cccccc', $image->getColor(540, 400)->toHex()); + $this->assertEquals('cccccc', $image->pickColor(420, 270)->toHex()); + $this->assertEquals('cccccc', $image->pickColor(540, 400)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/FitModifierTest.php b/tests/Drivers/Imagick/Modifiers/FitModifierTest.php index 76acee6d9..783e8e495 100644 --- a/tests/Drivers/Imagick/Modifiers/FitModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/FitModifierTest.php @@ -22,9 +22,9 @@ public function testModify(): void $image->modify(new FitModifier(100, 100, 'center')); $this->assertEquals(100, $image->getWidth()); $this->assertEquals(100, $image->getHeight()); - $this->assertColor(255, 0, 0, 1, $image->getColor(90, 90)); - $this->assertColor(0, 255, 0, 1, $image->getColor(65, 70)); - $this->assertColor(0, 0, 255, 1, $image->getColor(70, 52)); - $this->assertTransparency($image->getColor(90, 30)); + $this->assertColor(255, 0, 0, 1, $image->pickColor(90, 90)); + $this->assertColor(0, 255, 0, 1, $image->pickColor(65, 70)); + $this->assertColor(0, 0, 255, 1, $image->pickColor(70, 52)); + $this->assertTransparency($image->pickColor(90, 30)); } } diff --git a/tests/Drivers/Imagick/Modifiers/FlipFlopModifierTest.php b/tests/Drivers/Imagick/Modifiers/FlipFlopModifierTest.php index b6957cca8..10ecab694 100644 --- a/tests/Drivers/Imagick/Modifiers/FlipFlopModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/FlipFlopModifierTest.php @@ -19,16 +19,16 @@ class FlipFlopModifierTest extends TestCase public function testFlipImage(): void { $image = $this->createTestImage('tile.png'); - $this->assertEquals('b4e000', $image->getColor(0, 0)->toHex()); + $this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex()); $image->modify(new FlipModifier()); - $this->assertEquals('000000', $image->getColor(0, 0)->toHex()); + $this->assertEquals('000000', $image->pickColor(0, 0)->toHex()); } public function testFlopImage(): void { $image = $this->createTestImage('tile.png'); - $this->assertEquals('b4e000', $image->getColor(0, 0)->toHex()); + $this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex()); $image->modify(new FlopModifier()); - $this->assertEquals('000000', $image->getColor(0, 0)->toHex()); + $this->assertEquals('000000', $image->pickColor(0, 0)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/GammaModifierTest.php b/tests/Drivers/Imagick/Modifiers/GammaModifierTest.php index 3e77e9f68..c3af78c02 100644 --- a/tests/Drivers/Imagick/Modifiers/GammaModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/GammaModifierTest.php @@ -17,8 +17,8 @@ class GammaModifierTest extends TestCase public function testModifier(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(0, 0)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); $image->modify(new GammaModifier(2.1)); - $this->assertEquals('00d5f8', $image->getColor(0, 0)->toHex()); + $this->assertEquals('00d5f8', $image->pickColor(0, 0)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/GreyscaleModifierTest.php b/tests/Drivers/Imagick/Modifiers/GreyscaleModifierTest.php index bd31349bb..42257fad0 100644 --- a/tests/Drivers/Imagick/Modifiers/GreyscaleModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/GreyscaleModifierTest.php @@ -17,8 +17,8 @@ class GreyscaleModifierTest extends TestCase public function testColorChange(): void { $image = $this->createTestImage('trim.png'); - $this->assertFalse($image->getColor(0, 0)->isGreyscale()); + $this->assertFalse($image->pickColor(0, 0)->isGreyscale()); $image->modify(new GreyscaleModifier()); - $this->assertTrue($image->getColor(0, 0)->isGreyscale()); + $this->assertTrue($image->pickColor(0, 0)->isGreyscale()); } } diff --git a/tests/Drivers/Imagick/Modifiers/InvertModifierTest.php b/tests/Drivers/Imagick/Modifiers/InvertModifierTest.php index 0768d24bb..2c3779cdb 100644 --- a/tests/Drivers/Imagick/Modifiers/InvertModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/InvertModifierTest.php @@ -17,10 +17,10 @@ class InvertModifierTest extends TestCase public function testApply(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(0, 0)->toHex()); - $this->assertEquals('ffa601', $image->getColor(25, 25)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); + $this->assertEquals('ffa601', $image->pickColor(25, 25)->toHex()); $image->modify(new InvertModifier()); - $this->assertEquals('ff510f', $image->getColor(0, 0)->toHex()); - $this->assertEquals('0059fe', $image->getColor(25, 25)->toHex()); + $this->assertEquals('ff510f', $image->pickColor(0, 0)->toHex()); + $this->assertEquals('0059fe', $image->pickColor(25, 25)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/PixelateModifierTest.php b/tests/Drivers/Imagick/Modifiers/PixelateModifierTest.php index cbaa12392..9329b8307 100644 --- a/tests/Drivers/Imagick/Modifiers/PixelateModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/PixelateModifierTest.php @@ -17,10 +17,10 @@ class PixelateModifierTest extends TestCase public function testModify(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('00aef0', $image->getColor(0, 0)->toHex()); - $this->assertEquals('00aef0', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $image->modify(new PixelateModifier(10)); - $this->assertEquals('00aef0', $image->getColor(0, 0)->toHex()); - $this->assertEquals('6bab8c', $image->getColor(14, 14)->toHex()); + $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); + $this->assertEquals('6bab8c', $image->pickColor(14, 14)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/PlaceModifierTest.php b/tests/Drivers/Imagick/Modifiers/PlaceModifierTest.php index 92a22ab2f..15a3af838 100644 --- a/tests/Drivers/Imagick/Modifiers/PlaceModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/PlaceModifierTest.php @@ -17,8 +17,8 @@ class PlaceModifierTest extends TestCase public function testColorChange(): void { $image = $this->createTestImage('test.jpg'); - $this->assertEquals('febc44', $image->getColor(300, 25)->toHex()); + $this->assertEquals('febc44', $image->pickColor(300, 25)->toHex()); $image->modify(new PlaceModifier(__DIR__ . '/../../../images/circle.png', 'top-right', 0, 0)); - $this->assertEquals('33260e', $image->getColor(300, 25)->toHex()); + $this->assertEquals('33260e', $image->pickColor(300, 25)->toHex()); } } diff --git a/tests/Drivers/Imagick/Modifiers/ResizeModifierTest.php b/tests/Drivers/Imagick/Modifiers/ResizeModifierTest.php index b112cedb8..519e69f1e 100644 --- a/tests/Drivers/Imagick/Modifiers/ResizeModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/ResizeModifierTest.php @@ -22,9 +22,9 @@ public function testModify(): void $image->modify(new ResizeModifier(200, 100)); $this->assertEquals(200, $image->getWidth()); $this->assertEquals(100, $image->getHeight()); - $this->assertColor(255, 0, 0, 1, $image->getColor(150, 70)); - $this->assertColor(0, 255, 0, 1, $image->getColor(125, 70)); - $this->assertColor(0, 0, 255, 1, $image->getColor(130, 54)); - $this->assertTransparency($image->getColor(150, 45)); + $this->assertColor(255, 0, 0, 1, $image->pickColor(150, 70)); + $this->assertColor(0, 255, 0, 1, $image->pickColor(125, 70)); + $this->assertColor(0, 0, 255, 1, $image->pickColor(130, 54)); + $this->assertTransparency($image->pickColor(150, 45)); } } diff --git a/tests/Drivers/Imagick/Modifiers/SharpenModifierTest.php b/tests/Drivers/Imagick/Modifiers/SharpenModifierTest.php index 920630937..2b80fd4e3 100644 --- a/tests/Drivers/Imagick/Modifiers/SharpenModifierTest.php +++ b/tests/Drivers/Imagick/Modifiers/SharpenModifierTest.php @@ -17,8 +17,8 @@ class SharpenModifierTest extends TestCase public function testModify(): void { $image = $this->createTestImage('trim.png'); - $this->assertEquals('60ab96', $image->getColor(15, 14)->toHex()); + $this->assertEquals('60ab96', $image->pickColor(15, 14)->toHex()); $image->modify(new SharpenModifier(10)); - $this->assertEquals('4faca6', $image->getColor(15, 14)->toHex()); + $this->assertEquals('4faca6', $image->pickColor(15, 14)->toHex()); } }