-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathFillModifier.php
More file actions
40 lines (34 loc) · 970 Bytes
/
FillModifier.php
File metadata and controls
40 lines (34 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
namespace Intervention\Image\Modifiers;
use Intervention\Image\Drivers\SpecializableModifier;
use Intervention\Image\Exceptions\ColorDecoderException;
use Intervention\Image\Exceptions\StateException;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\PointInterface;
class FillModifier extends SpecializableModifier
{
public function __construct(
public string|ColorInterface $color,
public ?PointInterface $position = null,
) {
//
}
/**
* Determine if the modifier has a position defined.
*/
public function hasPosition(): bool
{
return $this->position instanceof PointInterface;
}
/**
* Return filling color object:
*
* @throws ColorDecoderException
* @throws StateException
*/
protected function color(): ColorInterface
{
return $this->driver()->decodeColor($this->color);
}
}