Permalink
Browse files

Move vendor/Joomla to src/Joomla. Update necessary paths.

  • Loading branch information...
0 parents commit 03f0f81d16e0214ee783048513d1ab9bb06fb6db @dongilbert dongilbert committed Mar 27, 2013
@@ -0,0 +1,4 @@
+vendor/
+composer.phar
+composer.lock
+phpunit.xml
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Part of the Joomla Framework Image Package
+ *
+ * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+namespace Joomla\Image;
+
+use Psr\Log\LoggerInterface;
+use Psr\Log\LoggerAwareInterface;
+
+/**
+ * Class to manipulate an image.
+ *
+ * @since 1.0
+ */
+abstract class Filter implements LoggerAwareInterface
+{
+ /**
+ * @var resource The image resource handle.
+ * @since 1.0
+ */
+ protected $handle;
+
+ /**
+ * @var LoggerInterface Logger object
+ * @since 1.0
+ */
+ protected $logger = null;
+
+ /**
+ * Class constructor.
+ *
+ * @param resource $handle The image resource on which to apply the filter.
+ *
+ * @since 1.0
+ * @throws \InvalidArgumentException
+ * @throws \RuntimeException
+ */
+ public function __construct($handle)
+ {
+ // Verify that image filter support for PHP is available.
+ if (!function_exists('imagefilter'))
+ {
+ // @codeCoverageIgnoreStart
+ if ($this->logger)
+ {
+ $this->logger->error('The imagefilter function for PHP is not available.');
+ }
+ throw new \RuntimeException('The imagefilter function for PHP is not available.');
+
+ // @codeCoverageIgnoreEnd
+ }
+
+ // Make sure the file handle is valid.
+ if (!is_resource($handle) || (get_resource_type($handle) != 'gd'))
+ {
+ if ($this->logger)
+ {
+ $this->logger->error('The image handle is invalid for the image filter.');
+ }
+ throw new \InvalidArgumentException('The image handle is invalid for the image filter.');
+ }
+
+ $this->handle = $handle;
+ }
+
+ /**
+ * Sets a logger instance on the object
+ *
+ * @param LoggerInterface $logger A PSR-3 compliant logger.
+ *
+ * @return void
+ *
+ * @since 1.0
+ */
+ public function setLogger(LoggerInterface $logger)
+ {
+ $this->logger = $logger;
+ }
+
+ /**
+ * Method to apply a filter to an image resource.
+ *
+ * @param array $options An array of options for the filter.
+ *
+ * @return void
+ *
+ * @since 1.0
+ */
+ abstract public function execute(array $options = array());
+}
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Part of the Joomla Framework Image Package
+ *
+ * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+namespace Joomla\Image\Filter;
+
+use Joomla\Image\Filter;
+use InvalidArgumentException;
+
+/**
+ * Image Filter class adjust the brightness of an image.
+ *
+ * @since 1.0
+ */
+class Brightness extends Filter
+{
+ /**
+ * Method to apply a filter to an image resource.
+ *
+ * @param array $options An array of options for the filter.
+ *
+ * @return void
+ *
+ * @since 1.0
+ * @throws InvalidArgumentException
+ */
+ public function execute(array $options = array())
+ {
+ // Validate that the brightness value exists and is an integer.
+ if (!isset($options[IMG_FILTER_BRIGHTNESS]) || !is_int($options[IMG_FILTER_BRIGHTNESS]))
+ {
+ throw new InvalidArgumentException('No valid brightness value was given. Expected integer.');
+ }
+
+ // Perform the brightness filter.
+ imagefilter($this->handle, IMG_FILTER_BRIGHTNESS, $options[IMG_FILTER_BRIGHTNESS]);
+ }
+}
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Part of the Joomla Framework Image Package
+ *
+ * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+namespace Joomla\Image\Filter;
+
+use Joomla\Image\Filter;
+use InvalidArgumentException;
+
+/**
+ * Image Filter class adjust the contrast of an image.
+ *
+ * @since 1.0
+ */
+class Contrast extends Filter
+{
+ /**
+ * Method to apply a filter to an image resource.
+ *
+ * @param array $options An array of options for the filter.
+ *
+ * @return void
+ *
+ * @since 1.0
+ * @throws InvalidArgumentException
+ */
+ public function execute(array $options = array())
+ {
+ // Validate that the contrast value exists and is an integer.
+ if (!isset($options[IMG_FILTER_CONTRAST]) || !is_int($options[IMG_FILTER_CONTRAST]))
+ {
+ throw new InvalidArgumentException('No valid contrast value was given. Expected integer.');
+ }
+
+ // Perform the contrast filter.
+ imagefilter($this->handle, IMG_FILTER_CONTRAST, $options[IMG_FILTER_CONTRAST]);
+ }
+}
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Part of the Joomla Framework Image Package
+ *
+ * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+namespace Joomla\Image\Filter;
+
+use Joomla\Image\Filter;
+
+/**
+ * Image Filter class to add an edge detect effect to an image.
+ *
+ * @since 1.0
+ */
+class Edgedetect extends Filter
+{
+ /**
+ * Method to apply a filter to an image resource.
+ *
+ * @param array $options An array of options for the filter.
+ *
+ * @return void
+ *
+ * @since 1.0
+ */
+ public function execute(array $options = array())
+ {
+ // Perform the edge detection filter.
+ imagefilter($this->handle, IMG_FILTER_EDGEDETECT);
+ }
+}
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Part of the Joomla Framework Image Package
+ *
+ * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+namespace Joomla\Image\Filter;
+
+use Joomla\Image\Filter;
+
+/**
+ * Image Filter class to emboss an image.
+ *
+ * @since 1.0
+ */
+class Emboss extends Filter
+{
+ /**
+ * Method to apply a filter to an image resource.
+ *
+ * @param array $options An array of options for the filter.
+ *
+ * @return void
+ *
+ * @since 1.0
+ */
+ public function execute(array $options = array())
+ {
+ // Perform the emboss filter.
+ imagefilter($this->handle, IMG_FILTER_EMBOSS);
+ }
+}
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Part of the Joomla Framework Image Package
+ *
+ * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+namespace Joomla\Image\Filter;
+
+use Joomla\Image\Filter;
+
+/**
+ * Image Filter class to transform an image to grayscale.
+ *
+ * @since 1.0
+ */
+class Grayscale extends Filter
+{
+ /**
+ * Method to apply a filter to an image resource.
+ *
+ * @param array $options An array of options for the filter.
+ *
+ * @return void
+ *
+ * @since 1.0
+ */
+ public function execute(array $options = array())
+ {
+ // Perform the grayscale filter.
+ imagefilter($this->handle, IMG_FILTER_GRAYSCALE);
+ }
+}
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Part of the Joomla Framework Image Package
+ *
+ * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+namespace Joomla\Image\Filter;
+
+use Joomla\Image\Filter;
+
+/**
+ * Image Filter class to negate the colors of an image.
+ *
+ * @since 1.0
+ */
+class Negate extends Filter
+{
+ /**
+ * Method to apply a filter to an image resource.
+ *
+ * @param array $options An array of options for the filter.
+ *
+ * @return void
+ *
+ * @since 1.0
+ */
+ public function execute(array $options = array())
+ {
+ // Perform the negative filter.
+ imagefilter($this->handle, IMG_FILTER_NEGATE);
+ }
+}
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Part of the Joomla Framework Image Package
+ *
+ * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+namespace Joomla\Image\Filter;
+
+use Joomla\Image\Filter;
+
+/**
+ * Image Filter class to make an image appear "sketchy".
+ *
+ * @since 1.0
+ */
+class Sketchy extends Filter
+{
+ /**
+ * Method to apply a filter to an image resource.
+ *
+ * @param array $options An array of options for the filter.
+ *
+ * @return void
+ *
+ * @since 1.0
+ */
+ public function execute(array $options = array())
+ {
+ // Perform the sketchy filter.
+ imagefilter($this->handle, IMG_FILTER_MEAN_REMOVAL);
+ }
+}
Oops, something went wrong.

0 comments on commit 03f0f81

Please sign in to comment.