You are here

Colorshift.php in Image Effects 8

File

src/Plugin/ImageToolkit/Operation/imagemagick/Colorshift.php
View source
<?php

namespace Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick;

use Drupal\image_effects\Plugin\ImageToolkit\Operation\ColorshiftTrait;
use Drupal\imagemagick\Plugin\ImageToolkit\Operation\imagemagick\ImagemagickImageToolkitOperationBase;

/**
 * Defines ImageMagick Colorshift operation.
 *
 * @ImageToolkitOperation(
 *   id = "image_effects_imagemagick_colorshift",
 *   toolkit = "imagemagick",
 *   operation = "colorshift",
 *   label = @Translation("Colorshift"),
 *   description = @Translation("Shift image colors.")
 * )
 */
class Colorshift extends ImagemagickImageToolkitOperationBase {
  use ColorshiftTrait;

  /**
   * {@inheritdoc}
   */
  protected function execute(array $arguments) {
    $this
      ->getToolkit()
      ->addArgument("+level-colors " . $this
      ->getToolkit()
      ->escapeShellArg($arguments['RGB']) . ",white");
    return TRUE;
  }

}

Classes

Namesort descending Description
Colorshift Defines ImageMagick Colorshift operation.