1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage Image
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Image Filter class adjust the contrast of an image.
14 *
15 * @since 11.3
16 */
17 class JImageFilterContrast extends JImageFilter
18 {
19 /**
20 * Method to apply a filter to an image resource.
21 *
22 * @param array $options An array of options for the filter.
23 *
24 * @return void
25 *
26 * @since 11.3
27 * @throws InvalidArgumentException
28 */
29 public function execute(array $options = array())
30 {
31 // Validate that the contrast value exists and is an integer.
32 if (!isset($options[IMG_FILTER_CONTRAST]) || !is_int($options[IMG_FILTER_CONTRAST]))
33 {
34 throw new InvalidArgumentException('No valid contrast value was given. Expected integer.');
35 }
36
37 // Perform the contrast filter.
38 imagefilter($this->handle, IMG_FILTER_CONTRAST, $options[IMG_FILTER_CONTRAST]);
39 }
40 }
41