Location: PHPKode > scripts > myColors > vylson-silwr-myColors-2550f71/lab/tone_formula.php
<?php

	/**
	 * myColors
	 *
	 *	 Discover Your Colors!
	 *
	 * @author vylson silwr  <hide@address.com>
	 * @version 1.0
	 * @copyright   (C)2007 vylson silwr- GNU GPL
	 * @license       http://www.gnu.org/licenses/gpl.html GNU General public License
	 * @package myColors
	 */

	// -----------------tone_formula.php-------------------- //

	require '../core/AbstractFormula.php';

	/**
	 * tone formula
	 *
	 * adding degree to the rgb values and thus causing the following color to
	 * increase/ decrease  the lightness/darkness
	 *
	 */

	class tone Extends AbstractFormula
	{

		/**
		 * manipulates
		 *
		 * @return string
		 */

		public function output()
		{
			$r = $this -> _do($this -> _red + $this -> _degree);
			$g = $this -> _do($this -> _green + $this -> _degree);
			$b = $this -> _do($this -> _blue + $this -> _degree);
			return $r . $g . $b;
		}

		/**
		 * converts to hex value.
		 *
		 * @return string
		 */

		private function _do($num)
		{
			if ($num >= 256)
				return 'ff';
			elseif ($num <= 1)
				return '00';
			else
				return array_search($num, $this -> _get_hex_from_number);

		}

	}

	//--------------class ends---------------//
?>
Return current item: myColors