| @@ 56-65 (lines=10) @@ | ||
| 53 | * @param int $level |
|
| 54 | * @return ImageInterface |
|
| 55 | */ |
|
| 56 | public function brightness(int $level): ImageInterface |
|
| 57 | { |
|
| 58 | if (!$this->compareRangeValue($level, 255)) |
|
| 59 | { |
|
| 60 | throw new InvalidArgumentException('Wrong brightness level, range -255 - 255, ' . $level . ' given'); |
|
| 61 | } |
|
| 62 | imagefilter($this->getImage(), IMG_FILTER_BRIGHTNESS, $level); |
|
| 63 | ||
| 64 | return $this; |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * @param int $level |
|
| @@ 71-81 (lines=11) @@ | ||
| 68 | * @param int $level |
|
| 69 | * @return ImageInterface |
|
| 70 | */ |
|
| 71 | public function contrast(int $level): ImageInterface |
|
| 72 | { |
|
| 73 | if (!$this->compareRangeValue($level, 100)) |
|
| 74 | { |
|
| 75 | throw new InvalidArgumentException('Wrong contrast level, range -100 - 100, ' . $level . ' given'); |
|
| 76 | } |
|
| 77 | imagefilter($this->getImage(), IMG_FILTER_CONTRAST, $level); |
|
| 78 | ||
| 79 | return $this; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * @return ImageInterface |
|
| 84 | */ |
|
| @@ 268-277 (lines=10) @@ | ||
| 265 | * @param int $level |
|
| 266 | * @return ImageInterface |
|
| 267 | */ |
|
| 268 | public function brightness(int $level): ImageInterface |
|
| 269 | { |
|
| 270 | if (!$this->compareRangeValue($level, 200)) |
|
| 271 | { |
|
| 272 | throw new InvalidArgumentException('Wrong brightness level, range 0 - 200, ' . $level . ' given'); |
|
| 273 | } |
|
| 274 | $this->getImage()->modulateImage(abs($level), 100, 100); |
|
| 275 | ||
| 276 | return $this; |
|
| 277 | } |
|
| 278 | ||
| 279 | /** |
|
| 280 | * @param int $level |
|
| @@ 283-292 (lines=10) @@ | ||
| 280 | * @param int $level |
|
| 281 | * @return ImageInterface |
|
| 282 | */ |
|
| 283 | public function contrast(int $level): ImageInterface |
|
| 284 | { |
|
| 285 | if (!$this->compareRangeValue($level, 100)) |
|
| 286 | { |
|
| 287 | throw new InvalidArgumentException('Wrong contrast level, range 0 - 100, ' . $level . ' given'); |
|
| 288 | } |
|
| 289 | $this->getImage()->brightnessContrastImage(0, abs($level)); |
|
| 290 | ||
| 291 | return $this; |
|
| 292 | } |
|
| 293 | ||
| 294 | /** |
|
| 295 | * @return ImageInterface |
|