trait GaussianBlurTrait in Image Effects 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/ImageToolkit/Operation/GaussianBlurTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\GaussianBlurTrait
- 8 src/Plugin/ImageToolkit/Operation/GaussianBlurTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\GaussianBlurTrait
Base trait for image_effects Blur operations.
Hierarchy
- trait \Drupal\image_effects\Plugin\ImageToolkit\Operation\GaussianBlurTrait
2 files declare their use of GaussianBlurTrait
- GaussianBlur.php in src/
Plugin/ ImageToolkit/ Operation/ gd/ GaussianBlur.php - GaussianBlur.php in src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ GaussianBlur.php
File
- src/
Plugin/ ImageToolkit/ Operation/ GaussianBlurTrait.php, line 8
Namespace
Drupal\image_effects\Plugin\ImageToolkit\OperationView source
trait GaussianBlurTrait {
/**
* {@inheritdoc}
*/
protected function arguments() {
return [
'radius' => [
'description' => 'The blur radius, in pixels.',
],
'sigma' => [
'description' => 'The blur sigma value.',
'required' => FALSE,
'default' => NULL,
],
];
}
/**
* {@inheritdoc}
*/
protected function validateArguments(array $arguments) {
// Assure blur radius is valid.
if (!is_int($arguments['radius']) || $arguments['radius'] < 1) {
throw new \InvalidArgumentException("Invalid radius ('{$arguments['radius']}') specified for the image 'gaussian_blur' operation");
}
// Assure sigma value is valid.
if ($arguments['sigma'] !== NULL && (!is_float($arguments['sigma']) || $arguments['sigma'] <= 0)) {
throw new \InvalidArgumentException("Invalid sigma value ('{$arguments['sigma']}') specified for the image 'gaussian_blur' operation");
}
return $arguments;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GaussianBlurTrait:: |
protected | function | ||
GaussianBlurTrait:: |
protected | function |