You are here

public function FocalPointEffectBase::getAnchor in Focal Point 8

Get the top-left anchor position of the crop area.

@codeCoverageIgnore

Parameters

\Drupal\Core\Image\ImageInterface $image: Image object representing original image.

\Drupal\crop\CropInterface $crop: Crop entity.

Return value

array Array with two keys (x, y) and anchor coordinates as values.

1 call to FocalPointEffectBase::getAnchor()
FocalPointEffectBase::applyCrop in src/FocalPointEffectBase.php
Applies the crop effect to an image.

File

src/FocalPointEffectBase.php, line 253

Class

FocalPointEffectBase
Provides a base class for image effects.

Namespace

Drupal\focal_point

Code

public function getAnchor(ImageInterface $image, CropInterface $crop) {
  $original_focal_point = $this
    ->getOriginalFocalPoint($crop, $this->focalPointManager);
  $focal_point = $this
    ->transformFocalPoint($image, $original_focal_point);
  return $this
    ->calculateAnchor($focal_point, $image, $crop);
}