Total Complexity | 9 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | class EightBitChannel extends ColorChannel |
||
26 | { |
||
27 | public const VALUE_MIN = 0; |
||
28 | public const VALUE_MAX = 255; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | private int $value; |
||
34 | |||
35 | public function __construct(int $value) |
||
36 | { |
||
37 | if($value < self::VALUE_MIN) { $value = self::VALUE_MIN; } |
||
38 | if($value > self::VALUE_MAX) { $value = self::VALUE_MAX; } |
||
39 | |||
40 | $this->value = $value; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return int 0-255 |
||
45 | */ |
||
46 | public function getValue() : int |
||
49 | } |
||
50 | |||
51 | public function get8Bit() : int |
||
52 | { |
||
53 | return $this->value; |
||
54 | } |
||
55 | |||
56 | public function get7Bit() : int |
||
57 | { |
||
58 | return UnitsConverter::intEightBit2IntSevenBit($this->value); |
||
59 | } |
||
60 | |||
61 | public function getAlpha() : float |
||
62 | { |
||
63 | return UnitsConverter::intEightBit2Alpha($this->value); |
||
64 | } |
||
65 | |||
66 | public function getPercent() : float |
||
69 | } |
||
70 | |||
71 | public function invert() : EightBitChannel |
||
74 | } |
||
75 | } |
||
76 |