-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathColorChannelInterface.php
More file actions
57 lines (46 loc) · 1.27 KB
/
ColorChannelInterface.php
File metadata and controls
57 lines (46 loc) · 1.27 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
declare(strict_types=1);
namespace Intervention\Image\Interfaces;
use Intervention\Image\Exceptions\ColorException;
interface ColorChannelInterface
{
/**
* Create new instance by either value or normalized value
*
* @throws ColorException
*/
public function __construct(?int $value = null, ?float $normalized = null);
/**
* Return color channels integer value
*/
public function value(): int;
/**
* Return the channels value normalized to a float value form 0 to 1 by its range
*/
public function normalize(int $precision = 32): float;
/**
* Throw exception if the given value is not applicable for channel
* otherwise the value is returned unchanged.
*
* @throws ColorException
*/
public function validate(mixed $value): mixed;
/**
* Return the the minimal possible value of the color channel
*/
public function min(): int;
/*
* Return the the maximal possible value of the color channel
*
* @return int
*/
public function max(): int;
/**
* Cast color channel's value to string
*/
public function toString(): string;
/**
* Cast color channel's value to string
*/
public function __toString(): string;
}