예제 #1
0
 public function rotateImageAroundAxis($degrees, $ax = null, $ay = null)
 {
     if ($degrees) {
         $newCoordinates = Geometry::calcCoordinatesForRotateObjectInscribedInRectangular(0, 0, $this->getImageWidth(), $this->getImageHeight(), $degrees, $ax, $ay);
         $this->setImageX($this->getImageX() + $newCoordinates['x'])->setImageY($this->getImageY() + $newCoordinates['y']);
         // $background = 'graya(50%, 0.5)';
         // $this->rotateImage($background, $degrees);
         $this->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
         $this->distortImage(Imagick::DISTORTION_SCALEROTATETRANSLATE, [$this->getImageWidth() / 2, $this->getImageHeight() / 2, 1, $degrees], true);
     }
     return $this;
 }