From 38b46ab20d10e662615512767a59765d788a4a1b Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 8 Jul 2010 10:02:39 -0400 Subject: [PATCH] 2 more utility functions to Horde_Image --- framework/Image/lib/Horde/Image.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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. -- 2.11.0