From 3210b1d4fdd703aed410a948d2db55122f7de265 Mon Sep 17 00:00:00 2001 From: Le_Tung Date: Fri, 8 Sep 2017 16:03:14 +0900 Subject: [PATCH 1/2] support crop with dynamic point --- src/FFMpeg/Coordinate/Point.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/FFMpeg/Coordinate/Point.php b/src/FFMpeg/Coordinate/Point.php index c0688e8..710216c 100644 --- a/src/FFMpeg/Coordinate/Point.php +++ b/src/FFMpeg/Coordinate/Point.php @@ -16,10 +16,15 @@ class Point private $x; private $y; - public function __construct($x, $y) + public function __construct($x, $y, $dynamic = false) { - $this->x = (int) $x; - $this->y = (int) $y; + if ($dynamic) { + $this->x = $x; + $this->y = $y; + } else { + $this->x = (int)$x; + $this->y = (int)$y; + } } /** From 47b8d8497924ced78d5287e36a0030d2490e8de7 Mon Sep 17 00:00:00 2001 From: Le_Tung Date: Tue, 19 Sep 2017 10:44:11 +0900 Subject: [PATCH 2/2] add dynamic point Unit Test --- tests/Unit/Coordinate/PointTest.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/Unit/Coordinate/PointTest.php b/tests/Unit/Coordinate/PointTest.php index 09bd22e..4d633ce 100644 --- a/tests/Unit/Coordinate/PointTest.php +++ b/tests/Unit/Coordinate/PointTest.php @@ -13,4 +13,11 @@ class PointTest extends TestCase $this->assertEquals(4, $point->getX()); $this->assertEquals(25, $point->getY()); } + + public function testDynamicPointGetters() + { + $point = new Point("t*100", "t", true); + $this->assertEquals("t*100", $point->getX()); + $this->assertEquals("t", $point->getY()); + } }