CAsciiArt.php
public function getLuminance($red, $green, $blue)
    {
        switch ($this->luminanceStrategy) {
            case 1:
                $luminance = ($red * 0.2126 + $green * 0.7152 + $blue * 0.0722) / 255;
                break;
            case 2:
                $luminance = ($red * 0.299 + $green * 0.587 + $blue * 0.114) / 255;
                break;
            case 3:
                $luminance = sqrt(0.299 * pow($red, 2) + 0.587 * pow($green, 2) + 0.114 * pow($blue, 2)) / 255;
                break;
            case 0:
            default:
                $luminance = ($red + $green + $blue) / (255 * 3);
        }

        return $luminance;
    }
public function getLuminance($red, $green, $blue)
    {
        switch ($this->luminanceStrategy) {
            case 1:
                $luminance = ($red * 0.2126 + $green * 0.7152 + $blue * 0.0722) / 255;
                break;
            case 2:
                $luminance = ($red * 0.299 + $green * 0.587 + $blue * 0.114) / 255;
                break;
            case 3:
                $luminance = sqrt(0.299 * pow($red, 2) + 0.587 * pow($green, 2) + 0.114 * pow($blue, 2)) / 255;
                break;
            case 0:
            default:
                $luminance = ($red + $green + $blue) / (255 * 3);
        }

        return $luminance;
    }
public function getLuminance ( $ red , $ green , $ blue ) { switch ( $ this -> luminanceStrategy ) { case 1 : $ luminance = ( $ red * 0.2126 + $ green * 0.7152 + $ blue * 0.0722 ) / 255 ; break ; case 2 : $ luminance = ( $ red * 0.299 + $ green * 0.587 + $ blue * 0.114 ) / 255 ; break ; case 3 : $ luminance = sqrt ( 0.299 * pow ( $ red , 2 ) + 0.587 * pow ( $ green , 2 ) + 0.114 * pow ( $ blue , 2 ) ) / 255 ; break ; case 0 : default : $ luminance = ( $ red + $ green + $ blue ) / ( 255 * 3 ) ; } return $ luminance ; }
Calculate luminance value with different strategies.

@param integer $red   The color red.
@param integer $green The color green.
@param integer $blue  The color blue.

@return float $luminance with a value between 0 and 1.
Calculate luminance value with different strategies .