From: Michael J. Rubinsky Date: Thu, 8 Jul 2010 14:02:39 +0000 (-0400) Subject: 2 more utility functions to Horde_Image X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=38b46ab20d10e662615512767a59765d788a4a1b;p=horde.git 2 more utility functions to Horde_Image --- diff --git a/framework/Image/lib/Horde/Image.php b/framework/Image/lib/Horde/Image.php index e1097ece8..0f825652e 100644 --- a/framework/Image/lib/Horde/Image.php +++ b/framework/Image/lib/Horde/Image.php @@ -91,6 +91,23 @@ class Horde_Image } /** + * @TODO + */ + static public function grayscaleValue($r, $g, $b) + { + return round(($r * 0.30) + ($g * 0.59) + ($b * 0.11)); + } + + /** + * @TODO + */ + static public function grayscalePixel($originalPixel) + { + $gray = Horde_Image::grayscaleValue($originalPixel['red'], $originalPixel['green'], $originalPixel['blue']); + return array('red'=>$gray, 'green'=>$gray, 'blue'=>$gray); + } + + /** * Normalizes an HTML color. * * @param string $color An HTML color, e.g.: #ffffcc or #ffc.