trait ContrastTrait in Image Effects 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/ImageToolkit/Operation/ContrastTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\ContrastTrait
- 8 src/Plugin/ImageToolkit/Operation/ContrastTrait.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\ContrastTrait
Base trait for image_effects Contrast operations.
Hierarchy
- trait \Drupal\image_effects\Plugin\ImageToolkit\Operation\ContrastTrait
2 files declare their use of ContrastTrait
- Contrast.php in src/
Plugin/ ImageToolkit/ Operation/ gd/ Contrast.php - Contrast.php in src/
Plugin/ ImageToolkit/ Operation/ imagemagick/ Contrast.php
File
- src/
Plugin/ ImageToolkit/ Operation/ ContrastTrait.php, line 8
Namespace
Drupal\image_effects\Plugin\ImageToolkit\OperationView source
trait ContrastTrait {
/**
* {@inheritdoc}
*/
protected function arguments() {
return [
'level' => [
'description' => 'The contrast level.',
],
];
}
/**
* {@inheritdoc}
*/
protected function validateArguments(array $arguments) {
// Assure contrast level is valid.
if (!is_numeric($arguments['level']) || !is_int($arguments['level'] + 5) || $arguments['level'] < -100 || $arguments['level'] > 100) {
throw new \InvalidArgumentException("Invalid level ('{$arguments['level']}') specified for the image 'contrast' operation");
}
return $arguments;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContrastTrait:: |
protected | function | ||
ContrastTrait:: |
protected | function |