public function PositionedRectangle::resize in Image Effects 8.3
Same name and namespace in other branches
- 8 src/Component/PositionedRectangle.php \Drupal\image_effects\Component\PositionedRectangle::resize()
- 8.2 src/Component/PositionedRectangle.php \Drupal\image_effects\Component\PositionedRectangle::resize()
Resizes the rectangle and any additional point.
Parameters
int $width: The new width of the rectangle.
int $height: The new height of the rectangle.
Return value
$this
File
- src/
Component/ PositionedRectangle.php, line 381
Class
- PositionedRectangle
- Rectangle algebra class.
Namespace
Drupal\image_effects\ComponentCode
public function resize($width, $height) {
$width_multiplier = $width / $this
->getWidth();
$height_multiplier = $height / $this
->getHeight();
foreach ($this->points as &$point) {
$point[0] = (int) round($point[0] * $width_multiplier);
$point[1] = (int) round($point[1] * $height_multiplier);
}
$this->width = $width;
$this->height = $height;
return $this;
}