CColorRef:ToGray
The ToGray method returns the gray equivalent luminance of a color triplet. The conversion is computed using the standard visual response weights (see Visual Response Equivalent Gray).
nGray = CColorRef:ToGray()
nGray = CColorRef:ToGray( CColorRef )
nGray = CColorRef:ToGray( R, G, B )
Three overloads are provided for this method; they compute the gray equivalent for the class members, a CColorRef object, or for 3 explicit color values. If you pass something other than a CColorRef or R, G, B values, such as a string or a number, this method defaults to using the class members.
The following script fragment computes the equivalent gray intensity using all 3 of the overloads:
|
-- create a CColorRef with values |
|
-- result: Gray = 158.19 |
|
-- create a new copy of A |
|
-- invert the colors of B |
|
-- result: Gray = 96.81 |
|
-- result: Gray = 96.81 |