File indexing completed on 2025-01-26 05:29:14

0001 <?php
0002 
0003 namespace Intervention\Image\Gd\Shapes;
0004 
0005 use Intervention\Image\Image;
0006 
0007 class CircleShape extends EllipseShape
0008 {
0009     /**
0010      * Diameter of circle in pixels
0011      *
0012      * @var int
0013      */
0014     public $diameter = 100;
0015 
0016     /**
0017      * Create new instance of circle
0018      *
0019      * @param int $diameter
0020      */
0021     public function __construct($diameter = null)
0022     {
0023         $this->width = is_numeric($diameter) ? intval($diameter) : $this->diameter;
0024         $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter;
0025         $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter;
0026     }
0027 
0028     /**
0029      * Draw current circle on given image
0030      *
0031      * @param  Image   $image
0032      * @param  int     $x
0033      * @param  int     $y
0034      * @return boolean
0035      */
0036     public function applyToImage(Image $image, $x = 0, $y = 0)
0037     {
0038         return parent::applyToImage($image, $x, $y);
0039     }
0040 }