DrawRectangle.php in Image Effects 8.3
File
src/Plugin/ImageToolkit/Operation/gd/DrawRectangle.php
View source
<?php
namespace Drupal\image_effects\Plugin\ImageToolkit\Operation\gd;
use Drupal\image_effects\Plugin\ImageToolkit\Operation\DrawRectangleTrait;
use Drupal\system\Plugin\ImageToolkit\Operation\gd\GDImageToolkitOperationBase;
class DrawRectangle extends GDImageToolkitOperationBase {
use DrawRectangleTrait;
use GDOperationTrait;
protected function execute(array $arguments) {
$success = TRUE;
if ($arguments['fill_color']) {
$color = $this
->allocateColorFromRgba($arguments['fill_color']);
$success = imagefilledpolygon($this
->getToolkit()
->getResource(), $this
->getRectangleCorners($arguments['rectangle']), 4, $color);
}
if ($success && $arguments['border_color']) {
$color = $this
->allocateColorFromRgba($arguments['border_color']);
$success = imagepolygon($this
->getToolkit()
->getResource(), $this
->getRectangleCorners($arguments['rectangle']), 4, $color);
}
return $success;
}
}