You are here

class GaussianBlur in Image Effects 8

Same name in this branch
  1. 8 src/Plugin/ImageToolkit/Operation/gd/GaussianBlur.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\gd\GaussianBlur
  2. 8 src/Plugin/ImageToolkit/Operation/imagemagick/GaussianBlur.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\GaussianBlur
Same name and namespace in other branches
  1. 8.3 src/Plugin/ImageToolkit/Operation/imagemagick/GaussianBlur.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\GaussianBlur
  2. 8.2 src/Plugin/ImageToolkit/Operation/imagemagick/GaussianBlur.php \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\GaussianBlur

Defines ImageMagick Gaussian Blur operation.

Plugin annotation


@ImageToolkitOperation(
  id = "image_effects_imagemagick_gaussian_blur",
  toolkit = "imagemagick",
  operation = "gaussian_blur",
  label = @Translation("Gaussian blur"),
  description = @Translation("Blur the image with a Gaussian operator.")
)

Hierarchy

  • class \Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick\GaussianBlur extends \Drupal\imagemagick\Plugin\ImageToolkit\Operation\imagemagick\ImagemagickImageToolkitOperationBase uses GaussianBlurTrait

Expanded class hierarchy of GaussianBlur

File

src/Plugin/ImageToolkit/Operation/imagemagick/GaussianBlur.php, line 19

Namespace

Drupal\image_effects\Plugin\ImageToolkit\Operation\imagemagick
View source
class GaussianBlur extends ImagemagickImageToolkitOperationBase {
  use GaussianBlurTrait;

  /**
   * {@inheritdoc}
   */
  protected function execute(array $arguments) {
    switch ($this
      ->getToolkit()
      ->getPackage()) {
      case 'imagemagick':
        $op = '-channel RGBA -blur ' . $arguments['radius'];
        break;
      case 'graphicsmagick':
        $op = '-gaussian ' . $arguments['radius'];
        break;
    }
    $sigma = $arguments['sigma'] !== NULL ? $arguments['sigma'] : $arguments['radius'] / 3 * 2;
    $op .= 'x' . number_format($sigma, 1, '.', '');
    $this
      ->getToolkit()
      ->addArgument($op);
    return TRUE;
  }

}

Members