Просмотр файла vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php

Размер файла: 936B
  1. <?php
  2.  
  3. namespace Intervention\Image\Imagick\Shapes;
  4.  
  5. use Intervention\Image\Image;
  6.  
  7. class CircleShape extends EllipseShape
  8. {
  9. /**
  10. * Diameter of circle in pixels
  11. *
  12. * @var int
  13. */
  14. public $diameter = 100;
  15.  
  16. /**
  17. * Create new instance of circle
  18. *
  19. * @param int $diameter
  20. */
  21. public function __construct($diameter = null)
  22. {
  23. $this->width = is_numeric($diameter) ? intval($diameter) : $this->diameter;
  24. $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter;
  25. $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter;
  26. }
  27.  
  28. /**
  29. * Draw current circle on given image
  30. *
  31. * @param Image $image
  32. * @param int $x
  33. * @param int $y
  34. * @return boolean
  35. */
  36. public function applyToImage(Image $image, $x = 0, $y = 0)
  37. {
  38. return parent::applyToImage($image, $x, $y);
  39. }
  40. }