You are here

Vignette.php in Imagick 8

File

src/Plugin/ImageToolkit/Operation/imagick/Vignette.php
View source
<?php

namespace Drupal\imagick\Plugin\ImageToolkit\Operation\imagick;

use Imagick;

/**
 * Defines imagick vignette operation.
 *
 * @ImageToolkitOperation(
 *   id = "imagick_vignette",
 *   toolkit = "imagick",
 *   operation = "vignette",
 *   label = @Translation("Vignette"),
 *   description = @Translation("Adds vignette to an image.")
 * )
 */
class Vignette extends ImagickOperationBase {

  /**
   * {@inheritdoc}
   */
  protected function arguments() {
    return [
      'blackpoint' => [
        'description' => 'The black point.',
      ],
      'whitepoint' => [
        'description' => 'The white point.',
      ],
      'x' => [
        'description' => 'The X offset of the ellipse.',
      ],
      'y' => [
        'description' => 'The Y offset of the ellipse.',
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  protected function process(Imagick $resource, array $arguments) {
    return $resource
      ->vignetteImage($arguments['blackpoint'], $arguments['whitepoint'], $arguments['x'], $arguments['y']);
  }

}

Classes

Namesort descending Description
Vignette Defines imagick vignette operation.