protected function Coloroverlay::process in Imagick 8
File
- src/
Plugin/ ImageToolkit/ Operation/ imagick/ Coloroverlay.php, line 37
Class
- Coloroverlay
- Defines imagick coloroverlay operation.
Namespace
Drupal\imagick\Plugin\ImageToolkit\Operation\imagickCode
protected function process(Imagick $resource, array $arguments) {
$color = new Imagick();
$color
->newImage($resource
->getImageWidth(), $resource
->getImageHeight(), $arguments['HEX']);
$alpha = $arguments['alpha'] / 100;
if (method_exists($color, 'setImageOpacity')) {
$color
->setImageOpacity($alpha);
}
else {
$color
->setImageAlpha($alpha);
}
return $resource
->compositeImage($color, Imagick::COMPOSITE_DEFAULT, 0, 0);
}