class Convolution in Image Effects 8.3
Same name in this branch
- 8.3 src/Plugin/ImageToolkit/Operation/gd/Convolution.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\Convolution
- 8.3 src/Plugin/ImageToolkit/Operation/imagemagick/Convolution.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\Convolution
Same name and namespace in other branches
- 8 src/Plugin/ImageToolkit/Operation/imagemagick/Convolution.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\Convolution
- 8.2 src/Plugin/ImageToolkit/Operation/imagemagick/Convolution.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\Convolution
Defines ImageMagick Convolution operation.
Plugin annotation
@ImageToolkitOperation(
id = "image_effects_imagemagick_convolution",
toolkit = "imagemagick",
operation = "convolution",
label = @Translation("Convolution"),
description = @Translation("Adjust image convolution.")
)
Hierarchy
- class \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\Convolution extends \Drupal\imagemagick\Plugin\ImageToolkit\Operation\imagemagick\ImagemagickImageToolkitOperationBase uses ConvolutionTrait
Expanded class hierarchy of Convolution
File
- src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ Convolution.php, line 19
Namespace
Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagickView source
class Convolution extends ImagemagickImageToolkitOperationBase {
use ConvolutionTrait;
/**
* {@inheritdoc}
*/
protected function execute(array $arguments) {
if (isset($arguments['kernel']) && isset($arguments['divisor']) && isset($arguments['offset'])) {
$matrix_s = '';
foreach ($arguments['kernel'] as $vector) {
$vector = array_map(function ($e) use ($arguments) {
return $e / $arguments['divisor'] + $arguments['offset'];
}, $vector);
$matrix_s .= implode(',', $vector) . " ";
}
$matrix_s = substr($matrix_s, 0, -1);
$this
->addArgument("-morphology Convolve '3x3:{$matrix_s}'");
}
return TRUE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Convolution:: |
protected | function | ||
ConvolutionTrait:: |
protected | function | ||
ConvolutionTrait:: |
protected | function |