Cheetah
PolygonShape.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use \Intervention\Image\Image;
6 use \Intervention\Image\Gd\Color;
7 
9 {
15  public $points;
16 
22  public function __construct($points)
23  {
24  $this->points = $points;
25  }
26 
35  public function applyToImage(Image $image, $x = 0, $y = 0)
36  {
37  $background = new Color($this->background);
38  imagefilledpolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $background->getInt());
39 
40  if ($this->hasBorder()) {
41  $border_color = new Color($this->border_color);
42  imagesetthickness($image->getCore(), $this->border_width);
43  imagepolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $border_color->getInt());
44  }
45 
46  return true;
47  }
48 }
Intervention\Image\Gd\Shapes\PolygonShape\__construct
__construct($points)
Definition: PolygonShape.php:22
Intervention\Image\Gd\Shapes\PolygonShape\$points
$points
Definition: PolygonShape.php:15
php
Intervention\Image\AbstractShape
Definition: AbstractShape.php:6
Intervention\Image\Gd\Shapes\PolygonShape\applyToImage
applyToImage(Image $image, $x=0, $y=0)
Definition: PolygonShape.php:35
Intervention\Image\Image\getCore
getCore()
Definition: Image.php:186
Intervention\Image\Gd\Shapes
Definition: CircleShape.php:3
Intervention\Image\Image
Definition: Image.php:50
Intervention\Image\AbstractShape\$border_color
$border_color
Definition: AbstractShape.php:19
Intervention\Image\AbstractShape\$background
$background
Definition: AbstractShape.php:12
Intervention\Image\AbstractShape\hasBorder
hasBorder()
Definition: AbstractShape.php:67
Intervention\Image\Gd\Color
Definition: Color.php:8
Intervention\Image\AbstractShape\background
background($color)
Definition: AbstractShape.php:44
Intervention\Image\Gd\Shapes\PolygonShape
Definition: PolygonShape.php:9