-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathColorizeModifier.php
More file actions
34 lines (28 loc) · 975 Bytes
/
ColorizeModifier.php
File metadata and controls
34 lines (28 loc) · 975 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
<?php
declare(strict_types=1);
namespace Intervention\Image\Modifiers;
use Intervention\Image\Drivers\SpecializableModifier;
use Intervention\Image\Exceptions\InvalidArgumentException;
class ColorizeModifier extends SpecializableModifier
{
/**
* Create new modifier object.
*
* @throws InvalidArgumentException
*/
public function __construct(
public int $red = 0,
public int $green = 0,
public int $blue = 0,
) {
if ($red < -100 || $red > 100) {
throw new InvalidArgumentException('Color level for argument $red must be in range -100 to 100');
}
if ($green < -100 || $green > 100) {
throw new InvalidArgumentException('Color level for argument $green must be in range -100 to 100');
}
if ($blue < -100 || $blue > 100) {
throw new InvalidArgumentException('Color level for argument $blue must be in range -100 to 100');
}
}
}