class DrawRectangle in Image Effects 8
Same name in this branch
- 8 src/Plugin/ImageToolkit/Operation/gd/DrawRectangle.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\DrawRectangle
- 8 src/Plugin/ImageToolkit/Operation/imagemagick/DrawRectangle.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\DrawRectangle
Same name and namespace in other branches
- 8.3 src/Plugin/ImageToolkit/Operation/imagemagick/DrawRectangle.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\DrawRectangle
- 8.2 src/Plugin/ImageToolkit/Operation/imagemagick/DrawRectangle.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\DrawRectangle
Defines ImageMagick draw rectangle operation.
Plugin annotation
@ImageToolkitOperation(
id = "image_effects_imagemagick_draw_rectangle",
toolkit = "imagemagick",
operation = "draw_rectangle",
label = @Translation("Draw rectangle"),
description = @Translation("Draws a rectangle on the image, optionally filling it in with a specified color.")
)
Hierarchy
- class \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\DrawRectangle extends \Drupal\imagemagick\Plugin\ImageToolkit\Operation\imagemagick\ImagemagickImageToolkitOperationBase uses DrawRectangleTrait
Expanded class hierarchy of DrawRectangle
File
- src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ DrawRectangle.php, line 19
Namespace
Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagickView source
class DrawRectangle extends ImagemagickImageToolkitOperationBase {
use DrawRectangleTrait;
/**
* {@inheritdoc}
*/
protected function execute(array $arguments) {
$arg = '';
if ($arguments['fill_color']) {
$arg .= '-fill ' . $this
->getToolkit()
->escapeShellArg($arguments['fill_color']);
}
else {
$arg .= '-fill none';
}
if ($arguments['border_color']) {
$arg .= ' -stroke ' . $this
->getToolkit()
->escapeShellArg($arguments['border_color']) . ' -strokewidth 1';
}
$a = $arguments['rectangle']
->getPoint('c_a');
$b = $arguments['rectangle']
->getPoint('c_b');
$c = $arguments['rectangle']
->getPoint('c_c');
$d = $arguments['rectangle']
->getPoint('c_d');
$this
->getToolkit()
->addArgument($arg . ' -draw ' . $this
->getToolkit()
->escapeShellArg("polygon {$d[0]},{$d[1]} {$c[0]},{$c[1]} {$b[0]},{$b[1]} {$a[0]},{$a[1]}"));
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrawRectangle:: |
protected | function | ||
DrawRectangleTrait:: |
protected | function | ||
DrawRectangleTrait:: |
protected | function |