You are here

protected function GDOperationTrait::getRectangleCorners in Image Effects 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\GDOperationTrait::getRectangleCorners()
  2. 8 src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\GDOperationTrait::getRectangleCorners()

Convert a rectangle to a sequence of point coordinates.

GD requires a simple array of point coordinates in its imagepolygon() function.

Parameters

\Drupal\image_effects\Component\PositionedRectangle $rect: A PositionedRectangle object.

Return value

array A simple array of 8 point coordinates.

5 calls to GDOperationTrait::getRectangleCorners()
DrawRectangle::execute in src/Plugin/ImageToolkit/Operation/gd/DrawRectangle.php
Performs the actual manipulation on the image.
GDOperationTrait::getEntropyCropByGridding in src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php
Computes the entropy crop of an image, using recursive gridding.
SmartCrop::execute in src/Plugin/ImageToolkit/Operation/imagemagick/SmartCrop.php
SmartCrop::execute in src/Plugin/ImageToolkit/Operation/gd/SmartCrop.php
Performs the actual manipulation on the image.
TextToWrapper::drawDebugBox in src/Plugin/ImageToolkit/Operation/gd/TextToWrapper.php
Display a polygon enclosing the text line, and conspicuous points.

File

src/Plugin/ImageToolkit/Operation/gd/GDOperationTrait.php, line 72

Class

GDOperationTrait
Trait for GD image toolkit operations.

Namespace

Drupal\image_effects\Plugin\ImageToolkit\Operation\gd

Code

protected function getRectangleCorners(PositionedRectangle $rect) {
  $points = [];
  foreach ([
    'c_d',
    'c_c',
    'c_b',
    'c_a',
  ] as $c) {
    $point = $rect
      ->getPoint($c);
    $points[] = $point[0];
    $points[] = $point[1];
  }
  return $points;
}