You are here

protected function Rotate::process in Imagick 8

File

src/Plugin/ImageToolkit/Operation/imagick/Rotate.php, line 27

Class

Rotate
Defines imagick rotate operation.

Namespace

Drupal\imagick\Plugin\ImageToolkit\Operation\imagick

Code

protected function process(Imagick $resource, array $arguments) {
  $background = new ImagickPixel();
  if (!empty($arguments['background'])) {
    $background
      ->setColor('#' . dechex($arguments['background']));
  }
  else {
    $background
      ->setColor('none');
  }
  $success = $resource
    ->rotateImage($background, $arguments['degrees']);
  $resource
    ->setImagePage($resource
    ->getImageWidth(), $resource
    ->getImageHeight(), 0, 0);
  return $success;
}