1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-11 16:34:00 +02:00

Fix deprecation warnings

This commit is contained in:
Oliver Vogel
2023-09-29 15:54:13 +02:00
parent 166d2f3f92
commit d7fd99e4ab

View File

@@ -300,7 +300,9 @@ class Polygon implements IteratorAggregate, Countable, ArrayAccess, DrawableInte
} }
foreach ($this->points as $point) { foreach ($this->points as $point) {
$point->setX($point->getX() - $diff); $point->setX(
intval($point->getX() - $diff)
);
} }
return $this; return $this;
@@ -331,7 +333,9 @@ class Polygon implements IteratorAggregate, Countable, ArrayAccess, DrawableInte
} }
foreach ($this->points as $point) { foreach ($this->points as $point) {
$point->setY($point->getY() - $diff); $point->setY(
intval($point->getY() - $diff),
);
} }
return $this; return $this;
@@ -350,16 +354,24 @@ class Polygon implements IteratorAggregate, Countable, ArrayAccess, DrawableInte
foreach ($this->points as $point) { foreach ($this->points as $point) {
// translate point to pivot // translate point to pivot
$point->setX($point->getX() - $this->getPivot()->getX()); $point->setX(
$point->setY($point->getY() - $this->getPivot()->getY()); intval($point->getX() - $this->getPivot()->getX()),
);
$point->setY(
intval($point->getY() - $this->getPivot()->getY()),
);
// rotate point // rotate point
$x = $point->getX() * $cos - $point->getY() * $sin; $x = $point->getX() * $cos - $point->getY() * $sin;
$y = $point->getX() * $sin + $point->getY() * $cos; $y = $point->getX() * $sin + $point->getY() * $cos;
// translate point back // translate point back
$point->setX($x + $this->getPivot()->getX()); $point->setX(
$point->setY($y + $this->getPivot()->getY()); intval($x + $this->getPivot()->getX()),
);
$point->setY(
intval($y + $this->getPivot()->getY()),
);
} }
return $this; return $this;