Cheetah
LineShape.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 $x = 0;
16 
22  public $y = 0;
23 
29  public $color = '#000000';
30 
36  public $width = 1;
37 
44  public function __construct($x = null, $y = null)
45  {
46  $this->x = is_numeric($x) ? intval($x) : $this->x;
47  $this->y = is_numeric($y) ? intval($y) : $this->y;
48  }
49 
56  public function color($color)
57  {
58  $this->color = $color;
59  }
60 
67  public function width($width)
68  {
69  throw new \Intervention\Image\Exception\NotSupportedException(
70  "Line width is not supported by GD driver."
71  );
72  }
73 
82  public function applyToImage(Image $image, $x = 0, $y = 0)
83  {
84  $color = new Color($this->color);
85  imageline($image->getCore(), $x, $y, $this->x, $this->y, $color->getInt());
86 
87  return true;
88  }
89 }
Intervention\Image\Gd\Shapes\LineShape\width
width($width)
Definition: LineShape.php:67
Intervention\Image\Gd\Shapes\LineShape\$color
$color
Definition: LineShape.php:29
Intervention\Image\Gd\Shapes\LineShape
Definition: LineShape.php:9
php
Intervention\Image\AbstractShape
Definition: AbstractShape.php:6
Intervention\Image\Gd\Shapes\LineShape\$width
$width
Definition: LineShape.php:36
Intervention\Image\Gd\Shapes\LineShape\applyToImage
applyToImage(Image $image, $x=0, $y=0)
Definition: LineShape.php:82
Intervention\Image\Image\getCore
getCore()
Definition: Image.php:186
Intervention\Image\Gd\Shapes\LineShape\$y
$y
Definition: LineShape.php:22
Intervention\Image\Gd\Shapes\LineShape\$x
$x
Definition: LineShape.php:15
Intervention\Image\Gd\Shapes
Definition: CircleShape.php:3
Intervention\Image\Image
Definition: Image.php:50
Intervention\Image\Gd\Shapes\LineShape\__construct
__construct($x=null, $y=null)
Definition: LineShape.php:44
Intervention\Image\Gd\Color
Definition: Color.php:8
Intervention\Image\Gd\Shapes\LineShape\color
color($color)
Definition: LineShape.php:56