public function PositionedRectangle::setFromCorners in Image Effects 8.2
Same name and namespace in other branches
- 8.3 src/Component/PositionedRectangle.php \Drupal\image_effects\Component\PositionedRectangle::setFromCorners()
- 8 src/Component/PositionedRectangle.php \Drupal\image_effects\Component\PositionedRectangle::setFromCorners()
Sets a rectangle from the coordinates of its corners.
Parameters
array $corners: An associative array of point coordinates. The keys 'c_a', 'c_b', 'c_c' and 'c_d' represent each of the four a, b, c, d corners of the rectangle in the format D +-----------------+ C | | | | A +-----------------+ B.
Return value
$this
1 call to PositionedRectangle::setFromCorners()
- PositionedRectangle::setFromDimensions in src/
Component/ PositionedRectangle.php - Sets a rectangle from its width and height.
File
- src/
Component/ PositionedRectangle.php, line 115
Class
- PositionedRectangle
- Rectangle algebra class.
Namespace
Drupal\image_effects\ComponentCode
public function setFromCorners(array $corners) {
$this
->setPoint('c_a', $corners['c_a'])
->setPoint('c_b', $corners['c_b'])
->setPoint('c_c', $corners['c_c'])
->setPoint('c_d', $corners['c_d'])
->determineBoundingCorners();
$this->width = $this
->getBoundingWidth();
$this->height = $this
->getBoundingHeight();
return $this;
}