Image_Color2
[ class tree: Image_Color2 ] [ index: Image_Color2 ] [ all elements ]

Class: Image_Color2_Model_Grayscale

Source Location: /Image_Color2-0.1.5/Image/Color2/Model/Grayscale.php

Class Overview


Grayscale color model converts RGB values to gray scale using perceptive proportional sum of the RGB channels.


Author(s):

Copyright:

  • 2005

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 46]
Grayscale color model converts RGB values to gray scale using perceptive proportional sum of the RGB channels.

The formula was taken, indirectly, from the GIMP: "The formula used in the GIMP is Y = 0.3R + 0.59G + 0.11B; this result is known as luminance. The weights used to compute luminance are related to the monitor's phosphors. The explanation for these weights is due to the fact that for equal amounts of color the eye is most sensitive to green, then red, and then blue. This means that for equal amounts of green and blue light the green will, nevertheless, seem much brighter". Gimp-Savvy.com



[ Top ]


Class Variables

$_val =  0

[line 51]

Grayscale component
  • Var: 0.0 - 1.0
  • Access: protected

Type:   float


[ Top ]



Method Detail

__construct (Constructor)   [line 62]

Image_Color2_Model_Grayscale __construct( float $val)

Construct the Grayscale color from RGB components.
  • Access: protected

Parameters:

float   $val     0.0 - 1.0

[ Top ]

fromArray   [line 101]

Image_Color2_Model_Grayscale fromArray( array $array)

Pull the grayscale component out of the array and return a instance of Image_Color2_Model.
  • Access: public

Parameters:

array   $array     An array with a floating point gray scale component.

[ Top ]

fromRgb   [line 81]

Image_Color2_Model_Grayscale fromRgb( array $rgb)

Pass the RGB components to the constructor and return a new instance of Image_Color2_Model.
  • Access: public

Parameters:

array   $rgb     A PEAR style RGB array containing three integers from 0 to 255 for the Red, Green, and Blue color components followed by a 'type' => 'rgb' element.

[ Top ]

fromString   [line 114]

Image_Color2_Model_Grayscale fromString( string $str)

Convert the Grayscale string into RGB components and return a new instance of Image_Color2_Model.
  • Access: public

Parameters:

string   $str     Grayscale expressed as a floating point value from zero to one ('0.005', '.3333', '1') or percent string ('0.5%', '33.33%', '100%').

[ Top ]

getArray   [line 144]

array getArray( )

  • Return: An array with two elements, the first is the color, a float from 0 to 1 and the second type => named element.
  • Access: public

[ Top ]

getRgb   [line 133]

array getRgb( )

  • Return: A PEAR style RGB array containing three integers from 0 to 255 for the Red, Green, and Blue color components followed by a 'type' => 'rgb' element.
  • Access: public

[ Top ]

getString   [line 153]

string getString( )

  • Access: public

[ Top ]


Documentation generated on Mon, 20 Sep 2010 10:30:02 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.